Fixed signup acceptance tests

This commit is contained in:
Kevin Ansfield 2019-02-11 12:35:47 +00:00
parent 4f0bdee479
commit 6fdf4be0ce
2 changed files with 29 additions and 11 deletions

View File

@ -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"
}}
</span>
{{gh-error-message errors=signupDetails.errors property="email"}}
{{/gh-form-group}}
{{#gh-form-group errors=signupDetails.errors hasValidated=signupDetails.hasValidated property="password"}}

View File

@ -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