mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-22 18:56:31 +00:00
test modal
This commit is contained in:
parent
f2424095e0
commit
ad0b5e7583
40
tests/gui/components/modal.spec.js
Normal file
40
tests/gui/components/modal.spec.js
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
const m = require('mochainon')
|
||||
|
||||
describe('Browser: Modal', function () {
|
||||
beforeEach(angular.mock.module(
|
||||
require('../../../lib/gui/app/components/modal/modal')
|
||||
))
|
||||
|
||||
describe('ModalService', function () {
|
||||
let ModalService
|
||||
|
||||
beforeEach(angular.mock.inject(function (_ModalService_) {
|
||||
ModalService = _ModalService_
|
||||
}))
|
||||
|
||||
describe('.open()', function () {
|
||||
it('should not emit any errors when the template is a non-empty string', function () {
|
||||
m.chai.expect(function () {
|
||||
ModalService.open({
|
||||
template: '<div>{{ \'Hello\' }}, World!</div>'
|
||||
})
|
||||
}).to.not.throw()
|
||||
})
|
||||
|
||||
it('should emit error on no template field', function () {
|
||||
m.chai.expect(function () {
|
||||
ModalService.open({})
|
||||
}).to.throw('One of component or template or templateUrl options is required.')
|
||||
})
|
||||
|
||||
it('should emit error on empty string template', function () {
|
||||
m.chai.expect(function () {
|
||||
ModalService.open({
|
||||
template: ''
|
||||
})
|
||||
}).to.throw('One of component or template or templateUrl options is required.')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user