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

Commit 5d43439

Browse files
committedOct 20, 2011
fix(ng:pattern): correctly parse out inlined regexp
1 parent a46f2a0 commit 5d43439

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎src/widget/input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ angularWidget('input', function(inputElement){
732732
patternMatch = valueFn(true);
733733
} else {
734734
if (pattern.match(/^\/(.*)\/$/)) {
735-
pattern = new RegExp(pattern.substring(1, pattern.length - 2));
735+
pattern = new RegExp(pattern.substr(1, pattern.length - 2));
736736
patternMatch = function(value) {
737737
return pattern.test(value);
738738
}

‎test/widget/inputSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,9 @@ describe('widget: input', function() {
536536
{min:0, max:1});
537537

538538

539-
itShouldVerify('text with inlined pattern contraint',
539+
itShouldVerify('text with inlined pattern constraint',
540540
['', '000-00-0000', '123-45-6789'],
541-
['x000-00-0000x', 'x'],
541+
['x000-00-0000x', 'x000-00-0000', '000-00-0000x', 'x'],
542542
{'ng:pattern':'/^\\d\\d\\d-\\d\\d-\\d\\d\\d\\d$/'});
543543

544544

0 commit comments

Comments
 (0)
This repository has been archived.