1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Fixed signup acceptance tests

This commit is contained in:
Kevin Ansfield 2019-02-11 12:35:47 +00:00
parent 29d8755a1d
commit fd973f60ab
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