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

Commit

Permalink
fix(ng:pattern): correctly parse out inlined regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Oct 20, 2011
1 parent a46f2a0 commit 5d43439
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/widget/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions test/widget/inputSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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$/'});


Expand Down

0 comments on commit 5d43439

Please sign in to comment.