diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 15:57:10 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 15:57:18 +0200 |
commit | 2824b43b7332e847810f042c4183ce95ee90e852 (patch) | |
tree | 9a10f31c8acbf01d72336d3d065f8c8fda4b83c5 /js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js | |
parent | f0abeddd07fcf21e30c95d58885416ef40d65391 (diff) |
use bower for managing deps
Diffstat (limited to 'js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js')
-rw-r--r-- | js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js b/js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js new file mode 100644 index 000000000..afbdbfb1e --- /dev/null +++ b/js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js @@ -0,0 +1,47 @@ +xdescribe('uiMask', function () { + + var inputHtml = "<input ui-mask=\"'(9)9'\" ng-model='x'>"; + var $compile, $rootScope, element; + + beforeEach(module('ui.directives')); + beforeEach(inject(function (_$rootScope_, _$compile_) { + $rootScope = _$rootScope_; + $compile = _$compile_; + })); + + describe('ui changes on model changes', function () { + it('should update ui valid model value', function () { + $rootScope.x = undefined; + element = $compile(inputHtml)($rootScope); + $rootScope.$digest(); + expect(element.val()).toBe(''); + $rootScope.$apply(function () { + $rootScope.x = 12; + }); + expect(element.val()).toBe('(1)2'); + }); + it('should wipe out ui on invalid model value', function () { + $rootScope.x = 12; + element = $compile(inputHtml)($rootScope); + $rootScope.$digest(); + expect(element.val()).toBe('(1)2'); + $rootScope.$apply(function () { + $rootScope.x = 1; + }); + expect(element.val()).toBe(''); + }); + }); + + describe('model binding on ui change', function () { + //TODO: was having har time writing those tests, will open a separate issue for those + }); + + describe('should fail', function() { + it('errors on missing quotes', function() { + $rootScope.x = 42; + var errorInputHtml = "<input ui-mask=\"(9)9\" ng-model='x'>"; + element = $compile(errorInputHtml)($rootScope); + expect($rootScope.$digest).toThrow('The Mask widget is not correctly set up'); + }); + }); +});
\ No newline at end of file |