mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
cb59388c5b
no issue - adds `eslint-plugin-sort-imports-es6-autofix` dependency - implements ESLint's base `sort-imports` rule but has a distinction in that `import {foo} from 'bar';` is considered `multiple` rather than `single` - fixes ESLint's autofix behaviour so `eslint --fix` will actually fix the sort order - updates all unordered import rules by using `eslint --fix` With the increased number of `import` statements since Ember+ecosystem started moving towards es6 modules I've found it frustrating at times trying to search through randomly ordered import statements. Recently I've been sorting imports manually when I've added new code or touched old code so I thought I'd add an ESLint rule to codify it.
95 lines
3.3 KiB
JavaScript
95 lines
3.3 KiB
JavaScript
/* jshint expr:true */
|
|
import destroyApp from '../helpers/destroy-app';
|
|
import startApp from '../helpers/start-app';
|
|
import {afterEach, beforeEach, describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
|
|
describe('Acceptance: Password Reset', function() {
|
|
let application;
|
|
|
|
beforeEach(function() {
|
|
application = startApp();
|
|
});
|
|
|
|
afterEach(function() {
|
|
destroyApp(application);
|
|
});
|
|
|
|
describe('request reset', function () {
|
|
it('is successful with valid data', async function () {
|
|
await visit('/signin');
|
|
await fillIn('input[name="identification"]', 'test@example.com');
|
|
await click('.forgotten-link');
|
|
|
|
// an alert with instructions is displayed
|
|
expect(find('.gh-alert-blue').length, 'alert count')
|
|
.to.equal(1);
|
|
});
|
|
|
|
it('shows error messages with invalid data', async function () {
|
|
await visit('/signin');
|
|
|
|
// no email provided
|
|
await click('.forgotten-link');
|
|
|
|
// email field is invalid
|
|
expect(
|
|
find('input[name="identification"]').closest('.form-group').hasClass('error'),
|
|
'email field has error class (no email)'
|
|
).to.be.true;
|
|
|
|
// password field is valid
|
|
expect(
|
|
find('input[name="password"]').closest('.form-group').hasClass('error'),
|
|
'password field has error class (no email)'
|
|
).to.be.false;
|
|
|
|
// error message shown
|
|
expect(find('p.main-error').text().trim(), 'error message')
|
|
.to.equal('We need your email address to reset your password!');
|
|
|
|
// invalid email provided
|
|
await fillIn('input[name="identification"]', 'test');
|
|
await click('.forgotten-link');
|
|
|
|
// email field is invalid
|
|
expect(
|
|
find('input[name="identification"]').closest('.form-group').hasClass('error'),
|
|
'email field has error class (invalid email)'
|
|
).to.be.true;
|
|
|
|
// password field is valid
|
|
expect(
|
|
find('input[name="password"]').closest('.form-group').hasClass('error'),
|
|
'password field has error class (invalid email)'
|
|
).to.be.false;
|
|
|
|
// error message
|
|
expect(find('p.main-error').text().trim(), 'error message')
|
|
.to.equal('We need your email address to reset your password!');
|
|
|
|
// unknown email provided
|
|
await fillIn('input[name="identification"]', 'unknown@example.com');
|
|
await click('.forgotten-link');
|
|
|
|
// email field is invalid
|
|
expect(
|
|
find('input[name="identification"]').closest('.form-group').hasClass('error'),
|
|
'email field has error class (unknown email)'
|
|
).to.be.true;
|
|
|
|
// password field is valid
|
|
expect(
|
|
find('input[name="password"]').closest('.form-group').hasClass('error'),
|
|
'password field has error class (unknown email)'
|
|
).to.be.false;
|
|
|
|
// error message
|
|
expect(find('p.main-error').text().trim(), 'error message')
|
|
.to.equal('There is no user with that email address.');
|
|
});
|
|
});
|
|
|
|
// TODO: add tests for the change password screen
|
|
});
|