mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow users to resend/update email from confirmation page
This commit is contained in:
@@ -3,15 +3,92 @@ import PreloadStore from 'preload-store';
|
||||
|
||||
acceptance("Account Created");
|
||||
|
||||
test("account created", () => {
|
||||
visit("/u/account-created");
|
||||
test("account created - message", assert => {
|
||||
PreloadStore.store('accountCreated', {
|
||||
message: "Hello World"
|
||||
});
|
||||
visit("/u/account-created");
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('.account-created'));
|
||||
equal(find('.account-created').text(), "Hello World", "it displays the message");
|
||||
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'));
|
||||
});
|
||||
});
|
||||
|
||||
test("account created - resend email", assert => {
|
||||
PreloadStore.store('accountCreated', {
|
||||
message: "Hello World",
|
||||
username: 'eviltrout',
|
||||
email: 'eviltrout@example.com'
|
||||
});
|
||||
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"
|
||||
);
|
||||
});
|
||||
|
||||
click('.activation-controls .resend');
|
||||
andThen(() => {
|
||||
assert.equal(currentPath(), "account-created.resent");
|
||||
const email = find('.account-created .ac-message b').text();
|
||||
assert.equal(email, 'eviltrout@example.com');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
test("account created - update email - cancel", assert => {
|
||||
PreloadStore.store('accountCreated', {
|
||||
message: "Hello World",
|
||||
username: 'eviltrout',
|
||||
email: 'eviltrout@example.com'
|
||||
});
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
||||
test("account created - update email - submit", assert => {
|
||||
PreloadStore.store('accountCreated', {
|
||||
message: "Hello World",
|
||||
username: 'eviltrout',
|
||||
email: 'eviltrout@example.com'
|
||||
});
|
||||
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');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user