mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 09:56:17 +08:00
DEV: Centralise more user preferences tests into individual files (#19100)
Makes it easier to associate the route with the tests
This commit is contained in:
parent
3846b6248f
commit
6d8a93ac41
|
@ -29,12 +29,6 @@ function preferencesPretender(server, helper) {
|
|||
});
|
||||
});
|
||||
|
||||
server.post("/u/eviltrout/preferences/revoke-account", () => {
|
||||
return helper.response({
|
||||
success: true,
|
||||
});
|
||||
});
|
||||
|
||||
server.post("/user_avatar/eviltrout/refresh_gravatar.json", () => {
|
||||
return helper.response({
|
||||
gravatar_upload_id: 6543,
|
||||
|
@ -131,31 +125,6 @@ acceptance("User Preferences", function (needs) {
|
|||
assert.ok(exists("#change_username"), "it has the input element");
|
||||
});
|
||||
|
||||
test("connected accounts", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/account");
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-associated-accounts"),
|
||||
"it has the connected accounts section"
|
||||
);
|
||||
assert.ok(
|
||||
query(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:nth-of-type(1)"
|
||||
).innerHTML.includes("Facebook"),
|
||||
"it lists facebook"
|
||||
);
|
||||
|
||||
await click(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:last-child button"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
query(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:last-of-type"
|
||||
).innerHTML.includes("Connect")
|
||||
);
|
||||
});
|
||||
|
||||
test("default avatar selector", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
|
@ -328,26 +297,6 @@ acceptance(
|
|||
}
|
||||
);
|
||||
|
||||
acceptance("User Preferences when badges are disabled", function (needs) {
|
||||
needs.user();
|
||||
needs.settings({ enable_badges: false });
|
||||
needs.pretender(preferencesPretender);
|
||||
|
||||
test("visit my preferences", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
assert.ok(
|
||||
document.body.classList.contains("user-preferences-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.strictEqual(
|
||||
currentURL(),
|
||||
"/u/eviltrout/preferences/account",
|
||||
"defaults to account tab"
|
||||
);
|
||||
assert.ok(exists(".user-preferences"), "it shows the preferences");
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("Custom User Fields", function (needs) {
|
||||
needs.user();
|
||||
needs.site({
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import I18n from "I18n";
|
||||
import sinon from "sinon";
|
||||
|
||||
acceptance("User Profile - Account - Self Delete", function (needs) {
|
||||
acceptance("User Preferences - Account", function (needs) {
|
||||
needs.user({
|
||||
username: "charlie",
|
||||
});
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
server.delete("/u/charlie.json", () => helper.response({ success: true }));
|
||||
|
||||
server.post("/u/eviltrout/preferences/revoke-account", () => {
|
||||
return helper.response({
|
||||
success: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("Delete dialog", async function (assert) {
|
||||
|
@ -35,4 +45,30 @@ acceptance("User Profile - Account - Self Delete", function (needs) {
|
|||
"redirects to home after deleting"
|
||||
);
|
||||
});
|
||||
|
||||
test("connected accounts", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/account");
|
||||
|
||||
assert.ok(
|
||||
exists(".pref-associated-accounts"),
|
||||
"it has the connected accounts section"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
query(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:nth-of-type(1)"
|
||||
).innerHTML.includes("Facebook"),
|
||||
"it lists facebook"
|
||||
);
|
||||
|
||||
await click(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:last-child button"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
query(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:last-of-type"
|
||||
).innerHTML.includes("Connect")
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user