diff --git a/packages/validate/__tests__/integration/validator/email.js b/packages/validate/__tests__/integration/validator/email.js index a785defc..173deed4 100644 --- a/packages/validate/__tests__/integration/validator/email.js +++ b/packages/validate/__tests__/integration/validator/email.js @@ -81,4 +81,33 @@ describe('Validate > Integration > validator > email', () => { expect(await validate(group, group.validators[0])).toEqual(true); }); + it('should return the validityState true for emails names containing accents and diacritic marks', async () => { + expect.assertions(1); + document.body.innerHTML = ``; + const input = document.querySelector('#group1'); + const group = assembleValidationGroup({}, input).group1; + expect(await validate(group, group.validators[0])).toEqual(true); + }); + + it('should return the validityState false for emails containing accents and diacritic marks in the domain name', async () => { + expect.assertions(1); + document.body.innerHTML = ``; + const input = document.querySelector('#group1'); + const group = assembleValidationGroup({}, input).group1; + expect(await validate(group, group.validators[0])).toEqual(false); + }); + + }); \ No newline at end of file diff --git a/packages/validate/src/lib/constants/index.js b/packages/validate/src/lib/constants/index.js index 25cffc8a..6d2a131d 100644 --- a/packages/validate/src/lib/constants/index.js +++ b/packages/validate/src/lib/constants/index.js @@ -13,7 +13,7 @@ export const ACTIONS = { }; //https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address -export const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; +export const EMAIL_REGEX = /^[A-Za-zŽžÀ-ÿŠ0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; //https://mathiasbynens.be/demo/url-regex export const URL_REGEX = /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i;