Skip to content

Commit

Permalink
Fixed type=tel both support tel and mobile number.
Browse files Browse the repository at this point in the history
  • Loading branch information
hotoo committed Jun 26, 2014
1 parent a16d3f7 commit d4f38dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,10 @@ function verify(ruleName, rule, values, datas, instance_context){
break;

case RULE_TYPES.tel:
certified = certified && eachValues(verifyIsTel, values);
certified = certified && (
eachValues(verifyIsTel, values) ||
eachValues(verifyIsMobile, values)
);
break;

case RULE_TYPES.color:
Expand Down
21 changes: 21 additions & 0 deletions tests/univ-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4418,6 +4418,11 @@ var testCases = [
"data": { a: "(+86)0571-26888888" },
"test": testValid
},
{
"rule": { a: { type: "tel" } },
"data": { a: "13900000000" },
"test": testValid
},
{
"rule": { a: { type: "tel" } },
"data": { a: "0571-268888889" },
Expand Down Expand Up @@ -4488,6 +4493,22 @@ var testCases = [
"data": { a: ["0571-268888889", "0571-2688888a"] },
"test": testInvalid
},
{
"rule": { a: {
accept: null,
max: null,
maxlength: null,
min: null,
minlength: null,
multiple: false,
pattern: null,
required: false,
step: null,
type: "tel",
} },
"data": { a: ["13900000000"] },
"test": testValid
},


// rule:type=color
Expand Down

0 comments on commit d4f38dd

Please sign in to comment.