diff --git a/ghost/admin/app/templates/signup.hbs b/ghost/admin/app/templates/signup.hbs index 6af0923400..4e2c6aebcf 100644 --- a/ghost/admin/app/templates/signup.hbs +++ b/ghost/admin/app/templates/signup.hbs @@ -44,9 +44,11 @@ autocomplete="username email" value=(readonly signupDetails.email) input=(action (mut signupDetails.email) value="target.value") + focus-out=(action "validate" "email") data-test-input="email" }} + {{gh-error-message errors=signupDetails.errors property="email"}} {{/gh-form-group}} {{#gh-form-group errors=signupDetails.errors hasValidated=signupDetails.hasValidated property="password"}} diff --git a/ghost/admin/tests/acceptance/signup-test.js b/ghost/admin/tests/acceptance/signup-test.js index 01b6a283fc..b7d12b9986 100644 --- a/ghost/admin/tests/acceptance/signup-test.js +++ b/ghost/admin/tests/acceptance/signup-test.js @@ -43,17 +43,6 @@ describe('Acceptance: Signup', function () { expect(currentRouteName()).to.equal('signup'); - // email address should be pre-filled and disabled - expect( - find('[data-test-input="email"]').value, - 'email field value' - ).to.equal('kevin+test2@ghost.org'); - - expect( - find('[data-test-input="email"]').matches(':disabled'), - 'email field is disabled' - ).to.be.true; - // focus out in Name field triggers inline error await blur('[data-test-input="name"]'); @@ -81,6 +70,33 @@ describe('Acceptance: Signup', function () { 'name field error is removed after text input' ).to.be.empty; + // focus out in Email field triggers inline error + await blur('[data-test-input="email"]'); + + expect( + find('[data-test-input="email"]').closest('.form-group'), + 'email field group has error class when empty' + ).to.have.class('error'); + + expect( + find('[data-test-input="email"]').closest('.form-group').querySelector('.response').textContent, + 'email inline-error text' + ).to.have.string('Please enter an email'); + + // entering text in email field clears error + await fillIn('[data-test-input="email"]', 'kevin+test2@ghost.org'); + await blur('[data-test-input="email"]'); + + expect( + find('[data-test-input="email"]').closest('.form-group'), + 'email field loses error class after text input' + ).to.not.have.class('error'); + + expect( + find('[data-test-input="email"]').closest('.form-group').querySelector('.response').textContent.trim(), + 'email field error is removed after text input' + ).to.be.empty; + // check password validation // focus out in password field triggers inline error // no password