Sha256: 97cf3d1fb1b51232a5cb3eb77cc07581589061a3881b970fa61e2805c783def6

Contents?: true

Size: 1.47 KB

Versions: 8

Compression:

Stored size: 1.47 KB

Contents

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');
    });
  });
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/mask/test/maskSpec.js