Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit a8fe2cc

Browse files
gkalpakcaitp
authored andcommitted
test(input): test that number validates with unspecified viewValue
Adds an additional test verifying that a number which is not required will validate successfully when ngModelCtrl.$validate() is called. Before 92f05e5 landed, this would have failed because of a parse error. Closes #9193
1 parent e522c25 commit a8fe2cc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/ng/directive/inputSpec.js

+11
Original file line numberDiff line numberDiff line change
@@ -3514,6 +3514,17 @@ describe('input', function() {
35143514
expect(inputElm).toBeValid();
35153515
});
35163516

3517+
3518+
it('should validate with undefined viewValue when $validate() called', function() {
3519+
compileInput('<input type="number" name="alias" ng-model="value" />');
3520+
3521+
scope.form.alias.$validate();
3522+
3523+
expect(inputElm).toBeValid();
3524+
expect(scope.form.alias.$error.number).toBeUndefined();
3525+
});
3526+
3527+
35173528
it('should throw if the model value is not a number', function() {
35183529
expect(function() {
35193530
scope.value = 'one';

0 commit comments

Comments
 (0)