2017-05-03 01:21:46 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
import PreloadStore from "preload-store";
|
|
|
|
|
|
|
|
acceptance("Account Created");
|
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
QUnit.test("account created - message", async assert => {
|
2017-05-03 01:21:46 +08:00
|
|
|
PreloadStore.store("accountCreated", {
|
2017-05-26 03:56:11 +08:00
|
|
|
message: "Hello World"
|
2017-05-03 01:21:46 +08:00
|
|
|
});
|
2018-07-19 17:35:10 +08:00
|
|
|
await visit("/u/account-created");
|
|
|
|
|
|
|
|
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-05-03 03:57:55 +08:00
|
|
|
});
|
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
QUnit.test("account created - resend email", async assert => {
|
2017-05-03 03:57:55 +08:00
|
|
|
PreloadStore.store("accountCreated", {
|
|
|
|
message: "Hello World",
|
|
|
|
username: "eviltrout",
|
2017-05-26 03:56:11 +08:00
|
|
|
email: "eviltrout@example.com",
|
|
|
|
show_controls: true
|
2017-05-03 03:57:55 +08:00
|
|
|
});
|
2017-05-03 01:21:46 +08:00
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
await visit("/u/account-created");
|
|
|
|
|
|
|
|
assert.ok(exists(".account-created"));
|
|
|
|
assert.equal(
|
|
|
|
find(".account-created .ac-message")
|
|
|
|
.text()
|
|
|
|
.trim(),
|
|
|
|
"Hello World",
|
|
|
|
"it displays the message"
|
|
|
|
);
|
|
|
|
|
|
|
|
await click(".activation-controls .resend");
|
|
|
|
|
|
|
|
assert.equal(currentPath(), "account-created.resent");
|
|
|
|
const email = find(".account-created .ac-message b").text();
|
|
|
|
assert.equal(email, "eviltrout@example.com");
|
2017-05-03 01:21:46 +08:00
|
|
|
});
|
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
QUnit.test("account created - update email - cancel", async assert => {
|
2017-05-03 03:57:55 +08:00
|
|
|
PreloadStore.store("accountCreated", {
|
|
|
|
message: "Hello World",
|
|
|
|
username: "eviltrout",
|
2017-05-26 03:56:11 +08:00
|
|
|
email: "eviltrout@example.com",
|
|
|
|
show_controls: true
|
2017-05-03 03:57:55 +08:00
|
|
|
});
|
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
await visit("/u/account-created");
|
2017-05-03 03:57:55 +08:00
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
await click(".activation-controls .edit-email");
|
|
|
|
|
|
|
|
assert.equal(currentPath(), "account-created.edit-email");
|
|
|
|
assert.ok(find(".activation-controls .btn-primary:disabled").length);
|
|
|
|
|
|
|
|
await click(".activation-controls .edit-cancel");
|
|
|
|
|
|
|
|
assert.equal(currentPath(), "account-created.index");
|
2017-05-03 03:57:55 +08:00
|
|
|
});
|
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
QUnit.test("account created - update email - submit", async assert => {
|
2017-05-03 03:57:55 +08:00
|
|
|
PreloadStore.store("accountCreated", {
|
|
|
|
message: "Hello World",
|
|
|
|
username: "eviltrout",
|
2017-05-26 03:56:11 +08:00
|
|
|
email: "eviltrout@example.com",
|
|
|
|
show_controls: true
|
2017-05-03 03:57:55 +08:00
|
|
|
});
|
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
await visit("/u/account-created");
|
2017-05-03 03:57:55 +08:00
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
await click(".activation-controls .edit-email");
|
2017-05-03 03:57:55 +08:00
|
|
|
|
2018-07-19 17:35:10 +08:00
|
|
|
assert.ok(find(".activation-controls .btn-primary:disabled").length);
|
|
|
|
|
|
|
|
await fillIn(".activate-new-email", "newemail@example.com");
|
|
|
|
|
|
|
|
assert.notOk(find(".activation-controls .btn-primary:disabled").length);
|
|
|
|
|
|
|
|
await click(".activation-controls .btn-primary");
|
|
|
|
|
|
|
|
assert.equal(currentPath(), "account-created.resent");
|
|
|
|
const email = find(".account-created .ac-message b").text();
|
|
|
|
assert.equal(email, "newemail@example.com");
|
2017-06-15 01:57:58 +08:00
|
|
|
});
|