mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 20:12:45 +08:00
DEV: Move tests for user preferences change email into own file (#19097)
This helps to make it easier to identify the test file for the particular route.
This commit is contained in:
parent
5e516a7d7d
commit
fde8d9b4bb
|
@ -56,12 +56,6 @@ function preferencesPretender(server, helper) {
|
|||
});
|
||||
});
|
||||
|
||||
server.put("/u/eviltrout/preferences/email", () => {
|
||||
return helper.response({
|
||||
success: true,
|
||||
});
|
||||
});
|
||||
|
||||
server.post("/user_avatar/eviltrout/refresh_gravatar.json", () => {
|
||||
return helper.response({
|
||||
gravatar_upload_id: 6543,
|
||||
|
@ -158,34 +152,6 @@ acceptance("User Preferences", function (needs) {
|
|||
assert.ok(exists("#change_username"), "it has the input element");
|
||||
});
|
||||
|
||||
test("email", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
|
||||
await fillIn("#change-email", "invalid-email");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".tip.bad").innerText.trim(),
|
||||
I18n.t("user.email.invalid"),
|
||||
"it should display invalid email tip"
|
||||
);
|
||||
});
|
||||
|
||||
test("email field always shows up", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
|
||||
await fillIn("#change-email", "eviltrout@discourse.org");
|
||||
await click(".user-preferences button.btn-primary");
|
||||
|
||||
await visit("/u/eviltrout/preferences");
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
});
|
||||
|
||||
test("connected accounts", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/account");
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("User Preferences - Email", function (needs) {
|
||||
needs.user();
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
server.put("/u/eviltrout/preferences/email", () => {
|
||||
return helper.response({
|
||||
success: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("email", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
|
||||
await fillIn("#change-email", "invalid-email");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".tip.bad").innerText.trim(),
|
||||
I18n.t("user.email.invalid"),
|
||||
"it should display invalid email tip"
|
||||
);
|
||||
});
|
||||
|
||||
test("email field always shows up", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
|
||||
await fillIn("#change-email", "eviltrout@discourse.org");
|
||||
await click(".user-preferences button.btn-primary");
|
||||
|
||||
await visit("/u/eviltrout/preferences");
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user