diff options
| author | austingreco | 2013-03-29 23:45:53 -0500 |
|---|---|---|
| committer | Vojta Jina | 2013-04-16 14:49:17 -0700 |
| commit | 12b6deb1ce99df64e2fc91a06bf05cd7f4a3a475 (patch) | |
| tree | 8cba261efdeffc87c007b12cd0c50cdd2ff563c9 /test | |
| parent | a91405889f0d0d5c3ed41f2a77c9305a404ded7f (diff) | |
| download | angular.js-12b6deb1ce99df64e2fc91a06bf05cd7f4a3a475.tar.bz2 | |
fix(ngPattern): allow modifiers on inline ng-pattern
Add support for regex modifiers on inline `ng-pattern`.
`ng-pattern="/regex/i"` now validates correctly.
Closes #1437
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/directive/inputSpec.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 4dcb79a3..d69be27c 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -476,6 +476,18 @@ describe('input', function() { }); + it('should validate in-lined pattern with modifiers', function() { + compileInput('<input type="text" ng-model="value" ng-pattern="/^abc?$/i" />'); + scope.$digest(); + + changeInputValueTo('aB'); + expect(inputElm).toBeValid(); + + changeInputValueTo('xx'); + expect(inputElm).toBeInvalid(); + }); + + it('should validate pattern from scope', function() { compileInput('<input type="text" ng-model="value" ng-pattern="regexp" />'); scope.regexp = /^\d\d\d-\d\d-\d\d\d\d$/; |
