diff options
Diffstat (limited to 'test/directive/inputSpec.js')
| -rw-r--r-- | test/directive/inputSpec.js | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/test/directive/inputSpec.js b/test/directive/inputSpec.js index 54f3f7cd..5a0c4168 100644 --- a/test/directive/inputSpec.js +++ b/test/directive/inputSpec.js @@ -204,11 +204,11 @@ describe('NgModelController', function() { }); }); -describe('ng:model', function() { +describe('ng-model', function() { it('should set css classes (ng-valid, ng-invalid, ng-pristine, ng-dirty)', inject(function($compile, $rootScope) { - var element = $compile('<input type="email" ng:model="value" />')($rootScope); + var element = $compile('<input type="email" ng-model="value" />')($rootScope); $rootScope.$digest(); expect(element).toBeValid(); @@ -260,7 +260,7 @@ describe('input', function() { it('should bind to a model', function() { - compileInput('<input type="text" ng:model="name" name="alias" ng:change="change()" />'); + compileInput('<input type="text" ng-model="name" name="alias" ng-change="change()" />'); scope.$apply(function() { scope.name = 'misko'; @@ -271,7 +271,7 @@ describe('input', function() { it('should call $destroy on element remove', function() { - compileInput('<input type="text" ng:model="name" name="alias" ng:change="change()" />'); + compileInput('<input type="text" ng-model="name" name="alias" ng-change="change()" />'); var spy = jasmine.createSpy('on destroy'); scope.$on('$destroy', spy); @@ -282,7 +282,7 @@ describe('input', function() { it('should update the model on "blur" event', function() { - compileInput('<input type="text" ng:model="name" name="alias" ng:change="change()" />'); + compileInput('<input type="text" ng-model="name" name="alias" ng-change="change()" />'); changeInputValueTo('adam'); expect(scope.name).toEqual('adam'); @@ -290,7 +290,7 @@ describe('input', function() { it('should update the model and trim the value', function() { - compileInput('<input type="text" ng:model="name" name="alias" ng:change="change()" />'); + compileInput('<input type="text" ng-model="name" name="alias" ng-change="change()" />'); changeInputValueTo(' a '); expect(scope.name).toEqual('a'); @@ -298,7 +298,7 @@ describe('input', function() { it('should allow complex reference binding', function() { - compileInput('<input type="text" ng:model="obj[\'abc\'].name"/>'); + compileInput('<input type="text" ng-model="obj[\'abc\'].name"/>'); scope.$apply(function() { scope.obj = { abc: { name: 'Misko'} }; @@ -307,7 +307,7 @@ describe('input', function() { }); - it('should ignore input without ng:model attr', function() { + it('should ignore input without ng-model attr', function() { compileInput('<input type="text" name="whatever" required />'); browserTrigger(inputElm, 'blur'); @@ -320,14 +320,14 @@ describe('input', function() { it('should report error on assignment error', function() { expect(function() { - compileInput('<input type="text" ng:model="throw \'\'">'); + compileInput('<input type="text" ng-model="throw \'\'">'); scope.$digest(); }).toThrow("Syntax Error: Token '''' is an unexpected token at column 7 of the expression [throw ''] starting at ['']."); }); it("should render as blank if null", function() { - compileInput('<input type="text" ng:model="age" />'); + compileInput('<input type="text" ng-model="age" />'); scope.$apply(function() { scope.age = null; @@ -339,7 +339,7 @@ describe('input', function() { it('should render 0 even if it is a number', function() { - compileInput('<input type="text" ng:model="value" />'); + compileInput('<input type="text" ng-model="value" />'); scope.$apply(function() { scope.value = 0; }); @@ -351,7 +351,7 @@ describe('input', function() { describe('pattern', function() { it('should validate in-lined pattern', function() { - compileInput('<input type="text" ng:model="value" ng:pattern="/^\\d\\d\\d-\\d\\d-\\d\\d\\d\\d$/" />'); + compileInput('<input type="text" ng-model="value" ng-pattern="/^\\d\\d\\d-\\d\\d-\\d\\d\\d\\d$/" />'); scope.$digest(); changeInputValueTo('x000-00-0000x'); @@ -372,7 +372,7 @@ describe('input', function() { it('should validate pattern from scope', function() { - compileInput('<input type="text" ng:model="value" ng:pattern="regexp" />'); + compileInput('<input type="text" ng-model="value" ng-pattern="regexp" />'); scope.regexp = /^\d\d\d-\d\d-\d\d\d\d$/; scope.$digest(); @@ -402,7 +402,7 @@ describe('input', function() { xit('should throw an error when scope pattern can\'t be found', function() { - compileInput('<input type="text" ng:model="foo" ng:pattern="fooRegexp" />'); + compileInput('<input type="text" ng-model="foo" ng-pattern="fooRegexp" />'); expect(function() { changeInputValueTo('xx'); }). toThrow('Expected fooRegexp to be a RegExp but was undefined'); @@ -413,7 +413,7 @@ describe('input', function() { describe('minlength', function() { it('should invalid shorter than given minlenght', function() { - compileInput('<input type="text" ng:model="value" ng:minlength="3" />'); + compileInput('<input type="text" ng-model="value" ng-minlength="3" />'); changeInputValueTo('aa'); expect(scope.value).toBeUndefined(); @@ -427,7 +427,7 @@ describe('input', function() { describe('maxlength', function() { it('should invalid shorter than given maxlenght', function() { - compileInput('<input type="text" ng:model="value" ng:maxlength="5" />'); + compileInput('<input type="text" ng-model="value" ng-maxlength="5" />'); changeInputValueTo('aaaaaaaa'); expect(scope.value).toBeUndefined(); @@ -443,7 +443,7 @@ describe('input', function() { describe('number', function() { it('should not update model if view invalid', function() { - compileInput('<input type="number" ng:model="age"/>'); + compileInput('<input type="number" ng-model="age"/>'); scope.$apply(function() { scope.age = 123; @@ -465,7 +465,7 @@ describe('input', function() { it('should render as blank if null', function() { - compileInput('<input type="number" ng:model="age" />'); + compileInput('<input type="number" ng-model="age" />'); scope.$apply(function() { scope.age = null; @@ -477,7 +477,7 @@ describe('input', function() { it('should come up blank when no value specified', function() { - compileInput('<input type="number" ng:model="age" />'); + compileInput('<input type="number" ng-model="age" />'); scope.$digest(); expect(inputElm.val()).toBe(''); @@ -492,7 +492,7 @@ describe('input', function() { it('should parse empty string to null', function() { - compileInput('<input type="number" ng:model="age" />'); + compileInput('<input type="number" ng-model="age" />'); scope.$apply(function() { scope.age = 10; @@ -507,7 +507,7 @@ describe('input', function() { describe('min', function() { it('should validate', function() { - compileInput('<input type="number" ng:model="value" name="alias" min="10" />'); + compileInput('<input type="number" ng-model="value" name="alias" min="10" />'); scope.$digest(); changeInputValueTo('1'); @@ -526,7 +526,7 @@ describe('input', function() { describe('max', function() { it('should validate', function() { - compileInput('<input type="number" ng:model="value" name="alias" max="10" />'); + compileInput('<input type="number" ng-model="value" name="alias" max="10" />'); scope.$digest(); changeInputValueTo('20'); @@ -545,7 +545,7 @@ describe('input', function() { describe('required', function() { it('should be valid even if value is 0', function() { - compileInput('<input type="number" ng:model="value" name="alias" required />'); + compileInput('<input type="number" ng-model="value" name="alias" required />'); changeInputValueTo('0'); expect(inputElm).toBeValid(); @@ -554,7 +554,7 @@ describe('input', function() { }); it('should be valid even if value 0 is set from model', function() { - compileInput('<input type="number" ng:model="value" name="alias" required />'); + compileInput('<input type="number" ng-model="value" name="alias" required />'); scope.$apply(function() { scope.value = 0; @@ -570,7 +570,7 @@ describe('input', function() { describe('email', function() { it('should validate e-mail', function() { - compileInput('<input type="email" ng:model="email" name="alias" />'); + compileInput('<input type="email" ng-model="email" name="alias" />'); var widget = scope.form.alias; changeInputValueTo('vojta@google.com'); @@ -599,7 +599,7 @@ describe('input', function() { describe('url', function() { it('should validate url', function() { - compileInput('<input type="url" ng:model="url" name="alias" />'); + compileInput('<input type="url" ng-model="url" name="alias" />'); var widget = scope.form.alias; changeInputValueTo('http://www.something.com'); @@ -628,9 +628,9 @@ describe('input', function() { it('should update the model', function() { compileInput( - '<input type="radio" ng:model="color" value="white" />' + - '<input type="radio" ng:model="color" value="red" />' + - '<input type="radio" ng:model="color" value="blue" />'); + '<input type="radio" ng-model="color" value="white" />' + + '<input type="radio" ng-model="color" value="red" />' + + '<input type="radio" ng-model="color" value="blue" />'); scope.$apply(function() { scope.color = 'white'; @@ -655,8 +655,8 @@ describe('input', function() { xit('should allow {{expr}} as value', function() { scope.some = 11; compileInput( - '<input type="radio" ng:model="value" value="{{some}}" />' + - '<input type="radio" ng:model="value" value="{{other}}" />'); + '<input type="radio" ng-model="value" value="{{some}}" />' + + '<input type="radio" ng-model="value" value="{{other}}" />'); browserTrigger(inputElm[0]); expect(scope.value).toBe(true); @@ -669,7 +669,7 @@ describe('input', function() { describe('checkbox', function() { - it('should ignore checkbox without ng:model attr', function() { + it('should ignore checkbox without ng-model attr', function() { compileInput('<input type="checkbox" name="whatever" required />'); browserTrigger(inputElm, 'blur'); @@ -681,7 +681,7 @@ describe('input', function() { it('should format booleans', function() { - compileInput('<input type="checkbox" ng:model="name" />'); + compileInput('<input type="checkbox" ng-model="name" />'); scope.$apply(function() { scope.name = false; @@ -696,7 +696,7 @@ describe('input', function() { it('should support type="checkbox" with non-standard capitalization', function() { - compileInput('<input type="checkBox" ng:model="checkbox" />'); + compileInput('<input type="checkBox" ng-model="checkbox" />'); browserTrigger(inputElm, 'click'); expect(scope.checkbox).toBe(true); @@ -707,8 +707,8 @@ describe('input', function() { it('should allow custom enumeration', function() { - compileInput('<input type="checkbox" ng:model="name" ng:true-value="y" ' + - 'ng:false-value="n">'); + compileInput('<input type="checkbox" ng-model="name" ng-true-value="y" ' + + 'ng-false-value="n">'); scope.$apply(function() { scope.name = 'y'; @@ -737,7 +737,7 @@ describe('input', function() { describe('textarea', function() { it("should process textarea", function() { - compileInput('<textarea ng:model="name"></textarea>'); + compileInput('<textarea ng-model="name"></textarea>'); inputElm = formElm.find('textarea'); scope.$apply(function() { @@ -753,7 +753,7 @@ describe('input', function() { }); - it('should ignore textarea without ng:model attr', function() { + it('should ignore textarea without ng-model attr', function() { compileInput('<textarea name="whatever" required></textarea>'); inputElm = formElm.find('textarea'); @@ -766,10 +766,10 @@ describe('input', function() { }); - describe('ng:list', function() { + describe('ng-list', function() { it('should parse text into an array', function() { - compileInput('<input type="text" ng:model="list" ng:list />'); + compileInput('<input type="text" ng-model="list" ng-list />'); // model -> view scope.$apply(function() { @@ -787,7 +787,7 @@ describe('input', function() { // When the user types 'a,b' the 'a,' stage parses to ['a'] but if the // $parseModel function runs it will change to 'a', in essence preventing // the user from ever typying ','. - compileInput('<input type="text" ng:model="list" ng:list />'); + compileInput('<input type="text" ng-model="list" ng-list />'); changeInputValueTo('a '); expect(inputElm.val()).toEqual('a '); @@ -808,7 +808,7 @@ describe('input', function() { xit('should require at least one item', function() { - compileInput('<input type="text" ng:model="list" ng:list required />'); + compileInput('<input type="text" ng-model="list" ng-list required />'); changeInputValueTo(' , '); expect(inputElm).toBeInvalid(); @@ -816,7 +816,7 @@ describe('input', function() { it('should convert empty string to an empty array', function() { - compileInput('<input type="text" ng:model="list" ng:list />'); + compileInput('<input type="text" ng-model="list" ng-list />'); changeInputValueTo(''); expect(scope.list).toEqual([]); @@ -826,7 +826,7 @@ describe('input', function() { describe('required', function() { it('should allow bindings on required', function() { - compileInput('<input type="text" ng:model="value" required="{{required}}" />'); + compileInput('<input type="text" ng-model="value" required="{{required}}" />'); scope.$apply(function() { scope.required = false; @@ -857,7 +857,7 @@ describe('input', function() { it('should invalid initial value with bound required', function() { - compileInput('<input type="text" ng:model="value" required="{{required}}" />'); + compileInput('<input type="text" ng-model="value" required="{{required}}" />'); scope.$apply(function() { scope.required = true; @@ -868,7 +868,7 @@ describe('input', function() { it('should be $invalid but $pristine if not touched', function() { - compileInput('<input type="text" ng:model="name" name="alias" required />'); + compileInput('<input type="text" ng-model="name" name="alias" required />'); scope.$apply(function() { scope.name = ''; @@ -884,7 +884,7 @@ describe('input', function() { it('should allow empty string if not required', function() { - compileInput('<input type="text" ng:model="foo" />'); + compileInput('<input type="text" ng-model="foo" />'); changeInputValueTo('a'); changeInputValueTo(''); expect(scope.foo).toBe(''); @@ -892,17 +892,17 @@ describe('input', function() { it('should set $invalid when model undefined', function() { - compileInput('<input type="text" ng:model="notDefiend" required />'); + compileInput('<input type="text" ng-model="notDefiend" required />'); scope.$digest(); expect(inputElm).toBeInvalid(); }) }); - describe('ng:change', function() { + describe('ng-change', function() { it('should $eval expression after new value is set in the model', function() { - compileInput('<input type="text" ng:model="value" ng:change="change()" />'); + compileInput('<input type="text" ng-model="value" ng-change="change()" />'); scope.change = jasmine.createSpy('change').andCallFake(function() { expect(scope.value).toBe('new value'); @@ -913,7 +913,7 @@ describe('input', function() { }); it('should not $eval the expression if changed from model', function() { - compileInput('<input type="text" ng:model="value" ng:change="change()" />'); + compileInput('<input type="text" ng-model="value" ng-change="change()" />'); scope.change = jasmine.createSpy('change'); scope.$apply(function() { @@ -924,8 +924,8 @@ describe('input', function() { }); - it('should $eval ng:change expression on checkbox', function() { - compileInput('<input type="checkbox" ng:model="foo" ng:change="changeFn()">'); + it('should $eval ng-change expression on checkbox', function() { + compileInput('<input type="checkbox" ng-model="foo" ng-change="changeFn()">'); scope.changeFn = jasmine.createSpy('changeFn'); scope.$digest(); @@ -937,10 +937,10 @@ describe('input', function() { }); - describe('ng:model-instant', function() { + describe('ng-model-instant', function() { it('should bind keydown, change, input events', inject(function($browser) { - compileInput('<input type="text" ng:model="value" ng:model-instant />'); + compileInput('<input type="text" ng-model="value" ng-model-instant />'); inputElm.val('value1'); browserTrigger(inputElm, 'keydown'); |
