Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Fixed signup acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinansfield committed Feb 11, 2019
1 parent 29d8755 commit fd973f6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
2 changes: 2 additions & 0 deletions app/templates/signup.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand Down
38 changes: 27 additions & 11 deletions tests/acceptance/signup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]');

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fd973f6

Please sign in to comment.