discourse/test/javascripts/acceptance/account-created-test.js

Failed to ignore revisions in .git-blame-ignore-revs.

93 lines
2.5 KiB
JavaScript
Raw Normal View History

import { acceptance } from "helpers/qunit-helpers";
2018-06-15 11:03:24 -04:00
import PreloadStore from "preload-store";
acceptance("Account Created");
QUnit.test("account created - message", async assert => {
2018-06-15 11:03:24 -04:00
PreloadStore.store("accountCreated", {
message: "Hello World"
});
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"));
});
QUnit.test("account created - resend email", async assert => {
2018-06-15 11:03:24 -04:00
PreloadStore.store("accountCreated", {
message: "Hello World",
2018-06-15 11:03:24 -04:00
username: "eviltrout",
email: "eviltrout@example.com",
2017-05-25 15:56:11 -04:00
show_controls: true
});
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");
});
QUnit.test("account created - update email - cancel", async assert => {
2018-06-15 11:03:24 -04:00
PreloadStore.store("accountCreated", {
message: "Hello World",
2018-06-15 11:03:24 -04:00
username: "eviltrout",
email: "eviltrout@example.com",
2017-05-25 15:56:11 -04:00
show_controls: true
});
await visit("/u/account-created");
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");
});
QUnit.test("account created - update email - submit", async assert => {
2018-06-15 11:03:24 -04:00
PreloadStore.store("accountCreated", {
message: "Hello World",
2018-06-15 11:03:24 -04:00
username: "eviltrout",
email: "eviltrout@example.com",
2017-05-25 15:56:11 -04:00
show_controls: true
});
await visit("/u/account-created");
await click(".activation-controls .edit-email");
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");
2018-06-15 11:03:24 -04:00
});