diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/directive/formSpec.js | 18 | ||||
| -rw-r--r-- | test/directive/inputSpec.js | 32 | ||||
| -rw-r--r-- | test/directive/selectSpec.js | 6 |
3 files changed, 28 insertions, 28 deletions
diff --git a/test/directive/formSpec.js b/test/directive/formSpec.js index b1859d44..41c90a89 100644 --- a/test/directive/formSpec.js +++ b/test/directive/formSpec.js @@ -38,12 +38,12 @@ describe('form', function() { '</form>')(scope); var form = scope.myForm; - control.$setValidity('REQUIRED', false); + control.$setValidity('required', false); expect(form.alias).toBe(control); - expect(form.$error.REQUIRED).toEqual([control]); + expect(form.$error.required).toEqual([control]); doc.find('input').remove(); - expect(form.$error.REQUIRED).toBeUndefined(); + expect(form.$error.required).toBeUndefined(); expect(form.alias).toBeUndefined(); }); @@ -131,10 +131,10 @@ describe('form', function() { scope.$apply(); - expect(scope.formA.$error.REQUIRED.length).toBe(1); - expect(scope.formA.$error.REQUIRED).toEqual([scope.formA.firstName]); - expect(scope.formB.$error.REQUIRED.length).toBe(1); - expect(scope.formB.$error.REQUIRED).toEqual([scope.formB.lastName]); + expect(scope.formA.$error.required.length).toBe(1); + expect(scope.formA.$error.required).toEqual([scope.formA.firstName]); + expect(scope.formB.$error.required.length).toBe(1); + expect(scope.formB.$error.required).toEqual([scope.formB.lastName]); var inputA = doc.find('input').eq(0), inputB = doc.find('input').eq(1); @@ -147,8 +147,8 @@ describe('form', function() { expect(scope.firstName).toBe('val1'); expect(scope.lastName).toBe('val2'); - expect(scope.formA.$error.REQUIRED).toBeUndefined(); - expect(scope.formB.$error.REQUIRED).toBeUndefined(); + expect(scope.formA.$error.required).toBeUndefined(); + expect(scope.formB.$error.required).toBeUndefined(); }); diff --git a/test/directive/inputSpec.js b/test/directive/inputSpec.js index 108ef5c3..d68f6c54 100644 --- a/test/directive/inputSpec.js +++ b/test/directive/inputSpec.js @@ -50,11 +50,11 @@ describe('NgModelController', function() { it('should set and unset the error', function() { - ctrl.$setValidity('REQUIRED', false); - expect(ctrl.$error.REQUIRED).toBe(true); + ctrl.$setValidity('required', false); + expect(ctrl.$error.required).toBe(true); - ctrl.$setValidity('REQUIRED', true); - expect(ctrl.$error.REQUIRED).toBeUndefined(); + ctrl.$setValidity('required', true); + expect(ctrl.$error.required).toBeUndefined(); }); @@ -296,10 +296,10 @@ describe('input', function() { compileInput('<input ng-model="name" name="alias" required>'); scope.$apply(); - expect(scope.form.$error.REQUIRED.length).toBe(1); + expect(scope.form.$error.required.length).toBe(1); inputElm.remove(); - expect(scope.form.$error.REQUIRED).toBeUndefined(); + expect(scope.form.$error.required).toBeUndefined(); }); @@ -535,12 +535,12 @@ describe('input', function() { changeInputValueTo('1'); expect(inputElm).toBeInvalid(); expect(scope.value).toBeFalsy(); - expect(scope.form.alias.$error.MIN).toBeTruthy(); + expect(scope.form.alias.$error.min).toBeTruthy(); changeInputValueTo('100'); expect(inputElm).toBeValid(); expect(scope.value).toBe(100); - expect(scope.form.alias.$error.MIN).toBeFalsy(); + expect(scope.form.alias.$error.min).toBeFalsy(); }); }); @@ -554,12 +554,12 @@ describe('input', function() { changeInputValueTo('20'); expect(inputElm).toBeInvalid(); expect(scope.value).toBeFalsy(); - expect(scope.form.alias.$error.MAX).toBeTruthy(); + expect(scope.form.alias.$error.max).toBeTruthy(); changeInputValueTo('0'); expect(inputElm).toBeValid(); expect(scope.value).toBe(0); - expect(scope.form.alias.$error.MAX).toBeFalsy(); + expect(scope.form.alias.$error.max).toBeFalsy(); }); }); @@ -572,7 +572,7 @@ describe('input', function() { changeInputValueTo('0'); expect(inputElm).toBeValid(); expect(scope.value).toBe(0); - expect(scope.form.alias.$error.REQUIRED).toBeFalsy(); + expect(scope.form.alias.$error.required).toBeFalsy(); }); it('should be valid even if value 0 is set from model', function() { @@ -584,7 +584,7 @@ describe('input', function() { expect(inputElm).toBeValid(); expect(inputElm.val()).toBe('0') - expect(scope.form.alias.$error.REQUIRED).toBeFalsy(); + expect(scope.form.alias.$error.required).toBeFalsy(); }); }); }); @@ -599,12 +599,12 @@ describe('input', function() { expect(scope.email).toBe('vojta@google.com'); expect(inputElm).toBeValid(); - expect(widget.$error.EMAIL).toBeUndefined(); + expect(widget.$error.email).toBeUndefined(); changeInputValueTo('invalid@'); expect(scope.email).toBeUndefined(); expect(inputElm).toBeInvalid(); - expect(widget.$error.EMAIL).toBeTruthy(); + expect(widget.$error.email).toBeTruthy(); }); @@ -627,12 +627,12 @@ describe('input', function() { changeInputValueTo('http://www.something.com'); expect(scope.url).toBe('http://www.something.com'); expect(inputElm).toBeValid(); - expect(widget.$error.URL).toBeUndefined(); + expect(widget.$error.url).toBeUndefined(); changeInputValueTo('invalid.com'); expect(scope.url).toBeUndefined(); expect(inputElm).toBeInvalid(); - expect(widget.$error.URL).toBeTruthy(); + expect(widget.$error.url).toBeTruthy(); }); diff --git a/test/directive/selectSpec.js b/test/directive/selectSpec.js index c6cfa377..e374fbe1 100644 --- a/test/directive/selectSpec.js +++ b/test/directive/selectSpec.js @@ -55,7 +55,7 @@ describe('select', function() { scope.selection = 'c'; }); - expect(scope.form.select.$error.REQUIRED).toBeFalsy(); + expect(scope.form.select.$error.required).toBeFalsy(); expect(element).toBeValid(); expect(element).toBePristine(); @@ -63,7 +63,7 @@ describe('select', function() { scope.selection = ''; }); - expect(scope.form.select.$error.REQUIRED).toBeTruthy(); + expect(scope.form.select.$error.required).toBeTruthy(); expect(element).toBeInvalid(); expect(element).toBePristine(); expect(scope.log).toEqual(''); @@ -117,7 +117,7 @@ describe('select', function() { scope.selection = []; }); - expect(scope.form.select.$error.REQUIRED).toBeTruthy(); + expect(scope.form.select.$error.required).toBeTruthy(); expect(element).toBeInvalid(); expect(element).toBePristine(); |
