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
This commit is contained in:
austingreco
2013-03-29 23:45:53 -05:00
committed by Vojta Jina
parent a91405889f
commit 12b6deb1ce
2 changed files with 17 additions and 3 deletions

View File

@@ -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$/;