2017-05-02 13:21:46 -04:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
import PreloadStore from 'preload-store';
|
|
|
|
|
|
|
|
acceptance("Account Created");
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("account created - message", assert => {
|
2017-05-02 13:21:46 -04:00
|
|
|
PreloadStore.store('accountCreated', {
|
2017-05-25 15:56:11 -04:00
|
|
|
message: "Hello World",
|
2017-05-02 13:21:46 -04:00
|
|
|
});
|
2017-05-02 15:57:55 -04:00
|
|
|
visit("/u/account-created");
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists('.account-created'));
|
|
|
|
assert.equal(
|
|
|
|
find('.account-created .ac-message').text().trim(),
|
|
|
|
"Hello World",
|
|
|
|
"it displays the message"
|
|
|
|
);
|
|
|
|
assert.notOk(exists('.activation-controls'));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("account created - resend email", assert => {
|
2017-05-02 15:57:55 -04:00
|
|
|
PreloadStore.store('accountCreated', {
|
|
|
|
message: "Hello World",
|
|
|
|
username: 'eviltrout',
|
2017-05-25 15:56:11 -04:00
|
|
|
email: 'eviltrout@example.com',
|
|
|
|
show_controls: true
|
2017-05-02 15:57:55 -04:00
|
|
|
});
|
|
|
|
visit("/u/account-created");
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists('.account-created'));
|
|
|
|
assert.equal(
|
|
|
|
find('.account-created .ac-message').text().trim(),
|
|
|
|
"Hello World",
|
|
|
|
"it displays the message"
|
|
|
|
);
|
|
|
|
});
|
2017-05-02 13:21:46 -04:00
|
|
|
|
2017-05-02 15:57:55 -04:00
|
|
|
click('.activation-controls .resend');
|
2017-05-02 13:21:46 -04:00
|
|
|
andThen(() => {
|
2017-05-02 15:57:55 -04:00
|
|
|
assert.equal(currentPath(), "account-created.resent");
|
|
|
|
const email = find('.account-created .ac-message b').text();
|
|
|
|
assert.equal(email, 'eviltrout@example.com');
|
2017-05-02 13:21:46 -04:00
|
|
|
});
|
2017-05-02 15:57:55 -04:00
|
|
|
|
2017-05-02 13:21:46 -04:00
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("account created - update email - cancel", assert => {
|
2017-05-02 15:57:55 -04:00
|
|
|
PreloadStore.store('accountCreated', {
|
|
|
|
message: "Hello World",
|
|
|
|
username: 'eviltrout',
|
2017-05-25 15:56:11 -04:00
|
|
|
email: 'eviltrout@example.com',
|
|
|
|
show_controls: true
|
2017-05-02 15:57:55 -04:00
|
|
|
});
|
|
|
|
visit("/u/account-created");
|
|
|
|
|
|
|
|
click('.activation-controls .edit-email');
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(currentPath(), "account-created.edit-email");
|
|
|
|
assert.ok(find('.activation-controls .btn-primary:disabled').length);
|
|
|
|
});
|
|
|
|
|
|
|
|
click('.activation-controls .edit-cancel');
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(currentPath(), "account-created.index");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("account created - update email - submit", assert => {
|
2017-05-02 15:57:55 -04:00
|
|
|
PreloadStore.store('accountCreated', {
|
|
|
|
message: "Hello World",
|
|
|
|
username: 'eviltrout',
|
2017-05-25 15:56:11 -04:00
|
|
|
email: 'eviltrout@example.com',
|
|
|
|
show_controls: true
|
2017-05-02 15:57:55 -04:00
|
|
|
});
|
|
|
|
visit("/u/account-created");
|
|
|
|
|
|
|
|
click('.activation-controls .edit-email');
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(find('.activation-controls .btn-primary:disabled').length);
|
|
|
|
});
|
|
|
|
|
|
|
|
fillIn('.activate-new-email', 'newemail@example.com');
|
|
|
|
andThen(() => {
|
|
|
|
assert.notOk(find('.activation-controls .btn-primary:disabled').length);
|
|
|
|
});
|
|
|
|
|
|
|
|
click('.activation-controls .btn-primary');
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(currentPath(), "account-created.resent");
|
|
|
|
const email = find('.account-created .ac-message b').text();
|
|
|
|
assert.equal(email, 'newemail@example.com');
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
});
|