Merge pull request #5447 from kevinansfield/signin-no-email-notification

Provide a more intuitive error message on sign-in for missing email
This commit is contained in:
Hannah Wolfe 2015-06-18 17:24:33 +01:00
commit 8fe8f8a07b
2 changed files with 16 additions and 2 deletions

View File

@ -4,7 +4,9 @@ var SigninValidator = Ember.Object.create({
var data = model.getProperties('identification', 'password'),
validationErrors = [];
if (!validator.isEmail(data.identification)) {
if (validator.empty(data.identification)) {
validationErrors.push('Please enter an email');
} else if (!validator.isEmail(data.identification)) {
validationErrors.push('Invalid Email');
}

View File

@ -111,7 +111,7 @@ CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
});
}, true);
CasperTest.begin('Ensure email field form validation', 3, function suite(test) {
CasperTest.begin('Ensure email field form validation', 4, function suite(test) {
CasperTest.Routines.signout.run(test);
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
@ -134,4 +134,16 @@ CasperTest.begin('Ensure email field form validation', 3, function suite(test) {
}, function onTimeout() {
test.fail('Email validation error did not appear');
}, 2000);
casper.then(function testMissingEmail() {
this.fillAndSave('form.gh-signin', {
identification: ''
});
});
casper.waitForSelectorTextChange('.notification-error', function onSuccess() {
test.assertSelectorHasText('.notification-error', 'Please enter an email', '.notification-error text is correct');
}, function onTimeout() {
test.fail('Missing Email validation error did not appear');
}, 2000);
}, true);