mirror of
https://github.com/vxcontrol/ncform.git
synced 2026-07-18 16:24:27 -04:00
style: removed extra logging in unit tests and replace tel regexp
This commit is contained in:
@@ -332,7 +332,6 @@ describe('/src/ncform-utils.js', () => {
|
||||
}
|
||||
};
|
||||
ncformUtils.setValueToSchema(value, formSchema);
|
||||
console.log(formSchema);
|
||||
assert(formSchema.properties.name.value === value.name);
|
||||
});
|
||||
it("setValueToSchema - nested object", () => {
|
||||
@@ -355,7 +354,6 @@ describe('/src/ncform-utils.js', () => {
|
||||
}
|
||||
};
|
||||
ncformUtils.setValueToSchema(value, formSchema);
|
||||
console.log(JSON.stringify(formSchema, null, 2));
|
||||
assert(
|
||||
formSchema.properties.name.properties.firstname.value ===
|
||||
value.name.firstname
|
||||
@@ -381,7 +379,6 @@ describe('/src/ncform-utils.js', () => {
|
||||
}
|
||||
};
|
||||
ncformUtils.setValueToSchema(value, formSchema);
|
||||
console.log(JSON.stringify(formSchema, null, 2));
|
||||
assert(formSchema.properties.name.value === value.name);
|
||||
});
|
||||
it("setValueToSchema - nested array of objects and then objects", () => {
|
||||
@@ -410,7 +407,6 @@ describe('/src/ncform-utils.js', () => {
|
||||
}
|
||||
};
|
||||
ncformUtils.setValueToSchema(value, formSchema);
|
||||
console.log(JSON.stringify(formSchema, null, 2));
|
||||
assert(
|
||||
JSON.stringify(formSchema.properties.user.value) ===
|
||||
JSON.stringify(value.user)
|
||||
@@ -425,7 +421,6 @@ describe('/src/ncform-utils.js', () => {
|
||||
}
|
||||
};
|
||||
ncformUtils.setValueToSchema(value, formSchema);
|
||||
console.log(JSON.stringify(formSchema, null, 2));
|
||||
assert(formSchema.value === value);
|
||||
});
|
||||
it("setValueToSchema - nested array", () => {
|
||||
@@ -440,7 +435,6 @@ describe('/src/ncform-utils.js', () => {
|
||||
}
|
||||
};
|
||||
ncformUtils.setValueToSchema(value, formSchema);
|
||||
console.log(JSON.stringify(formSchema, null, 2));
|
||||
assert(formSchema.value === value);
|
||||
});
|
||||
it("setValueToSchema - non-schema object", () => {
|
||||
|
||||
@@ -71,7 +71,7 @@ class RegularValidation {
|
||||
if (!this.allRules[keys[i]]) {
|
||||
resolve({
|
||||
result: false,
|
||||
errMsg: `不存在验证规则${keys[i]}`
|
||||
errMsg: `No validation rule for ${keys[i]}`
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class TelRule extends ValidationRule {
|
||||
validateLogic(val, ruleVal) {
|
||||
if (!ruleVal) return true;
|
||||
if (typeof val !== "string") return true;
|
||||
return /^1[3|4|5|7|8][0-9]\d{4,8}$/.test(val);
|
||||
return /\+?[1-9]?([\ \.\-]?)\(?([0-9]{3})\)?([\ \.\-]?)([0-9]{3})([\ \.\-]?)([0-9]{4})/i.test(val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user