From f276ea76eaf5857017ee541fe743de70971bde73 Mon Sep 17 00:00:00 2001 From: hotoo Date: Mon, 9 Feb 2015 18:05:23 +0800 Subject: [PATCH] fixed #13, email domain not support ~/workbench/webforms/univ character. --- index.js | 2 +- package.json | 2 +- tests/univ-spec.js | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 156ff12..f12091a 100644 --- a/index.js +++ b/index.js @@ -536,7 +536,7 @@ function verifyIsUrl(value, validity){ } -var RE_EMAIL = /^\w+(?:[\._+\-]\w+)*@\w+(?:\.\w+)+$/; +var RE_EMAIL = /^\w+(?:[\._+\-]\w+)*@[\w_-]+(?:\.[\w_-]+)+$/; function verifyIsEmail(value, validity){ var certified = RE_EMAIL.test(value); validity.typeMismatch = !certified; diff --git a/package.json b/package.json index e741728..26fd0ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "univ", - "version": "0.1.6", + "version": "0.1.7", "description": "Universal Validator.", "keywords": ["Validator", "Form", "Forms", "WebForm", "WebForms"], "homepage": "https://github.com/webforms/univ", diff --git a/tests/univ-spec.js b/tests/univ-spec.js index 92c7d2b..9476a07 100644 --- a/tests/univ-spec.js +++ b/tests/univ-spec.js @@ -4237,6 +4237,11 @@ var testCases = [ "data": { a: "a@b.c" }, "test": testValid }, + { + "rule": { a: { type: "email" } }, + "data": { a: "a@b-inc.c" }, + "test": testValid + }, { "rule": { a: { type: "email" } }, "data": { a: "abc@def.ghi" },