test modal

This commit is contained in:
Benedict Aas 2018-02-07 11:47:16 +00:00
parent f2424095e0
commit ad0b5e7583

View 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.')
})
})
})
})