mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-31 05:20:27 +00:00
fix(ng:pattern): correctly parse out inlined regexp
This commit is contained in:
parent
a46f2a0db3
commit
5d43439dbe
2 changed files with 3 additions and 3 deletions
|
|
@ -732,7 +732,7 @@ angularWidget('input', function(inputElement){
|
|||
patternMatch = valueFn(true);
|
||||
} else {
|
||||
if (pattern.match(/^\/(.*)\/$/)) {
|
||||
pattern = new RegExp(pattern.substring(1, pattern.length - 2));
|
||||
pattern = new RegExp(pattern.substr(1, pattern.length - 2));
|
||||
patternMatch = function(value) {
|
||||
return pattern.test(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -536,9 +536,9 @@ describe('widget: input', function() {
|
|||
{min:0, max:1});
|
||||
|
||||
|
||||
itShouldVerify('text with inlined pattern contraint',
|
||||
itShouldVerify('text with inlined pattern constraint',
|
||||
['', '000-00-0000', '123-45-6789'],
|
||||
['x000-00-0000x', 'x'],
|
||||
['x000-00-0000x', 'x000-00-0000', '000-00-0000x', 'x'],
|
||||
{'ng:pattern':'/^\\d\\d\\d-\\d\\d-\\d\\d\\d\\d$/'});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue