Fixes: U4-5717 Member email validation does not allow valid domains (Umbraco 7.1.4)

This commit is contained in:
Shannon
2015-01-07 14:32:39 +11:00
parent 282550f402
commit 322bd4e41e
3 changed files with 81 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
describe('valEmail directive tests', function() {
var valEmailExpression;
beforeEach(module('umbraco'));
beforeEach(inject(function ($injector) {
//TODO: I have no idea why this doesn't work!!?? it freakin should
//valEmailExpression = $injector.get('valEmailExpression');
//in the meantime, i've had to hard code the regex statement here
valEmailExpression = {
EMAIL_REGEXP: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i
};
}));
describe('EMAIL_REGEXP', function () {
/* global EMAIL_REGEXP: false */
it('should validate email', function () {
expect(valEmailExpression.EMAIL_REGEXP.test('a@b.com')).toBe(true);
expect(valEmailExpression.EMAIL_REGEXP.test('a@b.museum')).toBe(true);
expect(valEmailExpression.EMAIL_REGEXP.test('a@B.c')).toBe(true);
expect(valEmailExpression.EMAIL_REGEXP.test('a@.b.c')).toBe(false);
expect(valEmailExpression.EMAIL_REGEXP.test('a@-b.c')).toBe(false);
expect(valEmailExpression.EMAIL_REGEXP.test('a@b-.c')).toBe(false);
expect(valEmailExpression.EMAIL_REGEXP.test('a@3b.c')).toBe(true);
expect(valEmailExpression.EMAIL_REGEXP.test('a@b')).toBe(true);
expect(valEmailExpression.EMAIL_REGEXP.test('abc@xyz.financial')).toBe(true);
});
});
});