diff options
Diffstat (limited to 'js/vendor/angular-ui/modules/directives/mask')
3 files changed, 0 insertions, 90 deletions
diff --git a/js/vendor/angular-ui/modules/directives/mask/dependencies.json b/js/vendor/angular-ui/modules/directives/mask/dependencies.json deleted file mode 100644 index 6967d1d9c..000000000 --- a/js/vendor/angular-ui/modules/directives/mask/dependencies.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "core": [ "jquery" ], - "internal": [], - "external": [] -}
\ No newline at end of file diff --git a/js/vendor/angular-ui/modules/directives/mask/mask.js b/js/vendor/angular-ui/modules/directives/mask/mask.js deleted file mode 100644 index be970ba31..000000000 --- a/js/vendor/angular-ui/modules/directives/mask/mask.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - Attaches jquery-ui input mask onto input element - */ -angular.module('ui.directives').directive('uiMask', [ - function () { - return { - require:'ngModel', - link:function ($scope, element, attrs, controller) { - - /* We override the render method to run the jQuery mask plugin - */ - controller.$render = function () { - var value = controller.$viewValue || ''; - element.val(value); - element.mask($scope.$eval(attrs.uiMask)); - }; - - /* Add a parser that extracts the masked value into the model but only if the mask is valid - */ - controller.$parsers.push(function (value) { - //the second check (or) is only needed due to the fact that element.isMaskValid() will keep returning undefined - //until there was at least one key event - var isValid = element.isMaskValid() || angular.isUndefined(element.isMaskValid()) && element.val().length>0; - controller.$setValidity('mask', isValid); - return isValid ? value : undefined; - }); - - /* When keyup, update the view value - */ - element.bind('keyup', function () { - $scope.$apply(function () { - controller.$setViewValue(element.mask()); - }); - }); - } - }; - } -]); diff --git a/js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js b/js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js deleted file mode 100644 index afbdbfb1e..000000000 --- a/js/vendor/angular-ui/modules/directives/mask/test/maskSpec.js +++ /dev/null @@ -1,47 +0,0 @@ -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 |