diff --git a/client/core/src/directives/specs/bind.spec.js b/client/core/src/directives/specs/bind.spec.js index e69de29bb..c96979f2f 100644 --- a/client/core/src/directives/specs/bind.spec.js +++ b/client/core/src/directives/specs/bind.spec.js @@ -0,0 +1,35 @@ +describe('Directive bind', () => { + let $scope; + let element; + let compile; + + beforeEach(() => { + angular.mock.module('client'); + }); + + compile = _element => { + inject(($compile, $rootScope, _$timeout_, _$httpBackend_) => { + $scope = $rootScope.$new(); + element = angular.element(_element); + _$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); + $compile(element)($scope); + $scope.$digest(); + }); + }; + + it('should throw an error when the directive atribute is not set', () => { + let html = `
`; + + expect(() => { + compile(html); + }).toThrow(Error(`vnBind: Binding keys not defined`)); + }); + + it('should throw an error when the command modifier is not valid', () => { + let html = `
`; + + expect(() => { + compile(html); + }).toThrow(new Error(`vnBind: Invalid modifier key in binding`)); + }); +});