DEV: apply new coding standards (#10592)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("About");
|
||||
|
||||
QUnit.test("viewing", async assert => {
|
||||
QUnit.test("viewing", async (assert) => {
|
||||
await visit("/about");
|
||||
|
||||
assert.ok($("body.about-page").length, "has body class");
|
||||
|
||||
@@ -3,38 +3,34 @@ import PreloadStore from "discourse/lib/preload-store";
|
||||
|
||||
acceptance("Account Created");
|
||||
|
||||
QUnit.test("account created - message", async assert => {
|
||||
QUnit.test("account created - message", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World"
|
||||
message: "Hello World",
|
||||
});
|
||||
await visit("/u/account-created");
|
||||
|
||||
assert.ok(exists(".account-created"));
|
||||
assert.equal(
|
||||
find(".account-created .ac-message")
|
||||
.text()
|
||||
.trim(),
|
||||
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 => {
|
||||
QUnit.test("account created - resend email", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World",
|
||||
username: "eviltrout",
|
||||
email: "eviltrout@example.com",
|
||||
show_controls: true
|
||||
show_controls: true,
|
||||
});
|
||||
|
||||
await visit("/u/account-created");
|
||||
|
||||
assert.ok(exists(".account-created"));
|
||||
assert.equal(
|
||||
find(".account-created .ac-message")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".account-created .ac-message").text().trim(),
|
||||
"Hello World",
|
||||
"it displays the message"
|
||||
);
|
||||
@@ -46,12 +42,12 @@ QUnit.test("account created - resend email", async assert => {
|
||||
assert.equal(email, "eviltrout@example.com");
|
||||
});
|
||||
|
||||
QUnit.test("account created - update email - cancel", async assert => {
|
||||
QUnit.test("account created - update email - cancel", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World",
|
||||
username: "eviltrout",
|
||||
email: "eviltrout@example.com",
|
||||
show_controls: true
|
||||
show_controls: true,
|
||||
});
|
||||
|
||||
await visit("/u/account-created");
|
||||
@@ -66,12 +62,12 @@ QUnit.test("account created - update email - cancel", async assert => {
|
||||
assert.equal(currentPath(), "account-created.index");
|
||||
});
|
||||
|
||||
QUnit.test("account created - update email - submit", async assert => {
|
||||
QUnit.test("account created - update email - submit", async (assert) => {
|
||||
PreloadStore.store("accountCreated", {
|
||||
message: "Hello World",
|
||||
username: "eviltrout",
|
||||
email: "eviltrout@example.com",
|
||||
show_controls: true
|
||||
show_controls: true,
|
||||
});
|
||||
|
||||
await visit("/u/account-created");
|
||||
|
||||
@@ -16,7 +16,7 @@ Hello, this is a test!
|
||||
|
||||
This part should be elided.`.trim();
|
||||
|
||||
QUnit.test("shows selected and elided text", async assert => {
|
||||
QUnit.test("shows selected and elided text", async (assert) => {
|
||||
pretender.post("/admin/email/advanced-test", () => {
|
||||
return [
|
||||
200,
|
||||
@@ -24,8 +24,8 @@ QUnit.test("shows selected and elided text", async assert => {
|
||||
{
|
||||
format: 1,
|
||||
text: "Hello, this is a test!",
|
||||
elided: "---\n\nThis part should be elided."
|
||||
}
|
||||
elided: "---\n\nThis part should be elided.",
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Admin - Search Log Term", { loggedIn: true });
|
||||
|
||||
QUnit.skip("show search log term details", async assert => {
|
||||
QUnit.skip("show search log term details", async (assert) => {
|
||||
await visit("/admin/logs/search_logs/term?term=ruby");
|
||||
|
||||
assert.ok($("div.search-logs-filter").length, "has the search type filter");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Admin - Search Logs", { loggedIn: true });
|
||||
|
||||
QUnit.skip("show search logs", async assert => {
|
||||
QUnit.skip("show search logs", async (assert) => {
|
||||
await visit("/admin/logs/search_logs");
|
||||
|
||||
assert.ok($("table.search-logs-list.grid").length, "has the div class");
|
||||
|
||||
@@ -10,7 +10,7 @@ acceptance("Admin - Site Settings", {
|
||||
},
|
||||
|
||||
pretend(server, helper) {
|
||||
server.put("/admin/site_settings/title", body => {
|
||||
server.put("/admin/site_settings/title", (body) => {
|
||||
titleOverride = body.requestBody.split("=")[1];
|
||||
return helper.response({ success: "OK" });
|
||||
});
|
||||
@@ -22,14 +22,14 @@ acceptance("Admin - Site Settings", {
|
||||
titleSetting.value = titleOverride;
|
||||
}
|
||||
const response = {
|
||||
site_settings: [titleSetting, ...fixtures.slice(1)]
|
||||
site_settings: [titleSetting, ...fixtures.slice(1)],
|
||||
};
|
||||
return helper.response(response);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("upload site setting", async assert => {
|
||||
QUnit.test("upload site setting", async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
|
||||
assert.ok(
|
||||
@@ -40,7 +40,7 @@ QUnit.test("upload site setting", async assert => {
|
||||
assert.ok(exists(".row.setting.upload .undo"), "undo button is present");
|
||||
});
|
||||
|
||||
QUnit.test("changing value updates dirty state", async assert => {
|
||||
QUnit.test("changing value updates dirty state", async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
await fillIn("#setting-filter", " title ");
|
||||
assert.equal(count(".row.setting"), 1, "filter returns 1 site setting");
|
||||
@@ -89,7 +89,7 @@ QUnit.test("changing value updates dirty state", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"always shows filtered site settings if a filter is set",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
await fillIn("#setting-filter", "title");
|
||||
assert.equal(count(".row.setting"), 1);
|
||||
@@ -104,7 +104,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("filter settings by plugin name", async assert => {
|
||||
QUnit.test("filter settings by plugin name", async (assert) => {
|
||||
await visit("/admin/site_settings");
|
||||
|
||||
await fillIn("#setting-filter", "plugin:discourse-logo");
|
||||
@@ -115,12 +115,12 @@ QUnit.test("filter settings by plugin name", async assert => {
|
||||
assert.equal(count(".row.setting"), 0);
|
||||
});
|
||||
|
||||
QUnit.test("category name is preserved", async assert => {
|
||||
QUnit.test("category name is preserved", async (assert) => {
|
||||
await visit("admin/site_settings/category/basic?filter=menu");
|
||||
assert.equal(currentURL(), "admin/site_settings/category/basic?filter=menu");
|
||||
});
|
||||
|
||||
QUnit.test("shows all_results if current category has none", async assert => {
|
||||
QUnit.test("shows all_results if current category has none", async (assert) => {
|
||||
await visit("admin/site_settings");
|
||||
|
||||
await click(".admin-nav .basic a");
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Admin - Site Texts", { loggedIn: true });
|
||||
|
||||
QUnit.test("search for a key", async assert => {
|
||||
QUnit.test("search for a key", async (assert) => {
|
||||
await visit("/admin/customize/site_texts");
|
||||
|
||||
await fillIn(".site-text-search", "Test");
|
||||
@@ -23,7 +23,7 @@ QUnit.test("search for a key", async assert => {
|
||||
assert.ok(exists(".site-text.overridden"));
|
||||
});
|
||||
|
||||
QUnit.test("edit and revert a site text by key", async assert => {
|
||||
QUnit.test("edit and revert a site text by key", async (assert) => {
|
||||
await visit("/admin/customize/site_texts/site.test");
|
||||
|
||||
assert.equal(find(".title h3").text(), "site.test");
|
||||
|
||||
@@ -8,22 +8,22 @@ acceptance("Admin - Suspend User", {
|
||||
server.put("/admin/users/:user_id/suspend", () =>
|
||||
helper.response(200, {
|
||||
suspension: {
|
||||
suspended_till: "2099-01-01T12:00:00.000Z"
|
||||
}
|
||||
suspended_till: "2099-01-01T12:00:00.000Z",
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
server.put("/admin/users/:user_id/unsuspend", () =>
|
||||
helper.response(200, {
|
||||
suspension: {
|
||||
suspended_till: null
|
||||
}
|
||||
suspended_till: null,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("suspend a user - cancel", async assert => {
|
||||
QUnit.test("suspend a user - cancel", async (assert) => {
|
||||
await visit("/admin/users/1234/regular");
|
||||
await click(".suspend-user");
|
||||
|
||||
@@ -34,7 +34,7 @@ QUnit.test("suspend a user - cancel", async assert => {
|
||||
assert.equal(find(".suspend-user-modal:visible").length, 0);
|
||||
});
|
||||
|
||||
QUnit.test("suspend a user - cancel with input", async assert => {
|
||||
QUnit.test("suspend a user - cancel with input", async (assert) => {
|
||||
await visit("/admin/users/1234/regular");
|
||||
await click(".suspend-user");
|
||||
|
||||
@@ -61,7 +61,7 @@ QUnit.test("suspend a user - cancel with input", async assert => {
|
||||
assert.equal(find(".bootbox.modal:visible").length, 0);
|
||||
});
|
||||
|
||||
QUnit.test("suspend, then unsuspend a user", async assert => {
|
||||
QUnit.test("suspend, then unsuspend a user", async (assert) => {
|
||||
const suspendUntilCombobox = selectKit(".suspend-until .combobox");
|
||||
|
||||
await visit("/admin/flags/active");
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Admin - Users Badges", { loggedIn: true });
|
||||
|
||||
QUnit.test("lists badges", async assert => {
|
||||
QUnit.test("lists badges", async (assert) => {
|
||||
await visit("/admin/users/1/eviltrout/badges");
|
||||
|
||||
assert.ok(exists(`span[data-badge-name="Badge 8"]`));
|
||||
|
||||
@@ -3,7 +3,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Admin - User Emails", { loggedIn: true });
|
||||
|
||||
const assertNoSecondary = assert => {
|
||||
const assertNoSecondary = (assert) => {
|
||||
assert.equal(
|
||||
find(".display-row.email .value a").text(),
|
||||
"eviltrout@example.com",
|
||||
@@ -11,9 +11,7 @@ const assertNoSecondary = assert => {
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".display-row.secondary-emails .value")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".display-row.secondary-emails .value").text().trim(),
|
||||
I18n.t("user.email.no_secondary"),
|
||||
"it should not display secondary emails"
|
||||
);
|
||||
@@ -33,13 +31,13 @@ const assertMultipleSecondary = (assert, firstEmail, secondEmail) => {
|
||||
);
|
||||
};
|
||||
|
||||
QUnit.test("viewing self without secondary emails", async assert => {
|
||||
QUnit.test("viewing self without secondary emails", async (assert) => {
|
||||
await visit("/admin/users/1/eviltrout");
|
||||
|
||||
assertNoSecondary(assert);
|
||||
});
|
||||
|
||||
QUnit.test("viewing self with multiple secondary emails", async assert => {
|
||||
QUnit.test("viewing self with multiple secondary emails", async (assert) => {
|
||||
await visit("/admin/users/3/markvanlan");
|
||||
|
||||
assert.equal(
|
||||
@@ -55,14 +53,14 @@ QUnit.test("viewing self with multiple secondary emails", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("viewing another user with no secondary email", async assert => {
|
||||
QUnit.test("viewing another user with no secondary email", async (assert) => {
|
||||
await visit("/admin/users/1234/regular");
|
||||
await click(`.display-row.secondary-emails button`);
|
||||
|
||||
assertNoSecondary(assert);
|
||||
});
|
||||
|
||||
QUnit.test("viewing another account with secondary emails", async assert => {
|
||||
QUnit.test("viewing another account with secondary emails", async (assert) => {
|
||||
await visit("/admin/users/1235/regular1");
|
||||
await click(`.display-row.secondary-emails button`);
|
||||
|
||||
|
||||
@@ -27,61 +27,44 @@ acceptance("Admin - User Index", {
|
||||
public_admission: false,
|
||||
allow_membership_requests: true,
|
||||
membership_request_template: "Please add me",
|
||||
full_name: null
|
||||
}
|
||||
full_name: null,
|
||||
},
|
||||
]);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("can edit username", async assert => {
|
||||
QUnit.test("can edit username", async (assert) => {
|
||||
pretender.put("/users/sam/preferences/username", () => [
|
||||
200,
|
||||
{
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
{ id: 2, username: "new-sam" }
|
||||
{ id: 2, username: "new-sam" },
|
||||
]);
|
||||
|
||||
await visit("/admin/users/2/sam");
|
||||
|
||||
assert.equal(
|
||||
find(".display-row.username .value")
|
||||
.text()
|
||||
.trim(),
|
||||
"sam"
|
||||
);
|
||||
assert.equal(find(".display-row.username .value").text().trim(), "sam");
|
||||
|
||||
// Trying cancel.
|
||||
await click(".display-row.username button");
|
||||
await fillIn(".display-row.username .value input", "new-sam");
|
||||
await click(".display-row.username a");
|
||||
assert.equal(
|
||||
find(".display-row.username .value")
|
||||
.text()
|
||||
.trim(),
|
||||
"sam"
|
||||
);
|
||||
assert.equal(find(".display-row.username .value").text().trim(), "sam");
|
||||
|
||||
// Doing edit.
|
||||
await click(".display-row.username button");
|
||||
await fillIn(".display-row.username .value input", "new-sam");
|
||||
await click(".display-row.username button");
|
||||
assert.equal(
|
||||
find(".display-row.username .value")
|
||||
.text()
|
||||
.trim(),
|
||||
"new-sam"
|
||||
);
|
||||
assert.equal(find(".display-row.username .value").text().trim(), "new-sam");
|
||||
});
|
||||
|
||||
QUnit.test("will clear unsaved groups when switching user", async assert => {
|
||||
QUnit.test("will clear unsaved groups when switching user", async (assert) => {
|
||||
await visit("/admin/users/2/sam");
|
||||
|
||||
assert.equal(
|
||||
find(".display-row.username .value")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".display-row.username .value").text().trim(),
|
||||
"sam",
|
||||
"the name should be correct"
|
||||
);
|
||||
@@ -94,9 +77,7 @@ QUnit.test("will clear unsaved groups when switching user", async assert => {
|
||||
await visit("/admin/users/1/eviltrout");
|
||||
|
||||
assert.equal(
|
||||
find(".display-row.username .value")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".display-row.username .value").text().trim(),
|
||||
"eviltrout",
|
||||
"the name should be correct"
|
||||
);
|
||||
|
||||
@@ -3,14 +3,14 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Admin - Users List", { loggedIn: true });
|
||||
|
||||
QUnit.test("lists users", async assert => {
|
||||
QUnit.test("lists users", async (assert) => {
|
||||
await visit("/admin/users/list/active");
|
||||
|
||||
assert.ok(exists(".users-list .user"));
|
||||
assert.ok(!exists(".user:eq(0) .email small"), "escapes email");
|
||||
});
|
||||
|
||||
QUnit.test("sorts users", async assert => {
|
||||
QUnit.test("sorts users", async (assert) => {
|
||||
await visit("/admin/users/list/active");
|
||||
|
||||
assert.ok(exists(".users-list .user"));
|
||||
@@ -34,7 +34,7 @@ QUnit.test("sorts users", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("toggles email visibility", async assert => {
|
||||
QUnit.test("toggles email visibility", async (assert) => {
|
||||
await visit("/admin/users/list/active");
|
||||
|
||||
assert.ok(exists(".users-list .user"));
|
||||
@@ -56,7 +56,7 @@ QUnit.test("toggles email visibility", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("switching tabs", async assert => {
|
||||
QUnit.test("switching tabs", async (assert) => {
|
||||
const activeUser = "eviltrout";
|
||||
const suspectUser = "sam";
|
||||
const activeTitle = I18n.t("admin.users.titles.active");
|
||||
@@ -66,9 +66,7 @@ QUnit.test("switching tabs", async assert => {
|
||||
|
||||
assert.equal(find(".admin-title h2").text(), activeTitle);
|
||||
assert.ok(
|
||||
find(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes(activeUser)
|
||||
find(".users-list .user:nth-child(1) .username").text().includes(activeUser)
|
||||
);
|
||||
|
||||
await click('a[href="/admin/users/list/new"]');
|
||||
@@ -93,8 +91,6 @@ QUnit.test("switching tabs", async assert => {
|
||||
|
||||
assert.equal(find(".admin-title h2").text(), activeTitle);
|
||||
assert.ok(
|
||||
find(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes(activeUser)
|
||||
find(".users-list .user:nth-child(1) .username").text().includes(activeUser)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Admin - Watched Words", { loggedIn: true });
|
||||
|
||||
QUnit.test("list words in groups", async assert => {
|
||||
QUnit.test("list words in groups", async (assert) => {
|
||||
await visit("/admin/logs/watched_words/action/block");
|
||||
|
||||
assert.ok(exists(".watched-words-list"));
|
||||
@@ -38,7 +38,7 @@ QUnit.test("list words in groups", async assert => {
|
||||
assert.ok(!exists(".watched-words-list .watched-word"), "Empty word list.");
|
||||
});
|
||||
|
||||
QUnit.test("add words", async assert => {
|
||||
QUnit.test("add words", async (assert) => {
|
||||
await visit("/admin/logs/watched_words/action/block");
|
||||
|
||||
click(".show-words-checkbox");
|
||||
@@ -48,29 +48,21 @@ QUnit.test("add words", async assert => {
|
||||
|
||||
let found = [];
|
||||
$.each(find(".watched-words-list .watched-word"), (index, elem) => {
|
||||
if (
|
||||
$(elem)
|
||||
.text()
|
||||
.trim() === "poutine"
|
||||
) {
|
||||
if ($(elem).text().trim() === "poutine") {
|
||||
found.push(true);
|
||||
}
|
||||
});
|
||||
assert.equal(found.length, 1);
|
||||
});
|
||||
|
||||
QUnit.test("remove words", async assert => {
|
||||
QUnit.test("remove words", async (assert) => {
|
||||
await visit("/admin/logs/watched_words/action/block");
|
||||
await click(".show-words-checkbox");
|
||||
|
||||
let word = null;
|
||||
|
||||
$.each(find(".watched-words-list .watched-word"), (index, elem) => {
|
||||
if (
|
||||
$(elem)
|
||||
.text()
|
||||
.trim() === "anise"
|
||||
) {
|
||||
if ($(elem).text().trim() === "anise") {
|
||||
word = elem;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ acceptance("Auth Complete", {
|
||||
const node = document.createElement("meta");
|
||||
node.dataset.authenticationData = JSON.stringify({
|
||||
auth_provider: "test",
|
||||
email: "blah@example.com"
|
||||
email: "blah@example.com",
|
||||
});
|
||||
node.id = "data-authentication";
|
||||
document.querySelector("head").appendChild(node);
|
||||
@@ -13,10 +13,10 @@ acceptance("Auth Complete", {
|
||||
document
|
||||
.querySelector("head")
|
||||
.removeChild(document.getElementById("data-authentication"));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("when login not required", async assert => {
|
||||
QUnit.test("when login not required", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
assert.equal(currentPath(), "discovery.latest", "it stays on the homepage");
|
||||
@@ -27,7 +27,7 @@ QUnit.test("when login not required", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("when login required", async function(assert) {
|
||||
QUnit.test("when login required", async function (assert) {
|
||||
this.siteSettings.login_required = true;
|
||||
await visit("/");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Badges", { loggedIn: true });
|
||||
|
||||
QUnit.test("Visit Badge Pages", async assert => {
|
||||
QUnit.test("Visit Badge Pages", async (assert) => {
|
||||
await visit("/badges");
|
||||
|
||||
assert.ok($("body.badges-page").length, "has body class");
|
||||
@@ -16,7 +16,7 @@ QUnit.test("Visit Badge Pages", async assert => {
|
||||
assert.ok(!exists(".badge-card:eq(0) script"));
|
||||
});
|
||||
|
||||
QUnit.test("shows correct badge titles to choose from", async assert => {
|
||||
QUnit.test("shows correct badge titles to choose from", async (assert) => {
|
||||
const availableBadgeTitles = selectKit(".select-kit");
|
||||
await visit("/badges/50/custombadge");
|
||||
await availableBadgeTitles.expand();
|
||||
|
||||
@@ -3,7 +3,7 @@ import selectKit from "helpers/select-kit-helper";
|
||||
import {
|
||||
acceptance,
|
||||
loggedInUser,
|
||||
acceptanceUseFakeClock
|
||||
acceptanceUseFakeClock,
|
||||
} from "helpers/qunit-helpers";
|
||||
import pretender from "helpers/create-pretender";
|
||||
import { parsePostData } from "helpers/create-pretender";
|
||||
@@ -12,7 +12,7 @@ acceptance("Bookmarking", {
|
||||
loggedIn: true,
|
||||
afterEach() {
|
||||
sandbox.restore();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
function handleRequest(assert, request) {
|
||||
@@ -22,18 +22,18 @@ function handleRequest(assert, request) {
|
||||
return [
|
||||
200,
|
||||
{
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
{
|
||||
id: 999,
|
||||
success: "OK"
|
||||
}
|
||||
success: "OK",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function mockSuccessfulBookmarkPost(assert) {
|
||||
pretender.post("/bookmarks", request => handleRequest(assert, request));
|
||||
pretender.put("/bookmarks/999", request => handleRequest(assert, request));
|
||||
pretender.post("/bookmarks", (request) => handleRequest(assert, request));
|
||||
pretender.put("/bookmarks/999", (request) => handleRequest(assert, request));
|
||||
}
|
||||
|
||||
async function openBookmarkModal() {
|
||||
@@ -48,13 +48,13 @@ async function openEditBookmarkModal() {
|
||||
await click(".topic-post:first-child button.bookmarked");
|
||||
}
|
||||
|
||||
test("Bookmarks modal opening", async assert => {
|
||||
test("Bookmarks modal opening", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await openBookmarkModal();
|
||||
assert.ok(exists("#bookmark-reminder-modal"), "it shows the bookmark modal");
|
||||
});
|
||||
|
||||
test("Bookmarks modal selecting reminder type", async assert => {
|
||||
test("Bookmarks modal selecting reminder type", async (assert) => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -83,11 +83,11 @@ test("Bookmarks modal selecting reminder type", async assert => {
|
||||
"start_of_next_business_week",
|
||||
"next_week",
|
||||
"next_month",
|
||||
"custom"
|
||||
"custom",
|
||||
]);
|
||||
});
|
||||
|
||||
test("Saving a bookmark with a reminder", async assert => {
|
||||
test("Saving a bookmark with a reminder", async (assert) => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await openBookmarkModal();
|
||||
@@ -107,7 +107,7 @@ test("Saving a bookmark with a reminder", async assert => {
|
||||
assert.verifySteps(["tomorrow"]);
|
||||
});
|
||||
|
||||
test("Opening the options panel and remembering the option", async assert => {
|
||||
test("Opening the options panel and remembering the option", async (assert) => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await openBookmarkModal();
|
||||
@@ -125,16 +125,11 @@ test("Opening the options panel and remembering the option", async assert => {
|
||||
exists(".bookmark-options-panel"),
|
||||
"it should reopen the options panel"
|
||||
);
|
||||
assert.equal(
|
||||
selectKit(".bookmark-option-selector")
|
||||
.header()
|
||||
.value(),
|
||||
1
|
||||
);
|
||||
assert.equal(selectKit(".bookmark-option-selector").header().value(), 1);
|
||||
assert.verifySteps(["none"]);
|
||||
});
|
||||
|
||||
test("Saving a bookmark with no reminder or name", async assert => {
|
||||
test("Saving a bookmark with no reminder or name", async (assert) => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await openBookmarkModal();
|
||||
@@ -153,16 +148,16 @@ test("Saving a bookmark with no reminder or name", async assert => {
|
||||
assert.verifySteps(["none"]);
|
||||
});
|
||||
|
||||
test("Deleting a bookmark with a reminder", async assert => {
|
||||
test("Deleting a bookmark with a reminder", async (assert) => {
|
||||
pretender.delete("/bookmarks/999", () => [
|
||||
200,
|
||||
{
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
{
|
||||
success: "OK",
|
||||
topic_bookmarked: false
|
||||
}
|
||||
topic_bookmarked: false,
|
||||
},
|
||||
]);
|
||||
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
@@ -181,9 +176,7 @@ test("Deleting a bookmark with a reminder", async assert => {
|
||||
|
||||
assert.ok(exists(".bootbox.modal"), "it asks for delete confirmation");
|
||||
assert.ok(
|
||||
find(".bootbox.modal")
|
||||
.text()
|
||||
.includes(I18n.t("bookmarks.confirm_delete")),
|
||||
find(".bootbox.modal").text().includes(I18n.t("bookmarks.confirm_delete")),
|
||||
"it shows delete confirmation message"
|
||||
);
|
||||
|
||||
@@ -195,7 +188,7 @@ test("Deleting a bookmark with a reminder", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
test("Cancelling saving a bookmark", async assert => {
|
||||
test("Cancelling saving a bookmark", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await openBookmarkModal();
|
||||
await click(".d-modal-cancel");
|
||||
@@ -205,7 +198,7 @@ test("Cancelling saving a bookmark", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
test("Editing a bookmark", async assert => {
|
||||
test("Editing a bookmark", async (assert) => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -239,12 +232,12 @@ acceptance("Bookmarking - Mobile", {
|
||||
mobileView: true,
|
||||
afterEach() {
|
||||
sandbox.restore();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.skip(
|
||||
"Editing a bookmark that has a Later Today reminder, and it is before 6pm today",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await acceptanceUseFakeClock("2020-05-04T13:00:00", async () => {
|
||||
mockSuccessfulBookmarkPost(assert);
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
@@ -21,7 +21,7 @@ acceptance("Category Banners", {
|
||||
id: 5,
|
||||
name: "test read only without banner",
|
||||
slug: "test-read-only-without-banner",
|
||||
permission: null
|
||||
permission: null,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
@@ -29,13 +29,13 @@ acceptance("Category Banners", {
|
||||
slug: "test-read-only-with-banner",
|
||||
permission: null,
|
||||
read_only_banner:
|
||||
"You need to video yourself doing the secret handshake to post here"
|
||||
}
|
||||
]
|
||||
}
|
||||
"You need to video yourself doing the secret handshake to post here",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Does not display category banners when not set", async assert => {
|
||||
QUnit.test("Does not display category banners when not set", async (assert) => {
|
||||
await visit("/c/test-read-only-without-banner");
|
||||
|
||||
await click("#create-topic");
|
||||
@@ -46,7 +46,7 @@ QUnit.test("Does not display category banners when not set", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Displays category banners when set", async assert => {
|
||||
QUnit.test("Displays category banners when set", async (assert) => {
|
||||
await visit("/c/test-read-only-with-banner");
|
||||
|
||||
await click("#create-topic");
|
||||
@@ -74,13 +74,13 @@ acceptance("Anonymous Category Banners", {
|
||||
slug: "test-read-only-with-banner",
|
||||
permission: null,
|
||||
read_only_banner:
|
||||
"You need to video yourself doing the secret handshake to post here"
|
||||
}
|
||||
]
|
||||
}
|
||||
"You need to video yourself doing the secret handshake to post here",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Does not display category banners when set", async assert => {
|
||||
QUnit.test("Does not display category banners when set", async (assert) => {
|
||||
await visit("/c/test-read-only-with-banner");
|
||||
assert.ok(
|
||||
!visible(".category-read-only-banner"),
|
||||
|
||||
@@ -4,11 +4,11 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("CategoryChooser", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
allow_uncategorized_topics: false
|
||||
}
|
||||
allow_uncategorized_topics: false,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("does not display uncategorized if not allowed", async assert => {
|
||||
QUnit.test("does not display uncategorized if not allowed", async (assert) => {
|
||||
const categoryChooser = selectKit(".category-chooser");
|
||||
|
||||
await visit("/");
|
||||
@@ -19,18 +19,13 @@ QUnit.test("does not display uncategorized if not allowed", async assert => {
|
||||
assert.ok(categoryChooser.rowByIndex(0).name() !== "uncategorized");
|
||||
});
|
||||
|
||||
QUnit.test("prefill category when category_id is set", async assert => {
|
||||
QUnit.test("prefill category when category_id is set", async (assert) => {
|
||||
await visit("/new-topic?category_id=1");
|
||||
|
||||
assert.equal(
|
||||
selectKit(".category-chooser")
|
||||
.header()
|
||||
.value(),
|
||||
1
|
||||
);
|
||||
assert.equal(selectKit(".category-chooser").header().value(), 1);
|
||||
});
|
||||
|
||||
QUnit.test("filter is case insensitive", async assert => {
|
||||
QUnit.test("filter is case insensitive", async (assert) => {
|
||||
const categoryChooser = selectKit(".category-chooser");
|
||||
|
||||
await visit("/");
|
||||
|
||||
@@ -2,10 +2,10 @@ import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Category Edit - security", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("default", async assert => {
|
||||
QUnit.test("default", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
@@ -13,20 +13,14 @@ QUnit.test("default", async assert => {
|
||||
|
||||
const $permissionListItems = find(".permission-list li");
|
||||
|
||||
const badgeName = $permissionListItems
|
||||
.eq(0)
|
||||
.find(".badge-group")
|
||||
.text();
|
||||
const badgeName = $permissionListItems.eq(0).find(".badge-group").text();
|
||||
assert.equal(badgeName, "everyone");
|
||||
|
||||
const permission = $permissionListItems
|
||||
.eq(0)
|
||||
.find(".permission")
|
||||
.text();
|
||||
const permission = $permissionListItems.eq(0).find(".permission").text();
|
||||
assert.equal(permission, "Create / Reply / See");
|
||||
});
|
||||
|
||||
QUnit.test("removing a permission", async assert => {
|
||||
QUnit.test("removing a permission", async (assert) => {
|
||||
const availableGroups = selectKit(".available-groups");
|
||||
|
||||
await visit("/c/bug");
|
||||
@@ -52,7 +46,7 @@ QUnit.test("removing a permission", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("adding a permission", async assert => {
|
||||
QUnit.test("adding a permission", async (assert) => {
|
||||
const availableGroups = selectKit(".available-groups");
|
||||
const permissionSelector = selectKit(".permission-selector");
|
||||
|
||||
@@ -78,7 +72,7 @@ QUnit.test("adding a permission", async assert => {
|
||||
assert.equal(permission, "Reply / See");
|
||||
});
|
||||
|
||||
QUnit.test("adding a previously removed permission", async assert => {
|
||||
QUnit.test("adding a previously removed permission", async (assert) => {
|
||||
const availableGroups = selectKit(".available-groups");
|
||||
|
||||
await visit("/c/bug");
|
||||
@@ -108,15 +102,9 @@ QUnit.test("adding a previously removed permission", async assert => {
|
||||
|
||||
const $permissionListItems = find(".permission-list li");
|
||||
|
||||
const badgeName = $permissionListItems
|
||||
.eq(0)
|
||||
.find(".badge-group")
|
||||
.text();
|
||||
const badgeName = $permissionListItems.eq(0).find(".badge-group").text();
|
||||
assert.equal(badgeName, "everyone");
|
||||
|
||||
const permission = $permissionListItems
|
||||
.eq(0)
|
||||
.find(".permission")
|
||||
.text();
|
||||
const permission = $permissionListItems.eq(0).find(".permission").text();
|
||||
assert.equal(permission, "Create / Reply / See");
|
||||
});
|
||||
|
||||
@@ -4,10 +4,10 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Category Edit", {
|
||||
loggedIn: true,
|
||||
settings: { email_in: true }
|
||||
settings: { email_in: true },
|
||||
});
|
||||
|
||||
QUnit.test("Can open the category modal", async assert => {
|
||||
QUnit.test("Can open the category modal", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
@@ -17,7 +17,7 @@ QUnit.test("Can open the category modal", async assert => {
|
||||
assert.ok(!visible(".d-modal"), "it closes the modal");
|
||||
});
|
||||
|
||||
QUnit.test("Editing the category", async assert => {
|
||||
QUnit.test("Editing the category", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
@@ -46,8 +46,8 @@ QUnit.test("Editing the category", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.skip("Edit the description without loosing progress", async assert => {
|
||||
let win = { focus: function() {} };
|
||||
QUnit.skip("Edit the description without loosing progress", async (assert) => {
|
||||
let win = { focus: function () {} };
|
||||
let windowOpen = sandbox.stub(window, "open").returns(win);
|
||||
sandbox.stub(win, "focus");
|
||||
|
||||
@@ -61,7 +61,7 @@ QUnit.skip("Edit the description without loosing progress", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Error Saving", async assert => {
|
||||
QUnit.test("Error Saving", async (assert) => {
|
||||
await visit("/c/bug");
|
||||
|
||||
await click(".edit-category");
|
||||
@@ -72,7 +72,7 @@ QUnit.test("Error Saving", async assert => {
|
||||
assert.equal(find("#modal-alert").html(), "duplicate email");
|
||||
});
|
||||
|
||||
QUnit.test("Subcategory list settings", async assert => {
|
||||
QUnit.test("Subcategory list settings", async (assert) => {
|
||||
const categoryChooser = selectKit(
|
||||
".edit-category-tab-general .category-chooser"
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Click Track", {});
|
||||
|
||||
QUnit.test("Do not track mentions", async assert => {
|
||||
QUnit.test("Do not track mentions", async (assert) => {
|
||||
pretender.post("/clicks/track", () => assert.ok(false));
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
@@ -9,16 +9,16 @@ import { Promise } from "rsvp";
|
||||
acceptance("Composer Actions", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
enable_whispers: true
|
||||
enable_whispers: true,
|
||||
},
|
||||
site: {
|
||||
can_tag_topics: true
|
||||
}
|
||||
can_tag_topics: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"creating new topic and then reply_as_private_message keeps attributes",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/");
|
||||
await click("button#create-topic");
|
||||
|
||||
@@ -34,7 +34,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("replying to post", async assert => {
|
||||
QUnit.test("replying to post", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -52,7 +52,7 @@ QUnit.test("replying to post", async assert => {
|
||||
assert.equal(composerActions.rowByIndex(5).value(), undefined);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - reply_as_private_message", async assert => {
|
||||
QUnit.test("replying to post - reply_as_private_message", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -63,13 +63,11 @@ QUnit.test("replying to post - reply_as_private_message", async assert => {
|
||||
|
||||
assert.equal(find(".users-input .item:eq(0)").text(), "codinghorror");
|
||||
assert.ok(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("Continuing the discussion") >= 0
|
||||
find(".d-editor-input").val().indexOf("Continuing the discussion") >= 0
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - reply_to_topic", async assert => {
|
||||
QUnit.test("replying to post - reply_to_topic", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -83,9 +81,7 @@ QUnit.test("replying to post - reply_to_topic", async assert => {
|
||||
await composerActions.selectRowByValue("reply_to_topic");
|
||||
|
||||
assert.equal(
|
||||
find(".action-title .topic-link")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".action-title .topic-link").text().trim(),
|
||||
"Internationalization / localization"
|
||||
);
|
||||
assert.equal(
|
||||
@@ -98,7 +94,7 @@ QUnit.test("replying to post - reply_to_topic", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - toggle_whisper", async assert => {
|
||||
QUnit.test("replying to post - toggle_whisper", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -116,7 +112,7 @@ QUnit.test("replying to post - toggle_whisper", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - reply_as_new_topic", async assert => {
|
||||
QUnit.test("replying to post - reply_as_new_topic", async (assert) => {
|
||||
sandbox
|
||||
.stub(Draft, "get")
|
||||
.returns(Promise.resolve({ draft: "", draft_sequence: 0 }));
|
||||
@@ -140,20 +136,14 @@ QUnit.test("replying to post - reply_as_new_topic", async assert => {
|
||||
|
||||
assert.equal(categoryChooserReplyArea.header().name(), "faq");
|
||||
assert.equal(
|
||||
find(".action-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".action-title").text().trim(),
|
||||
I18n.t("topic.create_long")
|
||||
);
|
||||
assert.ok(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.includes(quote)
|
||||
);
|
||||
assert.ok(find(".d-editor-input").val().includes(quote));
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
QUnit.test("reply_as_new_topic without a new_topic draft", async assert => {
|
||||
QUnit.test("reply_as_new_topic without a new_topic draft", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".create.reply");
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
@@ -162,7 +152,7 @@ QUnit.test("reply_as_new_topic without a new_topic draft", async assert => {
|
||||
assert.equal(exists(find(".bootbox")), false);
|
||||
});
|
||||
|
||||
QUnit.test("reply_as_new_group_message", async assert => {
|
||||
QUnit.test("reply_as_new_group_message", async (assert) => {
|
||||
// eslint-disable-next-line
|
||||
server.get("/t/130.json", () => {
|
||||
return [
|
||||
@@ -209,20 +199,20 @@ QUnit.test("reply_as_new_group_message", async assert => {
|
||||
actions_summary: [
|
||||
{
|
||||
id: 3,
|
||||
can_act: true
|
||||
can_act: true,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
can_act: true
|
||||
can_act: true,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
can_act: true
|
||||
can_act: true,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
can_act: true
|
||||
}
|
||||
can_act: true,
|
||||
},
|
||||
],
|
||||
moderator: false,
|
||||
admin: true,
|
||||
@@ -237,10 +227,10 @@ QUnit.test("reply_as_new_group_message", async assert => {
|
||||
wiki: false,
|
||||
reviewable_id: 0,
|
||||
reviewable_score_count: 0,
|
||||
reviewable_score_pending_count: 0
|
||||
}
|
||||
reviewable_score_pending_count: 0,
|
||||
},
|
||||
],
|
||||
stream: [133]
|
||||
stream: [133],
|
||||
},
|
||||
timeline_lookup: [[1, 0]],
|
||||
related_messages: [],
|
||||
@@ -286,20 +276,20 @@ QUnit.test("reply_as_new_group_message", async assert => {
|
||||
id: 4,
|
||||
count: 0,
|
||||
hidden: false,
|
||||
can_act: true
|
||||
can_act: true,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
count: 0,
|
||||
hidden: false,
|
||||
can_act: true
|
||||
can_act: true,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
count: 0,
|
||||
hidden: false,
|
||||
can_act: true
|
||||
}
|
||||
can_act: true,
|
||||
},
|
||||
],
|
||||
chunk_size: 20,
|
||||
bookmarked: false,
|
||||
@@ -339,8 +329,8 @@ QUnit.test("reply_as_new_group_message", async assert => {
|
||||
primary_group_name: null,
|
||||
primary_group_flair_url: null,
|
||||
primary_group_flair_color: null,
|
||||
primary_group_flair_bg_color: null
|
||||
}
|
||||
primary_group_flair_bg_color: null,
|
||||
},
|
||||
],
|
||||
allowed_users: [
|
||||
{
|
||||
@@ -348,22 +338,22 @@ QUnit.test("reply_as_new_group_message", async assert => {
|
||||
username: "foo",
|
||||
name: null,
|
||||
avatar_template:
|
||||
"/letter_avatar_proxy/v4/letter/f/b19c9b/{size}.png"
|
||||
}
|
||||
"/letter_avatar_proxy/v4/letter/f/b19c9b/{size}.png",
|
||||
},
|
||||
],
|
||||
created_by: {
|
||||
id: 1,
|
||||
username: "bianca",
|
||||
name: null,
|
||||
avatar_template:
|
||||
"/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png"
|
||||
"/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
|
||||
},
|
||||
last_poster: {
|
||||
id: 1,
|
||||
username: "bianca",
|
||||
name: null,
|
||||
avatar_template:
|
||||
"/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png"
|
||||
"/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
|
||||
},
|
||||
allowed_groups: [
|
||||
{
|
||||
@@ -394,11 +384,11 @@ QUnit.test("reply_as_new_group_message", async assert => {
|
||||
membership_request_template: null,
|
||||
members_visibility_level: 0,
|
||||
can_see_members: true,
|
||||
publish_read_state: false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
publish_read_state: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
@@ -416,7 +406,7 @@ QUnit.test("reply_as_new_group_message", async assert => {
|
||||
assert.deepEqual(items, ["foo", "foo_group"]);
|
||||
});
|
||||
|
||||
QUnit.test("hide component if no content", async assert => {
|
||||
QUnit.test("hide component if no content", async (assert) => {
|
||||
await visit("/");
|
||||
await click("button#create-topic");
|
||||
|
||||
@@ -432,7 +422,7 @@ QUnit.test("hide component if no content", async assert => {
|
||||
assert.equal(composerActions.rows().length, 2);
|
||||
});
|
||||
|
||||
QUnit.test("interactions", async assert => {
|
||||
QUnit.test("interactions", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
const quote = "Life is like riding a bicycle.";
|
||||
|
||||
@@ -443,9 +433,7 @@ QUnit.test("interactions", async assert => {
|
||||
await composerActions.selectRowByValue("reply_to_topic");
|
||||
|
||||
assert.equal(
|
||||
find(".action-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".action-title").text().trim(),
|
||||
"Internationalization / localization"
|
||||
);
|
||||
assert.equal(find(".d-editor-input").val(), quote);
|
||||
@@ -466,12 +454,7 @@ QUnit.test("interactions", async assert => {
|
||||
await composerActions.expand();
|
||||
|
||||
assert.ok(exists(find(".action-title img.avatar")));
|
||||
assert.equal(
|
||||
find(".action-title .user-link")
|
||||
.text()
|
||||
.trim(),
|
||||
"codinghorror"
|
||||
);
|
||||
assert.equal(find(".action-title .user-link").text().trim(), "codinghorror");
|
||||
assert.equal(find(".d-editor-input").val(), quote);
|
||||
assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic");
|
||||
assert.equal(
|
||||
@@ -487,16 +470,10 @@ QUnit.test("interactions", async assert => {
|
||||
await composerActions.expand();
|
||||
|
||||
assert.equal(
|
||||
find(".action-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".action-title").text().trim(),
|
||||
I18n.t("topic.create_long")
|
||||
);
|
||||
assert.ok(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.includes(quote)
|
||||
);
|
||||
assert.ok(find(".d-editor-input").val().includes(quote));
|
||||
assert.equal(composerActions.rowByIndex(0).value(), "reply_to_post");
|
||||
assert.equal(
|
||||
composerActions.rowByIndex(1).value(),
|
||||
@@ -510,15 +487,11 @@ QUnit.test("interactions", async assert => {
|
||||
await composerActions.expand();
|
||||
|
||||
assert.equal(
|
||||
find(".action-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".action-title").text().trim(),
|
||||
I18n.t("topic.private_message")
|
||||
);
|
||||
assert.ok(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("Continuing the discussion") === 0
|
||||
find(".d-editor-input").val().indexOf("Continuing the discussion") === 0
|
||||
);
|
||||
assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic");
|
||||
assert.equal(composerActions.rowByIndex(1).value(), "reply_to_post");
|
||||
@@ -526,7 +499,7 @@ QUnit.test("interactions", async assert => {
|
||||
assert.equal(composerActions.rows().length, 3);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - toggle_topic_bump", async assert => {
|
||||
QUnit.test("replying to post - toggle_topic_bump", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -554,7 +527,7 @@ QUnit.test("replying to post - toggle_topic_bump", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as staff", async assert => {
|
||||
QUnit.test("replying to post as staff", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
updateCurrentUser({ admin: true });
|
||||
@@ -566,7 +539,7 @@ QUnit.test("replying to post as staff", async assert => {
|
||||
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as TL3 user", async assert => {
|
||||
QUnit.test("replying to post as TL3 user", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 3 });
|
||||
@@ -575,7 +548,7 @@ QUnit.test("replying to post as TL3 user", async assert => {
|
||||
await composerActions.expand();
|
||||
|
||||
assert.equal(composerActions.rows().length, 3);
|
||||
Array.from(composerActions.rows()).forEach(row => {
|
||||
Array.from(composerActions.rows()).forEach((row) => {
|
||||
assert.notEqual(
|
||||
row.value,
|
||||
"toggle_topic_bump",
|
||||
@@ -584,7 +557,7 @@ QUnit.test("replying to post as TL3 user", async assert => {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as TL4 user", async assert => {
|
||||
QUnit.test("replying to post as TL4 user", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 4 });
|
||||
@@ -598,7 +571,7 @@ QUnit.test("replying to post as TL4 user", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"replying to first post - reply_as_private_message",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -609,14 +582,12 @@ QUnit.test(
|
||||
|
||||
assert.equal(find(".users-input .item:eq(0)").text(), "uwe_keim");
|
||||
assert.ok(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("Continuing the discussion") >= 0
|
||||
find(".d-editor-input").val().indexOf("Continuing the discussion") >= 0
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("editing post", async assert => {
|
||||
QUnit.test("editing post", async (assert) => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -631,17 +602,17 @@ QUnit.test("editing post", async assert => {
|
||||
acceptance("Composer Actions With New Topic Draft", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
enable_whispers: true
|
||||
enable_whispers: true,
|
||||
},
|
||||
site: {
|
||||
can_tag_topics: true
|
||||
can_tag_topics: true,
|
||||
},
|
||||
beforeEach() {
|
||||
_clearSnapshots();
|
||||
},
|
||||
afterEach() {
|
||||
_clearSnapshots();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const stubDraftResponse = () => {
|
||||
@@ -649,12 +620,12 @@ const stubDraftResponse = () => {
|
||||
Promise.resolve({
|
||||
draft:
|
||||
'{"reply":"dum de dum da ba.","action":"createTopic","title":"dum da ba dum dum","categoryId":null,"archetypeId":"regular","metaData":null,"composerTime":540879,"typingTime":3400}',
|
||||
draft_sequence: 0
|
||||
draft_sequence: 0,
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
QUnit.test("shared draft", async assert => {
|
||||
QUnit.test("shared draft", async (assert) => {
|
||||
stubDraftResponse();
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
@@ -696,7 +667,7 @@ QUnit.test("shared draft", async assert => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
QUnit.test("reply_as_new_topic with new_topic draft", async assert => {
|
||||
QUnit.test("reply_as_new_topic with new_topic draft", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".create.reply");
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
@@ -6,8 +6,8 @@ function setupPretender(server, helper) {
|
||||
{
|
||||
short_url: "upload://asdsad.png",
|
||||
url: "/secure-media-uploads/default/3X/1/asjdiasjdiasida.png",
|
||||
short_path: "/uploads/short-url/asdsad.png"
|
||||
}
|
||||
short_path: "/uploads/short-url/asdsad.png",
|
||||
},
|
||||
]);
|
||||
});
|
||||
}
|
||||
@@ -19,9 +19,7 @@ async function writeInComposer(assert) {
|
||||
await fillIn(".d-editor-input", "[test](upload://abcdefg.png)");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
'<p><a href="/404">test</a></p>'
|
||||
);
|
||||
|
||||
@@ -32,15 +30,13 @@ acceptance("Composer Attachment", {
|
||||
loggedIn: true,
|
||||
pretend(server, helper) {
|
||||
setupPretender(server, helper);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("attachments are cooked properly", async assert => {
|
||||
QUnit.test("attachments are cooked properly", async (assert) => {
|
||||
await writeInComposer(assert);
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
'<p><a class="attachment" href="/uploads/short-url/asdsad.png">test</a></p>'
|
||||
);
|
||||
});
|
||||
@@ -48,21 +44,19 @@ QUnit.test("attachments are cooked properly", async assert => {
|
||||
acceptance("Composer Attachment - Secure Media Enabled", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
secure_media: true
|
||||
secure_media: true,
|
||||
},
|
||||
pretend(server, helper) {
|
||||
setupPretender(server, helper);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"attachments are cooked properly when secure media is enabled",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await writeInComposer(assert);
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
'<p><a class="attachment" href="/secure-media-uploads/default/3X/1/asjdiasjdiasida.png">test</a></p>'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,19 +3,17 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
import pretender from "helpers/create-pretender";
|
||||
|
||||
acceptance("Composer - Edit conflict", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("Edit a post that causes an edit conflict", async assert => {
|
||||
QUnit.test("Edit a post that causes an edit conflict", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.show-more-actions");
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
await fillIn(".d-editor-input", "this will 409");
|
||||
await click("#reply-control button.create");
|
||||
assert.equal(
|
||||
find("#reply-control button.create")
|
||||
.text()
|
||||
.trim(),
|
||||
find("#reply-control button.create").text().trim(),
|
||||
I18n.t("composer.overwrite_edit"),
|
||||
"it shows the overwrite button"
|
||||
);
|
||||
@@ -27,7 +25,7 @@ QUnit.test("Edit a post that causes an edit conflict", async assert => {
|
||||
});
|
||||
|
||||
function handleDraftPretender(assert) {
|
||||
pretender.post("/draft.json", request => {
|
||||
pretender.post("/draft.json", (request) => {
|
||||
if (
|
||||
request.requestBody.indexOf("%22reply%22%3A%22%22") === -1 &&
|
||||
request.requestBody.indexOf("Any+plans+to+support+localization") !== -1
|
||||
@@ -51,7 +49,7 @@ function handleDraftPretender(assert) {
|
||||
|
||||
QUnit.test(
|
||||
"Should not send originalText when posting a new reply",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
handleDraftPretender(assert);
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -63,7 +61,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Should send originalText when editing a reply", async assert => {
|
||||
QUnit.test("Should send originalText when editing a reply", async (assert) => {
|
||||
handleDraftPretender(assert);
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Composer - Hyperlink", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("add a hyperlink to a reply", async assert => {
|
||||
QUnit.test("add a hyperlink to a reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:first-child button.reply");
|
||||
await fillIn(".d-editor-input", "This is a link to ");
|
||||
@@ -90,9 +90,7 @@ QUnit.test("add a hyperlink to a reply", async assert => {
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find(".link-url")
|
||||
.val()
|
||||
.includes("http"),
|
||||
find(".link-url").val().includes("http"),
|
||||
"replaces link url field with internal link"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -4,13 +4,13 @@ acceptance("Composer - Onebox", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
max_oneboxes_per_post: 2,
|
||||
enable_markdown_linkify: true
|
||||
}
|
||||
enable_markdown_linkify: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Preview update should respect max_oneboxes_per_post site setting",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
@@ -30,9 +30,7 @@ http://www.example.com/has-title.html
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
`
|
||||
<p><aside class=\"onebox\"><article class=\"onebox-body\"><h3><a href=\"http://www.example.com/article.html\">An interesting article</a></h3></article></aside><br>
|
||||
This is another test <a href=\"http://www.example.com/has-title.html\" class=\"inline-onebox\">This is a great title</a></p>
|
||||
|
||||
@@ -10,11 +10,11 @@ acceptance("Composer - Tags", {
|
||||
});
|
||||
},
|
||||
site: {
|
||||
can_tag_topics: true
|
||||
}
|
||||
can_tag_topics: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("staff bypass tag validation rule", async assert => {
|
||||
QUnit.test("staff bypass tag validation rule", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
@@ -31,7 +31,7 @@ QUnit.test("staff bypass tag validation rule", async assert => {
|
||||
assert.notEqual(currentURL(), "/");
|
||||
});
|
||||
|
||||
QUnit.test("users do not bypass tag validation rule", async assert => {
|
||||
QUnit.test("users do not bypass tag validation rule", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ acceptance("Composer", {
|
||||
});
|
||||
},
|
||||
settings: {
|
||||
enable_whispers: true
|
||||
}
|
||||
enable_whispers: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.skip("Tests the Composer controls", async assert => {
|
||||
QUnit.skip("Tests the Composer controls", async (assert) => {
|
||||
await visit("/");
|
||||
assert.ok(exists("#create-topic"), "the create button is visible");
|
||||
|
||||
@@ -60,9 +60,7 @@ QUnit.skip("Tests the Composer controls", async assert => {
|
||||
|
||||
await fillIn(".d-editor-input", "this is the *content* of a post");
|
||||
assert.equal(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview").html().trim(),
|
||||
"<p>this is the <em>content</em> of a post</p>",
|
||||
"it previews content"
|
||||
);
|
||||
@@ -86,9 +84,7 @@ QUnit.skip("Tests the Composer controls", async assert => {
|
||||
|
||||
const example = I18n.t(`composer.bold_text`);
|
||||
assert.equal(
|
||||
find("#reply-control .d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
find("#reply-control .d-editor-input").val().trim(),
|
||||
`this is the *content* of a post**${example}**`,
|
||||
"it supports keyboard shortcuts"
|
||||
);
|
||||
@@ -100,7 +96,7 @@ QUnit.skip("Tests the Composer controls", async assert => {
|
||||
assert.ok(!exists(".bootbox.modal"), "the confirmation can be cancelled");
|
||||
});
|
||||
|
||||
QUnit.test("Composer upload placeholder", async assert => {
|
||||
QUnit.test("Composer upload placeholder", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
@@ -112,8 +108,8 @@ QUnit.test("Composer upload placeholder", async assert => {
|
||||
original_filename: "test.png",
|
||||
thumbnail_width: 200,
|
||||
thumbnail_height: 300,
|
||||
url: "/images/avatar.png?1"
|
||||
}
|
||||
url: "/images/avatar.png?1",
|
||||
},
|
||||
};
|
||||
|
||||
const file2 = new Blob([""], { type: "image/png" });
|
||||
@@ -124,8 +120,8 @@ QUnit.test("Composer upload placeholder", async assert => {
|
||||
original_filename: "test.png",
|
||||
thumbnail_width: 100,
|
||||
thumbnail_height: 200,
|
||||
url: "/images/avatar.png?2"
|
||||
}
|
||||
url: "/images/avatar.png?2",
|
||||
},
|
||||
};
|
||||
|
||||
const file3 = new Blob([""], { type: "image/png" });
|
||||
@@ -136,8 +132,8 @@ QUnit.test("Composer upload placeholder", async assert => {
|
||||
original_filename: "image.png",
|
||||
thumbnail_width: 300,
|
||||
thumbnail_height: 400,
|
||||
url: "/images/avatar.png?3"
|
||||
}
|
||||
url: "/images/avatar.png?3",
|
||||
},
|
||||
};
|
||||
|
||||
const file4 = new Blob([""], { type: "image/png" });
|
||||
@@ -148,8 +144,8 @@ QUnit.test("Composer upload placeholder", async assert => {
|
||||
original_filename: "ima++ge.png",
|
||||
thumbnail_width: 300,
|
||||
thumbnail_height: 400,
|
||||
url: "/images/avatar.png?3"
|
||||
}
|
||||
url: "/images/avatar.png?3",
|
||||
},
|
||||
};
|
||||
|
||||
await find(".wmd-controls").trigger("fileuploadsend", data1);
|
||||
@@ -193,7 +189,7 @@ QUnit.test("Composer upload placeholder", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create a topic with server side errors", async assert => {
|
||||
QUnit.test("Create a topic with server side errors", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "this title triggers an error");
|
||||
@@ -205,7 +201,7 @@ QUnit.test("Create a topic with server side errors", async assert => {
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
});
|
||||
|
||||
QUnit.test("Create a Topic", async assert => {
|
||||
QUnit.test("Create a Topic", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "Internationalization Localization");
|
||||
@@ -218,7 +214,7 @@ QUnit.test("Create a Topic", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create an enqueued Topic", async assert => {
|
||||
QUnit.test("Create an enqueued Topic", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "Internationalization Localization");
|
||||
@@ -231,7 +227,7 @@ QUnit.test("Create an enqueued Topic", async assert => {
|
||||
assert.ok(invisible(".d-modal"), "the modal can be dismissed");
|
||||
});
|
||||
|
||||
QUnit.test("Can display a message and route to a URL", async assert => {
|
||||
QUnit.test("Can display a message and route to a URL", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "This title doesn't matter");
|
||||
@@ -251,7 +247,7 @@ QUnit.test("Can display a message and route to a URL", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create a Reply", async assert => {
|
||||
QUnit.test("Create a Reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
@@ -271,7 +267,7 @@ QUnit.test("Create a Reply", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Can edit a post after starting a reply", async assert => {
|
||||
QUnit.test("Can edit a post after starting a reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
await click("#topic-footer-buttons .create");
|
||||
@@ -289,7 +285,7 @@ QUnit.test("Can edit a post after starting a reply", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Posting on a different topic", async assert => {
|
||||
QUnit.test("Posting on a different topic", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await fillIn(".d-editor-input", "this is the content for a different topic");
|
||||
@@ -306,7 +302,7 @@ QUnit.test("Posting on a different topic", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Create an enqueued Reply", async assert => {
|
||||
QUnit.test("Create an enqueued Reply", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.notOk(find(".pending-posts .reviewable-item").length);
|
||||
@@ -330,7 +326,7 @@ QUnit.test("Create an enqueued Reply", async assert => {
|
||||
assert.ok(find(".pending-posts .reviewable-item").length);
|
||||
});
|
||||
|
||||
QUnit.test("Edit the first post", async assert => {
|
||||
QUnit.test("Edit the first post", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
@@ -341,9 +337,7 @@ QUnit.test("Edit the first post", async assert => {
|
||||
await click(".topic-post:eq(0) button.show-more-actions");
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("Any plans to support"),
|
||||
find(".d-editor-input").val().indexOf("Any plans to support"),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
@@ -370,22 +364,18 @@ QUnit.test("Edit the first post", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Composer can switch between edits", async assert => {
|
||||
QUnit.test("Composer can switch between edits", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("This is the first post."),
|
||||
find(".d-editor-input").val().indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
await click(".topic-post:eq(1) button.edit");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("This is the second post."),
|
||||
find(".d-editor-input").val().indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
@@ -393,7 +383,7 @@ QUnit.test("Composer can switch between edits", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"Composer with dirty edit can toggle to another edit",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
@@ -403,23 +393,19 @@ QUnit.test(
|
||||
|
||||
await click(".modal-footer a:eq(0)");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("This is the second post."),
|
||||
find(".d-editor-input").val().indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Composer can toggle between edit and reply", async assert => {
|
||||
QUnit.test("Composer can toggle between edit and reply", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("This is the first post."),
|
||||
find(".d-editor-input").val().indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
@@ -427,15 +413,13 @@ QUnit.test("Composer can toggle between edit and reply", async assert => {
|
||||
assert.equal(find(".d-editor-input").val(), "", "it clears the input");
|
||||
await click(".topic-post:eq(0) button.edit");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("This is the first post."),
|
||||
find(".d-editor-input").val().indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Composer can toggle whispers", async assert => {
|
||||
QUnit.test("Composer can toggle whispers", async (assert) => {
|
||||
const menu = selectKit(".toolbar-popup-menu-options");
|
||||
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
@@ -472,7 +456,7 @@ QUnit.test("Composer can toggle whispers", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"Composer can toggle layouts (open, fullscreen and draft)",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
|
||||
@@ -514,7 +498,7 @@ QUnit.test(
|
||||
|
||||
QUnit.test(
|
||||
"Composer can toggle between reply and createTopic",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
|
||||
@@ -561,7 +545,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Composer with dirty reply can toggle to edit", async assert => {
|
||||
QUnit.test("Composer with dirty reply can toggle to edit", async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
@@ -570,9 +554,7 @@ QUnit.test("Composer with dirty reply can toggle to edit", async assert => {
|
||||
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
|
||||
await click(".modal-footer a:eq(0)");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("This is the first post."),
|
||||
find(".d-editor-input").val().indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
@@ -580,7 +562,7 @@ QUnit.test("Composer with dirty reply can toggle to edit", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"Composer draft with dirty reply can toggle to edit",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
@@ -594,9 +576,7 @@ QUnit.test(
|
||||
);
|
||||
await click(".modal-footer a:eq(0)");
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.indexOf("This is the second post."),
|
||||
find(".d-editor-input").val().indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
@@ -605,7 +585,7 @@ QUnit.test(
|
||||
|
||||
QUnit.test(
|
||||
"Composer draft can switch to draft in new context without destroying current draft",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:eq(0) button.reply");
|
||||
@@ -628,7 +608,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Checks for existing draft", async assert => {
|
||||
QUnit.test("Checks for existing draft", async (assert) => {
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
||||
@@ -645,7 +625,7 @@ QUnit.test("Checks for existing draft", async assert => {
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("Can switch states without abandon popup", async assert => {
|
||||
QUnit.test("Can switch states without abandon popup", async (assert) => {
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
||||
@@ -656,7 +636,7 @@ QUnit.test("Can switch states without abandon popup", async assert => {
|
||||
sandbox.stub(Draft, "get").returns(
|
||||
Promise.resolve({
|
||||
draft: null,
|
||||
draft_sequence: 0
|
||||
draft_sequence: 0,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -677,9 +657,7 @@ QUnit.test("Can switch states without abandon popup", async assert => {
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.includes(longText),
|
||||
find(".d-editor-input").val().includes(longText),
|
||||
"entered text should still be there"
|
||||
);
|
||||
|
||||
@@ -695,7 +673,7 @@ QUnit.test("Can switch states without abandon popup", async assert => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
QUnit.test("Loading draft also replaces the recipients", async assert => {
|
||||
QUnit.test("Loading draft also replaces the recipients", async (assert) => {
|
||||
try {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
||||
@@ -703,7 +681,7 @@ QUnit.test("Loading draft also replaces the recipients", async assert => {
|
||||
Promise.resolve({
|
||||
draft:
|
||||
'{"reply":"hello","action":"privateMessage","title":"hello","categoryId":null,"archetypeId":"private_message","metaData":null,"recipients":"codinghorror","composerTime":9159,"typingTime":2500}',
|
||||
draft_sequence: 0
|
||||
draft_sequence: 0,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -719,7 +697,7 @@ QUnit.test("Loading draft also replaces the recipients", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"Deleting the text content of the first post in a private message",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/34");
|
||||
|
||||
await click("#post_1 .d-icon-ellipsis-h");
|
||||
@@ -744,7 +722,7 @@ const assertImageResized = (assert, uploads) => {
|
||||
);
|
||||
};
|
||||
|
||||
QUnit.test("Image resizing buttons", async assert => {
|
||||
QUnit.test("Image resizing buttons", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
@@ -773,7 +751,7 @@ QUnit.test("Image resizing buttons", async assert => {
|
||||
// 11 bbcode - should not work
|
||||
"[img]/images/avatar.png[/img]",
|
||||
// 12 Image with data attributes
|
||||
""
|
||||
"",
|
||||
];
|
||||
|
||||
await fillIn(".d-editor-input", uploads.join("\n"));
|
||||
@@ -850,7 +828,7 @@ QUnit.test("Image resizing buttons", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("can reply to a private message", async assert => {
|
||||
QUnit.test("can reply to a private message", async (assert) => {
|
||||
let submitted;
|
||||
|
||||
/* global server */
|
||||
|
||||
@@ -5,19 +5,16 @@ acceptance("Composer topic featured links", {
|
||||
settings: {
|
||||
topic_featured_link_enabled: true,
|
||||
max_topic_title_length: 80,
|
||||
enable_markdown_linkify: true
|
||||
}
|
||||
enable_markdown_linkify: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("onebox with title", async assert => {
|
||||
QUnit.test("onebox with title", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/has-title.html");
|
||||
assert.ok(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim()
|
||||
.indexOf("onebox") > 0,
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
@@ -31,15 +28,12 @@ QUnit.test("onebox with title", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("onebox result doesn't include a title", async assert => {
|
||||
QUnit.test("onebox result doesn't include a title", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/no-title.html");
|
||||
assert.ok(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim()
|
||||
.indexOf("onebox") > 0,
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
@@ -53,15 +47,12 @@ QUnit.test("onebox result doesn't include a title", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("no onebox result", async assert => {
|
||||
QUnit.test("no onebox result", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/nope-onebox.html");
|
||||
assert.ok(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim()
|
||||
.indexOf("onebox") > 0,
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
@@ -75,16 +66,13 @@ QUnit.test("no onebox result", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("ignore internal links", async assert => {
|
||||
QUnit.test("ignore internal links", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
const title = "http://" + window.location.hostname + "/internal-page.html";
|
||||
await fillIn("#reply-title", title);
|
||||
assert.equal(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim()
|
||||
.indexOf("onebox"),
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox"),
|
||||
-1,
|
||||
"onebox preview doesn't show"
|
||||
);
|
||||
@@ -96,7 +84,7 @@ QUnit.test("ignore internal links", async assert => {
|
||||
assert.equal(find(".title-input input").val(), title, "title is unchanged");
|
||||
});
|
||||
|
||||
QUnit.test("link is longer than max title length", async assert => {
|
||||
QUnit.test("link is longer than max title length", async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn(
|
||||
@@ -104,10 +92,7 @@ QUnit.test("link is longer than max title length", async assert => {
|
||||
"http://www.example.com/has-title-and-a-url-that-is-more-than-80-characters-because-thats-good-for-seo-i-guess.html"
|
||||
);
|
||||
assert.ok(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim()
|
||||
.indexOf("onebox") > 0,
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
@@ -121,29 +106,29 @@ QUnit.test("link is longer than max title length", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("onebox with title but extra words in title field", async assert => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/has-title.html test");
|
||||
assert.equal(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim()
|
||||
.indexOf("onebox"),
|
||||
-1,
|
||||
"onebox preview doesn't show"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().length,
|
||||
0,
|
||||
"link isn't put into the post"
|
||||
);
|
||||
assert.equal(
|
||||
find(".title-input input").val(),
|
||||
"http://www.example.com/has-title.html test",
|
||||
"title is unchanged"
|
||||
);
|
||||
});
|
||||
QUnit.test(
|
||||
"onebox with title but extra words in title field",
|
||||
async (assert) => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "http://www.example.com/has-title.html test");
|
||||
assert.equal(
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox"),
|
||||
-1,
|
||||
"onebox preview doesn't show"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input").val().length,
|
||||
0,
|
||||
"link isn't put into the post"
|
||||
);
|
||||
assert.equal(
|
||||
find(".title-input input").val(),
|
||||
"http://www.example.com/has-title.html test",
|
||||
"title is unchanged"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
acceptance("Composer topic featured links when uncategorized is not allowed", {
|
||||
loggedIn: true,
|
||||
@@ -151,11 +136,11 @@ acceptance("Composer topic featured links when uncategorized is not allowed", {
|
||||
topic_featured_link_enabled: true,
|
||||
max_topic_title_length: 80,
|
||||
enable_markdown_linkify: true,
|
||||
allow_uncategorized_topics: false
|
||||
}
|
||||
allow_uncategorized_topics: false,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Pasting a link enables the text input area", async assert => {
|
||||
QUnit.test("Pasting a link enables the text input area", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
|
||||
await visit("/");
|
||||
@@ -166,10 +151,7 @@ QUnit.test("Pasting a link enables the text input area", async assert => {
|
||||
);
|
||||
await fillIn("#reply-title", "http://www.example.com/has-title.html");
|
||||
assert.ok(
|
||||
find(".d-editor-preview")
|
||||
.html()
|
||||
.trim()
|
||||
.indexOf("onebox") > 0,
|
||||
find(".d-editor-preview").html().trim().indexOf("onebox") > 0,
|
||||
"it pastes the link into the body and previews it"
|
||||
);
|
||||
assert.ok(
|
||||
|
||||
@@ -5,11 +5,11 @@ acceptance("Composer and uncategorized is not allowed", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
enable_whispers: true,
|
||||
allow_uncategorized_topics: false
|
||||
}
|
||||
allow_uncategorized_topics: false,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Disable body until category is selected", async assert => {
|
||||
QUnit.test("Disable body until category is selected", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
|
||||
await visit("/");
|
||||
|
||||
@@ -7,7 +7,7 @@ acceptance("Create Account - external auth", {
|
||||
auth_provider: "test",
|
||||
email: "blah@example.com",
|
||||
can_edit_username: true,
|
||||
can_edit_name: true
|
||||
can_edit_name: true,
|
||||
});
|
||||
node.id = "data-authentication";
|
||||
document.querySelector("head").appendChild(node);
|
||||
@@ -16,10 +16,10 @@ acceptance("Create Account - external auth", {
|
||||
document
|
||||
.querySelector("head")
|
||||
.removeChild(document.getElementById("data-authentication"));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("when skip is disabled (default)", async assert => {
|
||||
QUnit.test("when skip is disabled (default)", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
@@ -30,7 +30,7 @@ QUnit.test("when skip is disabled (default)", async assert => {
|
||||
assert.ok(exists("#new-account-username"), "it shows the fields");
|
||||
});
|
||||
|
||||
QUnit.test("when skip is enabled", async function(assert) {
|
||||
QUnit.test("when skip is enabled", async function (assert) {
|
||||
this.siteSettings.external_auth_skip_create_confirm = true;
|
||||
await visit("/");
|
||||
|
||||
|
||||
@@ -7,25 +7,25 @@ acceptance("Create Account - User Fields", {
|
||||
id: 34,
|
||||
name: "I've read the terms of service",
|
||||
field_type: "confirm",
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 35,
|
||||
name: "What is your pet's name?",
|
||||
field_type: "text",
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 36,
|
||||
name: "What's your dad like?",
|
||||
field_type: "text",
|
||||
required: false
|
||||
}
|
||||
]
|
||||
}
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("create account with user fields", async assert => {
|
||||
QUnit.test("create account with user fields", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .sign-up-button");
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import PreloadStore from "discourse/lib/preload-store";
|
||||
|
||||
acceptance("CustomHTML set");
|
||||
|
||||
QUnit.test("has no custom HTML in the top", async assert => {
|
||||
QUnit.test("has no custom HTML in the top", async (assert) => {
|
||||
await visit("/static/faq");
|
||||
assert.ok(!exists("span.custom-html-test"), "it has no markup");
|
||||
});
|
||||
|
||||
QUnit.test("renders set HTML", async assert => {
|
||||
QUnit.test("renders set HTML", async (assert) => {
|
||||
setCustomHTML("top", '<span class="custom-html-test">HTML</span>');
|
||||
|
||||
await visit("/static/faq");
|
||||
@@ -20,9 +20,9 @@ QUnit.test("renders set HTML", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("renders preloaded HTML", async assert => {
|
||||
QUnit.test("renders preloaded HTML", async (assert) => {
|
||||
PreloadStore.store("customHTML", {
|
||||
top: "<span class='cookie'>monster</span>"
|
||||
top: "<span class='cookie'>monster</span>",
|
||||
});
|
||||
|
||||
await visit("/static/faq");
|
||||
|
||||
@@ -9,10 +9,10 @@ acceptance("CustomHTML template", {
|
||||
|
||||
afterEach() {
|
||||
delete Ember.TEMPLATES["top"];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("renders custom template", async assert => {
|
||||
QUnit.test("renders custom template", async (assert) => {
|
||||
await visit("/static/faq");
|
||||
assert.equal(find("span.top-span").text(), "TOP", "it inserted the template");
|
||||
});
|
||||
|
||||
@@ -5,29 +5,29 @@ acceptance("Dashboard", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
dashboard_visible_tabs: "moderation|security|reports",
|
||||
dashboard_general_tab_activity_metrics: "page_view_total_reqs"
|
||||
dashboard_general_tab_activity_metrics: "page_view_total_reqs",
|
||||
},
|
||||
site: {
|
||||
groups: [
|
||||
{
|
||||
id: 88,
|
||||
name: "tl1"
|
||||
name: "tl1",
|
||||
},
|
||||
{
|
||||
id: 89,
|
||||
name: "tl2"
|
||||
}
|
||||
]
|
||||
}
|
||||
name: "tl2",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("default", async assert => {
|
||||
QUnit.test("default", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard"), "has dashboard-next class");
|
||||
});
|
||||
|
||||
QUnit.test("tabs", async assert => {
|
||||
QUnit.test("tabs", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
||||
@@ -36,7 +36,7 @@ QUnit.test("tabs", async assert => {
|
||||
assert.ok(exists(".dashboard .navigation-item.reports"), "reports tab");
|
||||
});
|
||||
|
||||
QUnit.test("general tab", async assert => {
|
||||
QUnit.test("general tab", async (assert) => {
|
||||
await visit("/admin");
|
||||
assert.ok(exists(".admin-report.signups"), "signups report");
|
||||
assert.ok(exists(".admin-report.posts"), "posts report");
|
||||
@@ -59,7 +59,7 @@ QUnit.test("general tab", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("activity metrics", async assert => {
|
||||
QUnit.test("activity metrics", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".admin-report.page-view-total-reqs .today-count"));
|
||||
@@ -68,7 +68,7 @@ QUnit.test("activity metrics", async assert => {
|
||||
assert.ok(exists(".admin-report.page-view-total-reqs .thirty-days-count"));
|
||||
});
|
||||
|
||||
QUnit.test("reports tab", async assert => {
|
||||
QUnit.test("reports tab", async (assert) => {
|
||||
await visit("/admin");
|
||||
await click(".dashboard .navigation-item.reports .navigation-link");
|
||||
|
||||
@@ -102,7 +102,7 @@ QUnit.test("reports tab", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("reports filters", async assert => {
|
||||
QUnit.test("reports filters", async (assert) => {
|
||||
await visit(
|
||||
'/admin/reports/signups_with_groups?end_date=2018-07-16&filters=%7B"group"%3A88%7D&start_date=2018-06-16'
|
||||
);
|
||||
@@ -119,11 +119,11 @@ QUnit.test("reports filters", async assert => {
|
||||
acceptance("Dashboard: dashboard_visible_tabs", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
dashboard_visible_tabs: "general|security|reports"
|
||||
}
|
||||
dashboard_visible_tabs: "general|security|reports",
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("visible tabs", async assert => {
|
||||
QUnit.test("visible tabs", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
||||
@@ -139,11 +139,11 @@ acceptance("Dashboard: dashboard_hidden_reports", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
dashboard_visible_tabs: "reports",
|
||||
dashboard_hidden_reports: "posts|dau_by_mau"
|
||||
}
|
||||
dashboard_hidden_reports: "posts|dau_by_mau",
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("hidden reports", async assert => {
|
||||
QUnit.test("hidden reports", async (assert) => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".admin-report.signups.is-visible"), "signups report");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Email Disabled Banner", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("when disabled", async function(assert) {
|
||||
QUnit.test("when disabled", async function (assert) {
|
||||
this.siteSettings.disable_emails = "no";
|
||||
await visit("/");
|
||||
assert.notOk(
|
||||
@@ -13,7 +13,7 @@ QUnit.test("when disabled", async function(assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("when enabled", async function(assert) {
|
||||
QUnit.test("when enabled", async function (assert) {
|
||||
this.siteSettings.disable_emails = "yes";
|
||||
await visit("/latest");
|
||||
assert.ok(
|
||||
@@ -22,7 +22,7 @@ QUnit.test("when enabled", async function(assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("when non-staff", async function(assert) {
|
||||
QUnit.test("when non-staff", async function (assert) {
|
||||
this.siteSettings.disable_emails = "non-staff";
|
||||
await visit("/");
|
||||
assert.ok(
|
||||
|
||||
@@ -8,10 +8,10 @@ acceptance("EmojiPicker", {
|
||||
},
|
||||
afterEach() {
|
||||
this.emojiStore.reset();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("emoji picker can be opened/closed", async assert => {
|
||||
QUnit.test("emoji picker can be opened/closed", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
@@ -22,7 +22,7 @@ QUnit.test("emoji picker can be opened/closed", async assert => {
|
||||
assert.notOk(exists(".emoji-picker.opened"), "it closes the picker");
|
||||
});
|
||||
|
||||
QUnit.test("emoji picker triggers event when picking emoji", async assert => {
|
||||
QUnit.test("emoji picker triggers event when picking emoji", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
@@ -37,7 +37,7 @@ QUnit.test("emoji picker triggers event when picking emoji", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"emoji picker adds leading whitespace before emoji",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
@@ -63,47 +63,50 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("emoji picker has a list of recently used emojis", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
QUnit.test(
|
||||
"emoji picker has a list of recently used emojis",
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
|
||||
assert.ok(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it shows recent selected emoji"
|
||||
);
|
||||
assert.ok(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it shows recent selected emoji"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it shows recent category icon"
|
||||
);
|
||||
assert.ok(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it shows recent category icon"
|
||||
);
|
||||
|
||||
await click(".emoji-picker .trash-recent");
|
||||
await click(".emoji-picker .trash-recent");
|
||||
|
||||
assert.notOk(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it has cleared recent emojis"
|
||||
);
|
||||
assert.notOk(
|
||||
exists(
|
||||
".emoji-picker .section.recent .section-group img.emoji[title='grinning']"
|
||||
),
|
||||
"it has cleared recent emojis"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .section[data-section="recent"]'),
|
||||
"it hides recent section"
|
||||
);
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .section[data-section="recent"]'),
|
||||
"it hides recent section"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it hides recent category icon"
|
||||
);
|
||||
});
|
||||
assert.notOk(
|
||||
exists('.emoji-picker .category-button[data-section="recent"]'),
|
||||
"it hides recent category icon"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"emoji picker correctly orders recently used emojis",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
@@ -118,9 +121,7 @@ QUnit.test(
|
||||
|
||||
assert.equal(
|
||||
/grinning/.test(
|
||||
find(".section.recent .section-group img.emoji")
|
||||
.first()
|
||||
.attr("src")
|
||||
find(".section.recent .section-group img.emoji").first().attr("src")
|
||||
),
|
||||
true,
|
||||
"it puts the last used emoji in first"
|
||||
@@ -128,7 +129,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("emoji picker persists state", async assert => {
|
||||
QUnit.test("emoji picker persists state", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
|
||||
@@ -3,28 +3,24 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Emoji", { loggedIn: true });
|
||||
|
||||
QUnit.test("emoji is cooked properly", async assert => {
|
||||
QUnit.test("emoji is cooked properly", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:");
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
`<p>this is an emoji <img src="/images/emoji/emoji_one/blonde_woman.png?v=${v}" title=":blonde_woman:" class="emoji" alt=":blonde_woman:"></p>`
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("skin toned emoji is cooked properly", async assert => {
|
||||
QUnit.test("skin toned emoji is cooked properly", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await fillIn(".d-editor-input", "this is an emoji :blonde_woman:t5:");
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
`<p>this is an emoji <img src="/images/emoji/emoji_one/blonde_woman/5.png?v=${v}" title=":blonde_woman:t5:" class="emoji" alt=":blonde_woman:t5:"></p>`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ acceptance("Encoded Sub Category Discovery", {
|
||||
);
|
||||
},
|
||||
settings: {
|
||||
slug_generation_method: "encoded"
|
||||
slug_generation_method: "encoded",
|
||||
},
|
||||
site: {
|
||||
categories: [
|
||||
@@ -28,20 +28,20 @@ acceptance("Encoded Sub Category Discovery", {
|
||||
id: 5,
|
||||
name: "漢字-parent",
|
||||
slug: "%E6%BC%A2%E5%AD%97-parent",
|
||||
permission: null
|
||||
permission: null,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "漢字-subcategory",
|
||||
slug: "%E6%BC%A2%E5%AD%97-subcategory",
|
||||
permission: null,
|
||||
parent_category_id: 5
|
||||
}
|
||||
]
|
||||
}
|
||||
parent_category_id: 5,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Visit subcategory by slug", async assert => {
|
||||
QUnit.test("Visit subcategory by slug", async (assert) => {
|
||||
let bodySelector =
|
||||
"body.category-\\%E6\\%BC\\%A2\\%E5\\%AD\\%97-parent-\\%E6\\%BC\\%A2\\%E5\\%AD\\%97-subcategory";
|
||||
await visit("/c/%E6%BC%A2%E5%AD%97-parent/%E6%BC%A2%E5%AD%97-subcategory");
|
||||
|
||||
@@ -6,13 +6,13 @@ acceptance("Enforce Second Factor", {
|
||||
server.post("/u/second_factors.json", () => {
|
||||
return helper.response({
|
||||
success: "OK",
|
||||
password_required: "true"
|
||||
password_required: "true",
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("as an admin", async function(assert) {
|
||||
QUnit.test("as an admin", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
this.siteSettings.enforce_second_factor = "staff";
|
||||
|
||||
@@ -34,7 +34,7 @@ QUnit.test("as an admin", async function(assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("as a user", async function(assert) {
|
||||
QUnit.test("as a user", async function (assert) {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
@@ -58,7 +58,7 @@ QUnit.test("as a user", async function(assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("as an anonymous user", async function(assert) {
|
||||
QUnit.test("as an anonymous user", async function (assert) {
|
||||
updateCurrentUser({ moderator: false, admin: false, is_anonymous: true });
|
||||
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
||||
@@ -7,13 +7,13 @@ acceptance("Forgot password", {
|
||||
pretend(server, helper) {
|
||||
server.post("/session/forgot_password", () => {
|
||||
return helper.response({
|
||||
user_found: userFound
|
||||
user_found: userFound,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("requesting password reset", async assert => {
|
||||
QUnit.test("requesting password reset", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
await click("#forgot-password-link");
|
||||
@@ -28,11 +28,9 @@ QUnit.test("requesting password reset", async assert => {
|
||||
await click(".forgot-password-reset");
|
||||
|
||||
assert.equal(
|
||||
find(".alert-error")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".alert-error").html().trim(),
|
||||
I18n.t("forgot_password.complete_username_not_found", {
|
||||
username: "someuser"
|
||||
username: "someuser",
|
||||
}),
|
||||
"it should display an error for an invalid username"
|
||||
);
|
||||
@@ -41,11 +39,9 @@ QUnit.test("requesting password reset", async assert => {
|
||||
await click(".forgot-password-reset");
|
||||
|
||||
assert.equal(
|
||||
find(".alert-error")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".alert-error").html().trim(),
|
||||
I18n.t("forgot_password.complete_email_not_found", {
|
||||
email: "someuser@gmail.com"
|
||||
email: "someuser@gmail.com",
|
||||
}),
|
||||
"it should display an error for an invalid email"
|
||||
);
|
||||
@@ -62,11 +58,9 @@ QUnit.test("requesting password reset", async assert => {
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".modal-body")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".modal-body").html().trim(),
|
||||
I18n.t("forgot_password.complete_username_found", {
|
||||
username: "someuser"
|
||||
username: "someuser",
|
||||
}),
|
||||
"it should display a success message for a valid username"
|
||||
);
|
||||
@@ -78,11 +72,9 @@ QUnit.test("requesting password reset", async assert => {
|
||||
await click(".forgot-password-reset");
|
||||
|
||||
assert.equal(
|
||||
find(".modal-body")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".modal-body").html().trim(),
|
||||
I18n.t("forgot_password.complete_email_found", {
|
||||
email: "someuser@gmail.com"
|
||||
email: "someuser@gmail.com",
|
||||
}),
|
||||
"it should display a success message for a valid email"
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import DiscourseURL from "discourse/lib/url";
|
||||
|
||||
acceptance("Group Card - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.skip("group card", async assert => {
|
||||
QUnit.skip("group card", async (assert) => {
|
||||
await visit("/t/-/301/1");
|
||||
assert.ok(
|
||||
invisible(".group-card"),
|
||||
|
||||
@@ -3,7 +3,7 @@ import DiscourseURL from "discourse/lib/url";
|
||||
|
||||
acceptance("Group Card");
|
||||
|
||||
QUnit.skip("group card", async assert => {
|
||||
QUnit.skip("group card", async (assert) => {
|
||||
await visit("/t/-/301/1");
|
||||
assert.ok(invisible(".group-card"), "user card is invisible by default");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Group Members");
|
||||
|
||||
QUnit.test("Viewing Members as anon user", async assert => {
|
||||
QUnit.test("Viewing Members as anon user", async (assert) => {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
@@ -26,7 +26,7 @@ QUnit.test("Viewing Members as anon user", async assert => {
|
||||
|
||||
acceptance("Group Members", { loggedIn: true });
|
||||
|
||||
QUnit.test("Viewing Members as a group owner", async assert => {
|
||||
QUnit.test("Viewing Members as a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse");
|
||||
@@ -39,7 +39,7 @@ QUnit.test("Viewing Members as a group owner", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Viewing Members as an admin user", async assert => {
|
||||
QUnit.test("Viewing Members as an admin user", async (assert) => {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Managing Group Category Notification Defaults");
|
||||
QUnit.test("As an anonymous user", async assert => {
|
||||
QUnit.test("As an anonymous user", async (assert) => {
|
||||
await visit("/g/discourse/manage/categories");
|
||||
|
||||
assert.ok(
|
||||
@@ -12,7 +12,7 @@ QUnit.test("As an anonymous user", async assert => {
|
||||
|
||||
acceptance("Managing Group Category Notification Defaults", { loggedIn: true });
|
||||
|
||||
QUnit.test("As an admin", async assert => {
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
await visit("/g/discourse/manage/categories");
|
||||
|
||||
assert.ok(
|
||||
@@ -21,7 +21,7 @@ QUnit.test("As an admin", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async assert => {
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse/manage/categories");
|
||||
|
||||
@@ -3,15 +3,15 @@ import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
acceptance("Managing Group Interaction Settings", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
email_in: true
|
||||
}
|
||||
email_in: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("As an admin", async assert => {
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
updateCurrentUser({
|
||||
moderator: false,
|
||||
admin: true,
|
||||
can_create_group: true
|
||||
can_create_group: true,
|
||||
});
|
||||
|
||||
await visit("/g/alternative-group/manage/interaction");
|
||||
@@ -47,11 +47,11 @@ QUnit.test("As an admin", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async assert => {
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({
|
||||
moderator: false,
|
||||
admin: false,
|
||||
can_create_group: false
|
||||
can_create_group: false,
|
||||
});
|
||||
|
||||
await visit("/g/discourse/manage/interaction");
|
||||
|
||||
@@ -25,13 +25,13 @@ acceptance("Group logs", {
|
||||
bio_cooked: null,
|
||||
public: true,
|
||||
is_group_user: true,
|
||||
is_group_owner: true
|
||||
}
|
||||
is_group_owner: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Workaround while awaiting https://github.com/tildeio/route-recognizer/issues/53
|
||||
server.get("/groups/snorlax/logs.json", request => {
|
||||
server.get("/groups/snorlax/logs.json", (request) => {
|
||||
if (request.queryParams["filters[action]"]) {
|
||||
return helper.response({
|
||||
logs: [
|
||||
@@ -44,12 +44,12 @@ acceptance("Group logs", {
|
||||
acting_user: {
|
||||
id: 1,
|
||||
username: "tgx",
|
||||
avatar_template: "/images/avatar.png"
|
||||
avatar_template: "/images/avatar.png",
|
||||
},
|
||||
target_user: null
|
||||
}
|
||||
target_user: null,
|
||||
},
|
||||
],
|
||||
all_loaded: true
|
||||
all_loaded: true,
|
||||
});
|
||||
} else {
|
||||
return helper.response({
|
||||
@@ -63,9 +63,9 @@ acceptance("Group logs", {
|
||||
acting_user: {
|
||||
id: 1,
|
||||
username: "tgx",
|
||||
avatar_template: "/images/avatar.png"
|
||||
avatar_template: "/images/avatar.png",
|
||||
},
|
||||
target_user: null
|
||||
target_user: null,
|
||||
},
|
||||
{
|
||||
action: "add_user_to_group",
|
||||
@@ -76,23 +76,23 @@ acceptance("Group logs", {
|
||||
acting_user: {
|
||||
id: 1,
|
||||
username: "tgx",
|
||||
avatar_template: "/images/avatar.png"
|
||||
avatar_template: "/images/avatar.png",
|
||||
},
|
||||
target_user: {
|
||||
id: 1,
|
||||
username: "tgx",
|
||||
avatar_template: "/images/avatar.png"
|
||||
}
|
||||
}
|
||||
avatar_template: "/images/avatar.png",
|
||||
},
|
||||
},
|
||||
],
|
||||
all_loaded: true
|
||||
all_loaded: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Browsing group logs", async assert => {
|
||||
QUnit.test("Browsing group logs", async (assert) => {
|
||||
await visit("/g/snorlax/manage/logs");
|
||||
assert.ok(
|
||||
find("tr.group-manage-logs-row").length === 2,
|
||||
|
||||
@@ -2,10 +2,10 @@ import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
|
||||
acceptance("Managing Group Membership", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("As an admin", async assert => {
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
updateCurrentUser({ can_create_group: true });
|
||||
|
||||
await visit("/g/alternative-group/manage/membership");
|
||||
@@ -72,7 +72,7 @@ QUnit.test("As an admin", async assert => {
|
||||
assert.equal(emailDomains.header().value(), "foo.com");
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async assert => {
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse/manage/membership");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Managing Group Profile");
|
||||
QUnit.test("As an anonymous user", async assert => {
|
||||
QUnit.test("As an anonymous user", async (assert) => {
|
||||
await visit("/g/discourse/manage/profile");
|
||||
|
||||
assert.ok(
|
||||
@@ -12,7 +12,7 @@ QUnit.test("As an anonymous user", async assert => {
|
||||
|
||||
acceptance("Managing Group Profile", { loggedIn: true });
|
||||
|
||||
QUnit.test("As an admin", async assert => {
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
await visit("/g/discourse/manage/profile");
|
||||
|
||||
assert.ok(
|
||||
@@ -33,11 +33,11 @@ QUnit.test("As an admin", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async assert => {
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({
|
||||
moderator: false,
|
||||
admin: false,
|
||||
can_create_group: false
|
||||
can_create_group: false,
|
||||
});
|
||||
|
||||
await visit("/g/discourse/manage/profile");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Managing Group Tag Notification Defaults");
|
||||
QUnit.test("As an anonymous user", async assert => {
|
||||
QUnit.test("As an anonymous user", async (assert) => {
|
||||
await visit("/g/discourse/manage/tags");
|
||||
|
||||
assert.ok(
|
||||
@@ -12,7 +12,7 @@ QUnit.test("As an anonymous user", async assert => {
|
||||
|
||||
acceptance("Managing Group Tag Notification Defaults", { loggedIn: true });
|
||||
|
||||
QUnit.test("As an admin", async assert => {
|
||||
QUnit.test("As an admin", async (assert) => {
|
||||
await visit("/g/discourse/manage/tags");
|
||||
|
||||
assert.ok(
|
||||
@@ -21,7 +21,7 @@ QUnit.test("As an admin", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async assert => {
|
||||
QUnit.test("As a group owner", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/g/discourse/manage/tags");
|
||||
|
||||
@@ -38,11 +38,11 @@ acceptance("Group Requests", {
|
||||
is_group_owner_display: true,
|
||||
can_see_members: true,
|
||||
mentionable: false,
|
||||
messageable: false
|
||||
messageable: false,
|
||||
},
|
||||
extras: {
|
||||
visible_group_names: ["discourse", "Macdonald"]
|
||||
}
|
||||
visible_group_names: ["discourse", "Macdonald"],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ acceptance("Group Requests", {
|
||||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/eviltrout/{size}/5275_2.png",
|
||||
reason: "Please accept my membership request.",
|
||||
requested_at: "2019-01-31T12:00:00.000Z"
|
||||
requested_at: "2019-01-31T12:00:00.000Z",
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
@@ -65,22 +65,22 @@ acceptance("Group Requests", {
|
||||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/eviltrout/{size}/5275_2.png",
|
||||
reason: "Please accept another membership request.",
|
||||
requested_at: "2019-01-31T14:00:00.000Z"
|
||||
}
|
||||
requested_at: "2019-01-31T14:00:00.000Z",
|
||||
},
|
||||
],
|
||||
meta: { total: 2, limit: 50, offset: 0 }
|
||||
meta: { total: 2, limit: 50, offset: 0 },
|
||||
});
|
||||
});
|
||||
|
||||
server.put("/groups/42/handle_membership_request.json", request => {
|
||||
server.put("/groups/42/handle_membership_request.json", (request) => {
|
||||
const body = parsePostData(request.requestBody);
|
||||
requests.push([body["user_id"], body["accept"]]);
|
||||
return helper.success();
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Group Requests", async assert => {
|
||||
QUnit.test("Group Requests", async (assert) => {
|
||||
await visit("/g/Macdonald/requests");
|
||||
|
||||
assert.equal(find(".group-members tr").length, 2);
|
||||
@@ -92,21 +92,15 @@ QUnit.test("Group Requests", async assert => {
|
||||
"eviltrout Robin Ward"
|
||||
);
|
||||
assert.equal(
|
||||
find(".group-members tr:first-child td:nth-child(3)")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".group-members tr:first-child td:nth-child(3)").text().trim(),
|
||||
"Please accept my membership request."
|
||||
);
|
||||
assert.equal(
|
||||
find(".group-members tr:first-child .btn-primary")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".group-members tr:first-child .btn-primary").text().trim(),
|
||||
"Accept"
|
||||
);
|
||||
assert.equal(
|
||||
find(".group-members tr:first-child .btn-danger")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".group-members tr:first-child .btn-danger").text().trim(),
|
||||
"Deny"
|
||||
);
|
||||
|
||||
@@ -121,13 +115,11 @@ QUnit.test("Group Requests", async assert => {
|
||||
|
||||
await click(".group-members tr:last-child .btn-danger");
|
||||
assert.equal(
|
||||
find(".group-members tr:last-child td:nth-child(4)")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".group-members tr:last-child td:nth-child(4)").text().trim(),
|
||||
"denied"
|
||||
);
|
||||
assert.deepEqual(requests, [
|
||||
["19", "true"],
|
||||
["20", undefined]
|
||||
["20", undefined],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -5,24 +5,24 @@ import pretender from "helpers/create-pretender";
|
||||
|
||||
let groupArgs = {
|
||||
settings: {
|
||||
enable_group_directory: true
|
||||
enable_group_directory: true,
|
||||
},
|
||||
pretend(pretenderServer, helper) {
|
||||
pretenderServer.post("/groups/Macdonald/request_membership", () => {
|
||||
return helper.response({
|
||||
relative_url: "/t/internationalization-localization/280"
|
||||
relative_url: "/t/internationalization-localization/280",
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
acceptance("Group", groupArgs);
|
||||
|
||||
const response = object => {
|
||||
const response = (object) => {
|
||||
return [200, { "Content-Type": "application/json" }, object];
|
||||
};
|
||||
|
||||
QUnit.test("Anonymous Viewing Group", async function(assert) {
|
||||
QUnit.test("Anonymous Viewing Group", async function (assert) {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.equal(
|
||||
@@ -77,7 +77,7 @@ QUnit.test("Anonymous Viewing Group", async function(assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Anonymous Viewing Automatic Group", async assert => {
|
||||
QUnit.test("Anonymous Viewing Automatic Group", async (assert) => {
|
||||
await visit("/g/moderators");
|
||||
|
||||
assert.equal(
|
||||
@@ -89,14 +89,12 @@ QUnit.test("Anonymous Viewing Automatic Group", async assert => {
|
||||
|
||||
acceptance("Group", Object.assign({ loggedIn: true }, groupArgs));
|
||||
|
||||
QUnit.test("User Viewing Group", async assert => {
|
||||
QUnit.test("User Viewing Group", async (assert) => {
|
||||
await visit("/g");
|
||||
await click(".group-index-request");
|
||||
|
||||
assert.equal(
|
||||
find(".modal-header")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".modal-header").text().trim(),
|
||||
I18n.t("groups.membership_request.title", { group_name: "Macdonald" })
|
||||
);
|
||||
|
||||
@@ -108,9 +106,7 @@ QUnit.test("User Viewing Group", async assert => {
|
||||
await click(".modal-footer .btn-primary");
|
||||
|
||||
assert.equal(
|
||||
find(".fancy-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".fancy-title").text().trim(),
|
||||
"Internationalization / localization"
|
||||
);
|
||||
|
||||
@@ -128,7 +124,7 @@ QUnit.test("User Viewing Group", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"Admin viewing group messages when there are no messages",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
pretender.get(
|
||||
"/topics/private-messages-group/eviltrout/discourse.json",
|
||||
() => {
|
||||
@@ -140,16 +136,14 @@ QUnit.test(
|
||||
await click(".nav-pills li a[title='Messages']");
|
||||
|
||||
assert.equal(
|
||||
find(".alert")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".alert").text().trim(),
|
||||
I18n.t("choose_topic.none_found"),
|
||||
"it should display the right alert"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Admin viewing group messages", async assert => {
|
||||
QUnit.test("Admin viewing group messages", async (assert) => {
|
||||
pretender.get(
|
||||
"/topics/private-messages-group/eviltrout/discourse.json",
|
||||
() => {
|
||||
@@ -159,14 +153,14 @@ QUnit.test("Admin viewing group messages", async assert => {
|
||||
id: 2,
|
||||
username: "bruce1",
|
||||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/bruce1/{size}/5245.png"
|
||||
"/user_avatar/meta.discourse.org/bruce1/{size}/5245.png",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
username: "CodingHorror",
|
||||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/codinghorror/{size}/5245.png"
|
||||
}
|
||||
"/user_avatar/meta.discourse.org/codinghorror/{size}/5245.png",
|
||||
},
|
||||
],
|
||||
primary_groups: [],
|
||||
topic_list: {
|
||||
@@ -210,26 +204,26 @@ QUnit.test("Admin viewing group messages", async assert => {
|
||||
extras: "latest single",
|
||||
description: "Original Poster, Most Recent Poster",
|
||||
user_id: 2,
|
||||
primary_group_id: null
|
||||
}
|
||||
primary_group_id: null,
|
||||
},
|
||||
],
|
||||
participants: [
|
||||
{
|
||||
extras: "latest",
|
||||
description: null,
|
||||
user_id: 2,
|
||||
primary_group_id: null
|
||||
primary_group_id: null,
|
||||
},
|
||||
{
|
||||
extras: null,
|
||||
description: null,
|
||||
user_id: 3,
|
||||
primary_group_id: null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
primary_group_id: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -238,15 +232,13 @@ QUnit.test("Admin viewing group messages", async assert => {
|
||||
await click(".nav-pills li a[title='Messages']");
|
||||
|
||||
assert.equal(
|
||||
find(".topic-list-item .link-top-line")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".topic-list-item .link-top-line").text().trim(),
|
||||
"This is a private message 1",
|
||||
"it should display the list of group topics"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Admin Viewing Group", async assert => {
|
||||
QUnit.test("Admin Viewing Group", async (assert) => {
|
||||
await visit("/g/discourse");
|
||||
|
||||
assert.ok(
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Groups");
|
||||
|
||||
QUnit.test("Browsing Groups", async assert => {
|
||||
QUnit.test("Browsing Groups", async (assert) => {
|
||||
await visit("/g?username=eviltrout");
|
||||
|
||||
assert.equal(count(".group-box"), 1, "it displays user's groups");
|
||||
@@ -36,9 +36,7 @@ QUnit.test("Browsing Groups", async assert => {
|
||||
await click("a[href='/g/discourse/members']");
|
||||
|
||||
assert.equal(
|
||||
find(".group-info-name")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".group-info-name").text().trim(),
|
||||
"Awesome Team",
|
||||
"it displays the group page"
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Group");
|
||||
|
||||
QUnit.test("As an anon user", async assert => {
|
||||
QUnit.test("As an anon user", async (assert) => {
|
||||
await visit("/g");
|
||||
|
||||
assert.equal(
|
||||
@@ -15,7 +15,7 @@ QUnit.test("As an anon user", async assert => {
|
||||
|
||||
acceptance("New Group", { loggedIn: true });
|
||||
|
||||
QUnit.test("Creating a new group", async assert => {
|
||||
QUnit.test("Creating a new group", async (assert) => {
|
||||
await visit("/g");
|
||||
await click(".groups-header-new");
|
||||
|
||||
@@ -28,9 +28,7 @@ QUnit.test("Creating a new group", async assert => {
|
||||
await fillIn("input[name='name']", "1");
|
||||
|
||||
assert.equal(
|
||||
find(".tip.bad")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".tip.bad").text().trim(),
|
||||
I18n.t("admin.groups.new.name.too_short"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
@@ -46,9 +44,7 @@ QUnit.test("Creating a new group", async assert => {
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".tip.bad")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".tip.bad").text().trim(),
|
||||
I18n.t("admin.groups.new.name.too_long"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
@@ -56,9 +52,7 @@ QUnit.test("Creating a new group", async assert => {
|
||||
await fillIn("input[name='name']", "");
|
||||
|
||||
assert.equal(
|
||||
find(".tip.bad")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".tip.bad").text().trim(),
|
||||
I18n.t("admin.groups.new.name.blank"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
@@ -66,9 +60,7 @@ QUnit.test("Creating a new group", async assert => {
|
||||
await fillIn("input[name='name']", "goodusername");
|
||||
|
||||
assert.equal(
|
||||
find(".tip.good")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".tip.good").text().trim(),
|
||||
I18n.t("admin.groups.new.name.available"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
|
||||
@@ -4,10 +4,10 @@ acceptance("Opening the hamburger menu with some reviewables", {
|
||||
loggedIn: true,
|
||||
pretend: (server, helper) => {
|
||||
server.get("/review/count.json", () => helper.response({ count: 3 }));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("As a staff member", async assert => {
|
||||
QUnit.test("As a staff member", async (assert) => {
|
||||
updateCurrentUser({ moderator: true, admin: false });
|
||||
|
||||
await visit("/");
|
||||
|
||||
@@ -9,14 +9,14 @@ acceptance("Category and Tag Hashtags", {
|
||||
categories: { bug: "/c/bugs" },
|
||||
tags: {
|
||||
monkey: "/tag/monkey",
|
||||
bug: "/tag/bug"
|
||||
}
|
||||
bug: "/tag/bug",
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("hashtags are cooked properly", async assert => {
|
||||
QUnit.test("hashtags are cooked properly", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
@@ -30,9 +30,7 @@ category vs tag: #bug vs #bug::tag`
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".d-editor-preview:visible").html().trim(),
|
||||
`<p>this is a category hashtag <a href="/c/bugs" class="hashtag">#<span>bug</span></a></p>
|
||||
<p>this is a tag hashtag <a href="/tag/monkey" class="hashtag">#<span>monkey</span></a></p>
|
||||
<p>category vs tag: <a href="/c/bugs" class="hashtag">#<span>bug</span></a> vs <a href="/tag/bug" class="hashtag">#<span>bug</span></a></p>`
|
||||
|
||||
@@ -3,22 +3,22 @@ import PreloadStore from "discourse/lib/preload-store";
|
||||
|
||||
acceptance("Invite Accept", {
|
||||
settings: {
|
||||
full_name_required: true
|
||||
}
|
||||
full_name_required: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Invite Acceptance Page", async assert => {
|
||||
QUnit.test("Invite Acceptance Page", async (assert) => {
|
||||
PreloadStore.store("invite_info", {
|
||||
invited_by: {
|
||||
id: 123,
|
||||
username: "neil",
|
||||
avatar_template: "/user_avatar/localhost/neil/{size}/25_1.png",
|
||||
name: "Neil Lalonde",
|
||||
title: "team"
|
||||
title: "team",
|
||||
},
|
||||
email: null,
|
||||
username: "invited",
|
||||
is_invite_link: true
|
||||
is_invite_link: true,
|
||||
});
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
|
||||
@@ -8,36 +8,36 @@ acceptance("Accept Invite - User Fields", {
|
||||
id: 34,
|
||||
name: "I've read the terms of service",
|
||||
field_type: "confirm",
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 35,
|
||||
name: "What is your pet's name?",
|
||||
field_type: "text",
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 36,
|
||||
name: "What's your dad like?",
|
||||
field_type: "text",
|
||||
required: false
|
||||
}
|
||||
]
|
||||
}
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("accept invite with user fields", async assert => {
|
||||
QUnit.test("accept invite with user fields", async (assert) => {
|
||||
PreloadStore.store("invite_info", {
|
||||
invited_by: {
|
||||
id: 123,
|
||||
username: "neil",
|
||||
avatar_template: "/user_avatar/localhost/neil/{size}/25_1.png",
|
||||
name: "Neil Lalonde",
|
||||
title: "team"
|
||||
title: "team",
|
||||
},
|
||||
email: "invited@asdf.com",
|
||||
username: "invited",
|
||||
is_invite_link: false
|
||||
is_invite_link: false,
|
||||
});
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
|
||||
@@ -8,19 +8,19 @@ acceptance("Jump to", {
|
||||
pretend(server, helper) {
|
||||
server.get("/t/280/excerpts.json", () => helper.response(200, []));
|
||||
server.get("/t/280/3.json", () => helper.response(200, {}));
|
||||
server.get("/posts/by-date/280/:date", req => {
|
||||
server.get("/posts/by-date/280/:date", (req) => {
|
||||
if (req.params["date"] === "2014-02-24") {
|
||||
return helper.response(200, {
|
||||
post_number: 3
|
||||
post_number: 3,
|
||||
});
|
||||
}
|
||||
|
||||
return helper.response(404, null);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("default", async assert => {
|
||||
QUnit.test("default", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("nav#topic-progress .nums");
|
||||
await click("button.jump-to-post");
|
||||
@@ -37,7 +37,7 @@ QUnit.test("default", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("invalid date", async assert => {
|
||||
QUnit.test("invalid date", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("nav#topic-progress .nums");
|
||||
await click("button.jump-to-post");
|
||||
|
||||
@@ -3,17 +3,17 @@ import pretender from "helpers/create-pretender";
|
||||
|
||||
acceptance("Keyboard Shortcuts", { loggedIn: true });
|
||||
|
||||
test("go to first suggested topic", async assert => {
|
||||
test("go to first suggested topic", async (assert) => {
|
||||
pretender.get("/t/27331/4.json", () => [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{}
|
||||
{},
|
||||
]);
|
||||
|
||||
pretender.get("/t/27331.json", () => [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{}
|
||||
{},
|
||||
]);
|
||||
|
||||
/*
|
||||
@@ -23,7 +23,7 @@ test("go to first suggested topic", async assert => {
|
||||
pretender.get("/t/9/last.json", () => [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{}
|
||||
{},
|
||||
]);
|
||||
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
@@ -51,10 +51,10 @@ test("go to first suggested topic", async assert => {
|
||||
suggested_topics: [
|
||||
{
|
||||
id: 27331,
|
||||
slug: "keyboard-shortcuts-are-awesome"
|
||||
}
|
||||
]
|
||||
}
|
||||
slug: "keyboard-shortcuts-are-awesome",
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
await visit("/t/1-3-0beta9-no-rate-limit-popups/28830");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login redirect");
|
||||
QUnit.test("redirects login to default homepage", async function(assert) {
|
||||
QUnit.test("redirects login to default homepage", async function (assert) {
|
||||
await visit("/login");
|
||||
assert.equal(
|
||||
currentPath(),
|
||||
@@ -12,11 +12,11 @@ QUnit.test("redirects login to default homepage", async function(assert) {
|
||||
|
||||
acceptance("Login redirect - categories default", {
|
||||
settings: {
|
||||
top_menu: "categories|latest|top|hot"
|
||||
}
|
||||
top_menu: "categories|latest|top|hot",
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("when site setting is categories", async function(assert) {
|
||||
QUnit.test("when site setting is categories", async function (assert) {
|
||||
await visit("/login");
|
||||
assert.equal(
|
||||
currentPath(),
|
||||
|
||||
@@ -2,11 +2,11 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login Required", {
|
||||
settings: {
|
||||
login_required: true
|
||||
}
|
||||
login_required: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("redirect", async assert => {
|
||||
QUnit.test("redirect", async (assert) => {
|
||||
await visit("/latest");
|
||||
assert.equal(currentPath(), "login", "it redirects them to login");
|
||||
|
||||
|
||||
@@ -5,31 +5,29 @@ import pretender from "helpers/create-pretender";
|
||||
acceptance("Login with email - hide email address taken", {
|
||||
settings: {
|
||||
enable_local_logins_via_email: true,
|
||||
hide_email_address_taken: true
|
||||
hide_email_address_taken: true,
|
||||
},
|
||||
beforeEach() {
|
||||
const response = object => {
|
||||
const response = (object) => {
|
||||
return [200, { "Content-Type": "application/json" }, object];
|
||||
};
|
||||
|
||||
pretender.post("/u/email-login", () => {
|
||||
return response({ success: "OK" });
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("with hide_email_address_taken enabled", async assert => {
|
||||
QUnit.test("with hide_email_address_taken enabled", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
await fillIn("#login-account-name", "someuser@example.com");
|
||||
await click(".login-with-email-button");
|
||||
|
||||
assert.equal(
|
||||
find(".alert-success")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".alert-success").html().trim(),
|
||||
I18n.t("email_login.complete_email_found", {
|
||||
email: "someuser@example.com"
|
||||
email: "someuser@example.com",
|
||||
}),
|
||||
"it should display the success message for any email address"
|
||||
);
|
||||
|
||||
@@ -2,21 +2,21 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login with email - no social logins", {
|
||||
settings: {
|
||||
enable_local_logins_via_email: true
|
||||
enable_local_logins_via_email: true,
|
||||
},
|
||||
pretend(server, helper) {
|
||||
server.post("/u/email-login", () => helper.response({ success: "OK" }));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("with login with email enabled", async assert => {
|
||||
QUnit.test("with login with email enabled", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
assert.ok(exists(".login-with-email-button"));
|
||||
});
|
||||
|
||||
QUnit.test("with login with email disabled", async assert => {
|
||||
QUnit.test("with login with email disabled", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Login with email disabled", {
|
||||
settings: {
|
||||
enable_local_logins_via_email: false,
|
||||
enable_facebook_logins: true
|
||||
}
|
||||
enable_facebook_logins: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("with email button", async assert => {
|
||||
QUnit.test("with email button", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
|
||||
@@ -6,16 +6,16 @@ let userFound = false;
|
||||
acceptance("Login with email", {
|
||||
settings: {
|
||||
enable_local_logins_via_email: true,
|
||||
enable_facebook_logins: true
|
||||
enable_facebook_logins: true,
|
||||
},
|
||||
pretend(server, helper) {
|
||||
server.post("/u/email-login", () =>
|
||||
helper.response({ success: "OK", user_found: userFound })
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("with email button", async assert => {
|
||||
QUnit.test("with email button", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
@@ -35,7 +35,7 @@ QUnit.test("with email button", async assert => {
|
||||
assert.equal(
|
||||
find(".alert-error").html(),
|
||||
I18n.t("email_login.complete_username_not_found", {
|
||||
username: "someuser"
|
||||
username: "someuser",
|
||||
}),
|
||||
"it should display an error for an invalid username"
|
||||
);
|
||||
@@ -46,7 +46,7 @@ QUnit.test("with email button", async assert => {
|
||||
assert.equal(
|
||||
find(".alert-error").html(),
|
||||
I18n.t("email_login.complete_email_not_found", {
|
||||
email: "someuser@gmail.com"
|
||||
email: "someuser@gmail.com",
|
||||
}),
|
||||
"it should display an error for an invalid email"
|
||||
);
|
||||
@@ -58,9 +58,7 @@ QUnit.test("with email button", async assert => {
|
||||
await click(".login-with-email-button");
|
||||
|
||||
assert.equal(
|
||||
find(".alert-success")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".alert-success").html().trim(),
|
||||
I18n.t("email_login.complete_username_found", { username: "someuser" }),
|
||||
"it should display a success message for a valid username"
|
||||
);
|
||||
@@ -71,11 +69,9 @@ QUnit.test("with email button", async assert => {
|
||||
await click(".login-with-email-button");
|
||||
|
||||
assert.equal(
|
||||
find(".alert-success")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".alert-success").html().trim(),
|
||||
I18n.t("email_login.complete_email_found", {
|
||||
email: "someuser@gmail.com"
|
||||
email: "someuser@gmail.com",
|
||||
}),
|
||||
"it should display a success message for a valid email"
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Topic Discovery - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("Visit Discovery Pages", async assert => {
|
||||
QUnit.test("Visit Discovery Pages", async (assert) => {
|
||||
await visit("/");
|
||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Signing In - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("sign in", async assert => {
|
||||
QUnit.test("sign in", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
assert.ok(exists("#login-form"), "it shows the login modal");
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("User Directory - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("Visit Page", async assert => {
|
||||
QUnit.test("Visit Page", async (assert) => {
|
||||
await visit("/u");
|
||||
assert.ok(exists(".directory .user"), "has a list of users");
|
||||
});
|
||||
|
||||
@@ -10,18 +10,18 @@ acceptance("Modal", {
|
||||
I18n.translations = {
|
||||
en: {
|
||||
js: {
|
||||
test_title: "Test title"
|
||||
}
|
||||
}
|
||||
test_title: "Test title",
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
I18n.translations = this._translations;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.skip("modal", async function(assert) {
|
||||
QUnit.skip("modal", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
assert.ok(
|
||||
@@ -71,26 +71,24 @@ QUnit.skip("modal", async function(assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("rawTitle in modal panels", async function(assert) {
|
||||
QUnit.test("rawTitle in modal panels", async function (assert) {
|
||||
Ember.TEMPLATES["modal/test-raw-title-panels"] = Ember.HTMLBars.compile("");
|
||||
const panels = [
|
||||
{ id: "test1", rawTitle: "Test 1" },
|
||||
{ id: "test2", rawTitle: "Test 2" }
|
||||
{ id: "test2", rawTitle: "Test 2" },
|
||||
];
|
||||
|
||||
await visit("/");
|
||||
run(() => showModal("test-raw-title-panels", { panels }));
|
||||
|
||||
assert.equal(
|
||||
find(".d-modal .modal-tab:first-child")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".d-modal .modal-tab:first-child").text().trim(),
|
||||
"Test 1",
|
||||
"it should display the raw title"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("modal title", async function(assert) {
|
||||
QUnit.test("modal title", async function (assert) {
|
||||
Ember.TEMPLATES["modal/test-title"] = Ember.HTMLBars.compile("");
|
||||
Ember.TEMPLATES["modal/test-title-with-body"] = Ember.HTMLBars.compile(
|
||||
"{{#d-modal-body}}test{{/d-modal-body}}"
|
||||
@@ -100,9 +98,7 @@ QUnit.test("modal title", async function(assert) {
|
||||
|
||||
run(() => showModal("test-title", { title: "test_title" }));
|
||||
assert.equal(
|
||||
find(".d-modal .title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".d-modal .title").text().trim(),
|
||||
"Test title",
|
||||
"it should display the title"
|
||||
);
|
||||
@@ -111,9 +107,7 @@ QUnit.test("modal title", async function(assert) {
|
||||
|
||||
run(() => showModal("test-title-with-body", { title: "test_title" }));
|
||||
assert.equal(
|
||||
find(".d-modal .title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".d-modal .title").text().trim(),
|
||||
"Test title",
|
||||
"it should display the title when used with d-modal-body"
|
||||
);
|
||||
@@ -129,7 +123,7 @@ QUnit.test("modal title", async function(assert) {
|
||||
|
||||
acceptance("Modal Keyboard Events", { loggedIn: true });
|
||||
|
||||
QUnit.test("modal-keyboard-events", async function(assert) {
|
||||
QUnit.test("modal-keyboard-events", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Message");
|
||||
|
||||
QUnit.test("accessing new-message route when logged out", async assert => {
|
||||
QUnit.test("accessing new-message route when logged out", async (assert) => {
|
||||
await visit(
|
||||
"/new-message?username=charlie&title=message%20title&body=message%20body"
|
||||
);
|
||||
@@ -11,30 +11,24 @@ QUnit.test("accessing new-message route when logged out", async assert => {
|
||||
});
|
||||
|
||||
acceptance("New Message", { loggedIn: true });
|
||||
QUnit.test("accessing new-message route when logged in", async assert => {
|
||||
QUnit.test("accessing new-message route when logged in", async (assert) => {
|
||||
await visit(
|
||||
"/new-message?username=charlie&title=message%20title&body=message%20body"
|
||||
);
|
||||
|
||||
assert.ok(exists(".composer-fields"), "it opens composer");
|
||||
assert.equal(
|
||||
find("#reply-title")
|
||||
.val()
|
||||
.trim(),
|
||||
find("#reply-title").val().trim(),
|
||||
"message title",
|
||||
"it pre-fills message title"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
find(".d-editor-input").val().trim(),
|
||||
"message body",
|
||||
"it pre-fills message body"
|
||||
);
|
||||
assert.equal(
|
||||
find(".users-input .item:eq(0)")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".users-input .item:eq(0)").text().trim(),
|
||||
"charlie",
|
||||
"it selects correct username"
|
||||
);
|
||||
|
||||
@@ -3,35 +3,29 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Topic");
|
||||
|
||||
QUnit.test("accessing new-topic route when logged out", async assert => {
|
||||
QUnit.test("accessing new-topic route when logged out", async (assert) => {
|
||||
await visit("/new-topic?title=topic%20title&body=topic%20body");
|
||||
|
||||
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
||||
});
|
||||
|
||||
acceptance("New Topic", { loggedIn: true });
|
||||
QUnit.test("accessing new-topic route when logged in", async assert => {
|
||||
QUnit.test("accessing new-topic route when logged in", async (assert) => {
|
||||
await visit("/new-topic?title=topic%20title&body=topic%20body&category=bug");
|
||||
|
||||
assert.ok(exists(".composer-fields"), "it opens composer");
|
||||
assert.equal(
|
||||
find("#reply-title")
|
||||
.val()
|
||||
.trim(),
|
||||
find("#reply-title").val().trim(),
|
||||
"topic title",
|
||||
"it pre-fills topic title"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
find(".d-editor-input").val().trim(),
|
||||
"topic body",
|
||||
"it pre-fills topic body"
|
||||
);
|
||||
assert.equal(
|
||||
selectKit(".category-chooser")
|
||||
.header()
|
||||
.value(),
|
||||
selectKit(".category-chooser").header().value(),
|
||||
1,
|
||||
"it selects desired category"
|
||||
);
|
||||
|
||||
@@ -2,16 +2,16 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
|
||||
acceptance("NotificationsFilter", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
test("Notifications filter true", async assert => {
|
||||
test("Notifications filter true", async (assert) => {
|
||||
await visit("/u/eviltrout/notifications");
|
||||
|
||||
assert.ok(find(".large-notification").length >= 0);
|
||||
});
|
||||
|
||||
test("Notifications filter read", async assert => {
|
||||
test("Notifications filter read", async (assert) => {
|
||||
await visit("/u/eviltrout/notifications");
|
||||
|
||||
const dropdown = selectKit(".notifications-filter");
|
||||
@@ -21,7 +21,7 @@ test("Notifications filter read", async assert => {
|
||||
assert.ok(find(".large-notification").length >= 0);
|
||||
});
|
||||
|
||||
test("Notifications filter unread", async assert => {
|
||||
test("Notifications filter unread", async (assert) => {
|
||||
await visit("/u/eviltrout/notifications");
|
||||
|
||||
const dropdown = selectKit(".notifications-filter");
|
||||
|
||||
@@ -11,18 +11,18 @@ acceptance("Page Publishing", {
|
||||
server.get("/pub/by-topic/280", () => {
|
||||
return helper.response({});
|
||||
});
|
||||
server.get("/pub/check-slug", req => {
|
||||
server.get("/pub/check-slug", (req) => {
|
||||
if (req.queryParams.slug === "internationalization-localization") {
|
||||
return validSlug;
|
||||
}
|
||||
return helper.response({
|
||||
valid_slug: false,
|
||||
reason: "i don't need a reason"
|
||||
reason: "i don't need a reason",
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
QUnit.test("can publish a page via modal", async assert => {
|
||||
QUnit.test("can publish a page via modal", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.show-more-actions");
|
||||
await click(".topic-post:eq(0) button.show-post-admin-menu");
|
||||
|
||||
@@ -13,22 +13,22 @@ acceptance("Password Reset", {
|
||||
helper.response(200, { success: "OK" })
|
||||
);
|
||||
|
||||
server.put("/u/password-reset/myvalidtoken.json", request => {
|
||||
server.put("/u/password-reset/myvalidtoken.json", (request) => {
|
||||
const body = parsePostData(request.requestBody);
|
||||
if (body.password === "jonesyAlienSlayer") {
|
||||
return helper.response(200, {
|
||||
success: false,
|
||||
errors: { password: ["is the name of your cat"] }
|
||||
errors: { password: ["is the name of your cat"] },
|
||||
});
|
||||
} else {
|
||||
return helper.response(200, {
|
||||
success: "OK",
|
||||
message: I18n.t("password_reset.success")
|
||||
message: I18n.t("password_reset.success"),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
server.put("/u/password-reset/requiretwofactor.json", request => {
|
||||
server.put("/u/password-reset/requiretwofactor.json", (request) => {
|
||||
const body = parsePostData(request.requestBody);
|
||||
if (
|
||||
body.password === "perf3ctly5ecur3" &&
|
||||
@@ -36,25 +36,25 @@ acceptance("Password Reset", {
|
||||
) {
|
||||
return helper.response(200, {
|
||||
success: "OK",
|
||||
message: I18n.t("password_reset.success")
|
||||
message: I18n.t("password_reset.success"),
|
||||
});
|
||||
} else if (body.second_factor_token === "123123") {
|
||||
return helper.response(200, {
|
||||
success: false,
|
||||
errors: { password: ["invalid"] }
|
||||
errors: { password: ["invalid"] },
|
||||
});
|
||||
} else {
|
||||
return helper.response(200, {
|
||||
success: false,
|
||||
message: "invalid token",
|
||||
errors: { user_second_factors: ["invalid token"] }
|
||||
errors: { user_second_factors: ["invalid token"] },
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Password Reset Page", async assert => {
|
||||
QUnit.test("Password Reset Page", async (assert) => {
|
||||
PreloadStore.store("password_reset", { is_developer: false });
|
||||
|
||||
await visit("/u/password-reset/myvalidtoken");
|
||||
@@ -76,9 +76,8 @@ QUnit.test("Password Reset Page", async assert => {
|
||||
await click(".password-reset form button");
|
||||
assert.ok(exists(".password-reset .tip.bad"), "input is not valid");
|
||||
assert.ok(
|
||||
find(".password-reset .tip.bad")
|
||||
.html()
|
||||
.indexOf("is the name of your cat") > -1,
|
||||
find(".password-reset .tip.bad").html().indexOf("is the name of your cat") >
|
||||
-1,
|
||||
"server validation error message shows"
|
||||
);
|
||||
|
||||
@@ -87,10 +86,10 @@ QUnit.test("Password Reset Page", async assert => {
|
||||
assert.ok(!exists(".password-reset form"), "form is gone");
|
||||
});
|
||||
|
||||
QUnit.test("Password Reset Page With Second Factor", async assert => {
|
||||
QUnit.test("Password Reset Page With Second Factor", async (assert) => {
|
||||
PreloadStore.store("password_reset", {
|
||||
is_developer: false,
|
||||
second_factor_required: true
|
||||
second_factor_required: true,
|
||||
});
|
||||
|
||||
await visit("/u/password-reset/requiretwofactor");
|
||||
@@ -104,9 +103,7 @@ QUnit.test("Password Reset Page With Second Factor", async assert => {
|
||||
assert.ok(exists(".alert-error"), "shows 2 factor error");
|
||||
|
||||
assert.ok(
|
||||
find(".alert-error")
|
||||
.html()
|
||||
.indexOf("invalid token") > -1,
|
||||
find(".alert-error").html().indexOf("invalid token") > -1,
|
||||
"shows server validation error message"
|
||||
);
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ import I18n from "I18n";
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Personal Message", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("footer edit button", async assert => {
|
||||
QUnit.test("footer edit button", async (assert) => {
|
||||
await visit("/t/pm-for-testing/12");
|
||||
|
||||
assert.ok(
|
||||
@@ -14,13 +14,11 @@ QUnit.test("footer edit button", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("suggested messages", async assert => {
|
||||
QUnit.test("suggested messages", async (assert) => {
|
||||
await visit("/t/pm-for-testing/12");
|
||||
|
||||
assert.equal(
|
||||
find("#suggested-topics .suggested-topics-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find("#suggested-topics .suggested-topics-title").text().trim(),
|
||||
I18n.t("suggested_topics.pm_title")
|
||||
);
|
||||
});
|
||||
|
||||
@@ -7,11 +7,11 @@ acceptance("Plugin Keyboard Shortcuts - Logged In", {
|
||||
loggedIn: true,
|
||||
beforeEach() {
|
||||
KeyboardShortcutInitializer.initialize(this.container);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
test("a plugin can add a keyboard shortcut", async assert => {
|
||||
withPluginApi("0.8.38", api => {
|
||||
test("a plugin can add a keyboard shortcut", async (assert) => {
|
||||
withPluginApi("0.8.38", (api) => {
|
||||
api.addKeyboardShortcut("]", () => {
|
||||
$("#qunit-fixture").html(
|
||||
"<div id='added-element'>Test adding plugin shortcut</div>"
|
||||
@@ -32,15 +32,15 @@ acceptance("Plugin Keyboard Shortcuts - Anonymous", {
|
||||
loggedIn: false,
|
||||
beforeEach() {
|
||||
KeyboardShortcutInitializer.initialize(this.container);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
test("a plugin can add a keyboard shortcut with an option", async assert => {
|
||||
test("a plugin can add a keyboard shortcut with an option", async (assert) => {
|
||||
let spy = sandbox.spy(KeyboardShortcuts, "_bindToPath");
|
||||
withPluginApi("0.8.38", api => {
|
||||
withPluginApi("0.8.38", (api) => {
|
||||
api.addKeyboardShortcut("]", () => {}, {
|
||||
anonymous: true,
|
||||
path: "test-path"
|
||||
path: "test-path",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ acceptance("Plugin Outlet - Connector Class", {
|
||||
actions: {
|
||||
sayHello() {
|
||||
this.set("hello", "hello!");
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
extraConnectorClass("user-profile-primary/hi", {
|
||||
@@ -30,13 +30,13 @@ acceptance("Plugin Outlet - Connector Class", {
|
||||
@action
|
||||
sayHi() {
|
||||
this.appEvents.trigger("hi:sayHi");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
extraConnectorClass("user-profile-primary/dont-render", {
|
||||
shouldRender(args) {
|
||||
return args.model.get("username") !== "eviltrout";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Ember.TEMPLATES[
|
||||
@@ -61,10 +61,10 @@ acceptance("Plugin Outlet - Connector Class", {
|
||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`];
|
||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hi`];
|
||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders a template into the outlet", async assert => {
|
||||
QUnit.test("Renders a template into the outlet", async (assert) => {
|
||||
await visit("/u/eviltrout");
|
||||
assert.ok(
|
||||
find(".user-profile-primary-outlet.hello").length === 1,
|
||||
|
||||
@@ -13,7 +13,7 @@ acceptance("Plugin Outlet - Decorator", {
|
||||
`${PREFIX}/discovery-list-container-top/bar`
|
||||
] = Ember.HTMLBars.compile("BAR");
|
||||
|
||||
withPluginApi("0.8.38", api => {
|
||||
withPluginApi("0.8.38", (api) => {
|
||||
api.decoratePluginOutlet(
|
||||
"discovery-list-container-top",
|
||||
(elem, args) => {
|
||||
@@ -35,12 +35,12 @@ acceptance("Plugin Outlet - Decorator", {
|
||||
afterEach() {
|
||||
delete Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/foo`];
|
||||
delete Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/bar`];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"Calls the plugin callback with the rendered outlet",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
const fooConnector = find(".discovery-list-container-top-outlet.foo ")[0];
|
||||
|
||||
@@ -20,10 +20,10 @@ acceptance("Plugin Outlet - Multi Template", {
|
||||
delete Ember.TEMPLATES[HELLO];
|
||||
delete Ember.TEMPLATES[GOODBYE];
|
||||
clearCache();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders a template into the outlet", async assert => {
|
||||
QUnit.test("Renders a template into the outlet", async (assert) => {
|
||||
await visit("/u/eviltrout");
|
||||
assert.ok(
|
||||
find(".user-profile-primary-outlet.hello").length === 1,
|
||||
|
||||
@@ -11,10 +11,10 @@ acceptance("Plugin Outlet - Single Template", {
|
||||
|
||||
afterEach() {
|
||||
delete Ember.TEMPLATES[CONNECTOR];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders a template into the outlet", async assert => {
|
||||
QUnit.test("Renders a template into the outlet", async (assert) => {
|
||||
await visit("/u/eviltrout");
|
||||
assert.ok(
|
||||
find(".user-profile-primary-outlet.hello").length === 1,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Post - Admin Menu Anonymous Users", { loggedIn: false });
|
||||
|
||||
QUnit.test("Enter as a anon user", async assert => {
|
||||
QUnit.test("Enter as a anon user", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".show-more-actions");
|
||||
|
||||
@@ -19,14 +19,17 @@ QUnit.test("Enter as a anon user", async assert => {
|
||||
|
||||
acceptance("Post - Admin Menu", { loggedIn: true });
|
||||
|
||||
QUnit.test("Enter as a user with group moderator permissions", async assert => {
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
await click(".show-more-actions");
|
||||
await click(".show-post-admin-menu");
|
||||
QUnit.test(
|
||||
"Enter as a user with group moderator permissions",
|
||||
async (assert) => {
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
await click(".show-more-actions");
|
||||
await click(".show-post-admin-menu");
|
||||
|
||||
assert.ok(
|
||||
exists("#post_1 .post-controls .edit"),
|
||||
"The edit button was rendered"
|
||||
);
|
||||
assert.ok(exists(".add-notice"), "The add notice button was rendered");
|
||||
});
|
||||
assert.ok(
|
||||
exists("#post_1 .post-controls .edit"),
|
||||
"The edit button was rendered"
|
||||
);
|
||||
assert.ok(exists(".add-notice"), "The add notice button was rendered");
|
||||
}
|
||||
);
|
||||
|
||||
@@ -7,14 +7,14 @@ function preferencesPretender(server, helper) {
|
||||
server.post("/u/second_factors.json", () => {
|
||||
return helper.response({
|
||||
success: "OK",
|
||||
password_required: "true"
|
||||
password_required: "true",
|
||||
});
|
||||
});
|
||||
|
||||
server.post("/u/create_second_factor_totp.json", () => {
|
||||
return helper.response({
|
||||
key: "rcyryaqage3jexfj",
|
||||
qr: '<div id="test-qr">qr-code</div>'
|
||||
qr: '<div id="test-qr">qr-code</div>',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ function preferencesPretender(server, helper) {
|
||||
challenge: "a6d393d12654c130b2273e68ca25ca232d1d7f4c2464c2610fb8710a89d4",
|
||||
rp_id: "localhost",
|
||||
rp_name: "Discourse",
|
||||
supported_algorithms: [-7, -257]
|
||||
supported_algorithms: [-7, -257],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,26 +33,26 @@ function preferencesPretender(server, helper) {
|
||||
|
||||
server.put("/u/second_factors_backup.json", () => {
|
||||
return helper.response({
|
||||
backup_codes: ["dsffdsd", "fdfdfdsf", "fddsds"]
|
||||
backup_codes: ["dsffdsd", "fdfdfdsf", "fddsds"],
|
||||
});
|
||||
});
|
||||
|
||||
server.post("/u/eviltrout/preferences/revoke-account", () => {
|
||||
return helper.response({
|
||||
success: true
|
||||
success: true,
|
||||
});
|
||||
});
|
||||
|
||||
server.put("/u/eviltrout/preferences/email", () => {
|
||||
return helper.response({
|
||||
success: true
|
||||
success: true,
|
||||
});
|
||||
});
|
||||
|
||||
server.post("/user_avatar/eviltrout/refresh_gravatar.json", () => {
|
||||
return helper.response({
|
||||
gravatar_upload_id: 6543,
|
||||
gravatar_avatar_template: "/images/avatar.png"
|
||||
gravatar_avatar_template: "/images/avatar.png",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -63,10 +63,10 @@ function preferencesPretender(server, helper) {
|
||||
|
||||
acceptance("User Preferences", {
|
||||
loggedIn: true,
|
||||
pretend: preferencesPretender
|
||||
pretend: preferencesPretender,
|
||||
});
|
||||
|
||||
QUnit.test("update some fields", async assert => {
|
||||
QUnit.test("update some fields", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
assert.ok($("body.user-preferences-page").length, "has the body class");
|
||||
@@ -121,12 +121,12 @@ QUnit.test("update some fields", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("username", async assert => {
|
||||
QUnit.test("username", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/username");
|
||||
assert.ok(exists("#change_username"), "it has the input element");
|
||||
});
|
||||
|
||||
QUnit.test("email", async assert => {
|
||||
QUnit.test("email", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
@@ -134,15 +134,13 @@ QUnit.test("email", async assert => {
|
||||
await fillIn("#change-email", "invalidemail");
|
||||
|
||||
assert.equal(
|
||||
find(".tip.bad")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".tip.bad").text().trim(),
|
||||
I18n.t("user.email.invalid"),
|
||||
"it should display invalid email tip"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("email field always shows up", async assert => {
|
||||
QUnit.test("email field always shows up", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/email");
|
||||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
@@ -156,7 +154,7 @@ QUnit.test("email field always shows up", async assert => {
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
});
|
||||
|
||||
QUnit.test("connected accounts", async assert => {
|
||||
QUnit.test("connected accounts", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/account");
|
||||
|
||||
assert.ok(
|
||||
@@ -177,7 +175,7 @@ QUnit.test("connected accounts", async assert => {
|
||||
.indexOf("Connect") > -1;
|
||||
});
|
||||
|
||||
QUnit.test("second factor totp", async assert => {
|
||||
QUnit.test("second factor totp", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
||||
assert.ok(exists("#password"), "it has a password input");
|
||||
@@ -192,14 +190,12 @@ QUnit.test("second factor totp", async assert => {
|
||||
await click(".add-totp");
|
||||
|
||||
assert.ok(
|
||||
find(".alert-error")
|
||||
.html()
|
||||
.indexOf("provide a name and the code") > -1,
|
||||
find(".alert-error").html().indexOf("provide a name and the code") > -1,
|
||||
"shows name/token missing error message"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("second factor security keys", async assert => {
|
||||
QUnit.test("second factor security keys", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
||||
assert.ok(exists("#password"), "it has a password input");
|
||||
@@ -219,15 +215,13 @@ QUnit.test("second factor security keys", async assert => {
|
||||
await click(".add-security-key");
|
||||
|
||||
assert.ok(
|
||||
find(".alert-error")
|
||||
.html()
|
||||
.indexOf("provide a name") > -1,
|
||||
find(".alert-error").html().indexOf("provide a name") > -1,
|
||||
"shows name missing error message"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("default avatar selector", async assert => {
|
||||
QUnit.test("default avatar selector", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
await click(".pref-avatar .btn");
|
||||
@@ -248,22 +242,22 @@ acceptance("Second Factor Backups", {
|
||||
server.post("/u/second_factors.json", () => {
|
||||
return helper.response({
|
||||
success: "OK",
|
||||
totps: [{ id: 1, name: "one of them" }]
|
||||
totps: [{ id: 1, name: "one of them" }],
|
||||
});
|
||||
});
|
||||
|
||||
server.put("/u/second_factors_backup.json", () => {
|
||||
return helper.response({
|
||||
backup_codes: ["dsffdsd", "fdfdfdsf", "fddsds"]
|
||||
backup_codes: ["dsffdsd", "fdfdfdsf", "fddsds"],
|
||||
});
|
||||
});
|
||||
|
||||
server.get("/u/eviltrout/activity.json", () => {
|
||||
return helper.response({});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
QUnit.test("second factor backup", async assert => {
|
||||
QUnit.test("second factor backup", async (assert) => {
|
||||
updateCurrentUser({ second_factor_enabled: true });
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
await click(".edit-2fa-backup");
|
||||
@@ -284,13 +278,13 @@ acceptance("Avatar selector when selectable avatars is enabled", {
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
["https://www.discourse.org", "https://meta.discourse.org"]
|
||||
["https://www.discourse.org", "https://meta.discourse.org"],
|
||||
];
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("selectable avatars", async assert => {
|
||||
QUnit.test("selectable avatars", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
await click(".pref-avatar .btn");
|
||||
@@ -301,10 +295,10 @@ QUnit.test("selectable avatars", async assert => {
|
||||
acceptance("User Preferences when badges are disabled", {
|
||||
loggedIn: true,
|
||||
settings: { enable_badges: false },
|
||||
pretend: preferencesPretender
|
||||
pretend: preferencesPretender,
|
||||
});
|
||||
|
||||
QUnit.test("visit my preferences", async assert => {
|
||||
QUnit.test("visit my preferences", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
assert.ok($("body.user-preferences-page").length, "has the body class");
|
||||
assert.equal(
|
||||
@@ -315,21 +309,17 @@ QUnit.test("visit my preferences", async assert => {
|
||||
assert.ok(exists(".user-preferences"), "it shows the preferences");
|
||||
});
|
||||
|
||||
QUnit.test("recently connected devices", async assert => {
|
||||
QUnit.test("recently connected devices", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
assert.equal(
|
||||
find(".auth-tokens > .auth-token:first .auth-token-device")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".auth-tokens > .auth-token:first .auth-token-device").text().trim(),
|
||||
"Linux Computer",
|
||||
"it should display active token first"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".pref-auth-tokens > a:first")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".pref-auth-tokens > a:first").text().trim(),
|
||||
I18n.t("user.auth_tokens.show_all", { count: 3 }),
|
||||
"it should display two tokens"
|
||||
);
|
||||
@@ -367,14 +357,14 @@ acceptance(
|
||||
pretend(server, helper) {
|
||||
server.put("/u/eviltrout/feature-topic", () => {
|
||||
return helper.response({
|
||||
success: true
|
||||
success: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("setting featured topic on profile", async assert => {
|
||||
QUnit.test("setting featured topic on profile", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/profile");
|
||||
|
||||
assert.ok(
|
||||
@@ -418,14 +408,14 @@ acceptance("Custom User Fields", {
|
||||
name: "What kind of pet do you have?",
|
||||
field_type: "dropdown",
|
||||
options: ["Dog", "Cat", "Hamster"],
|
||||
required: true
|
||||
}
|
||||
]
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
pretend: preferencesPretender
|
||||
pretend: preferencesPretender,
|
||||
});
|
||||
|
||||
QUnit.test("can select an option from a dropdown", async assert => {
|
||||
QUnit.test("can select an option from a dropdown", async (assert) => {
|
||||
await visit("/u/eviltrout/preferences/profile");
|
||||
assert.ok(exists(".user-field"), "it has at least one user field");
|
||||
await click(".user-field.dropdown");
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
import compile from "handlebars-compiler";
|
||||
import {
|
||||
addRawTemplate,
|
||||
removeRawTemplate
|
||||
removeRawTemplate,
|
||||
} from "discourse-common/lib/raw-templates";
|
||||
|
||||
const CONNECTOR =
|
||||
@@ -18,10 +18,10 @@ acceptance("Raw Plugin Outlet", {
|
||||
|
||||
afterEach() {
|
||||
removeRawTemplate(CONNECTOR);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Renders the raw plugin outlet", async assert => {
|
||||
QUnit.test("Renders the raw plugin outlet", async (assert) => {
|
||||
await visit("/");
|
||||
assert.ok(find(".topic-lala").length > 0, "it renders the outlet");
|
||||
assert.equal(
|
||||
|
||||
@@ -13,42 +13,42 @@ acceptance("Redirect to Top", {
|
||||
return helper.response(DiscoveryFixtures["/latest.json"]);
|
||||
});
|
||||
},
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("redirects categories to weekly top", async assert => {
|
||||
QUnit.test("redirects categories to weekly top", async (assert) => {
|
||||
updateCurrentUser({
|
||||
should_be_redirected_to_top: true,
|
||||
redirected_to_top: {
|
||||
period: "weekly",
|
||||
reason: "Welcome back!"
|
||||
}
|
||||
reason: "Welcome back!",
|
||||
},
|
||||
});
|
||||
|
||||
await visit("/categories");
|
||||
assert.equal(currentPath(), "discovery.topWeekly", "it works for categories");
|
||||
});
|
||||
|
||||
QUnit.test("redirects latest to monthly top", async assert => {
|
||||
QUnit.test("redirects latest to monthly top", async (assert) => {
|
||||
updateCurrentUser({
|
||||
should_be_redirected_to_top: true,
|
||||
redirected_to_top: {
|
||||
period: "monthly",
|
||||
reason: "Welcome back!"
|
||||
}
|
||||
reason: "Welcome back!",
|
||||
},
|
||||
});
|
||||
|
||||
await visit("/latest");
|
||||
assert.equal(currentPath(), "discovery.topMonthly", "it works for latest");
|
||||
});
|
||||
|
||||
QUnit.test("redirects root to All top", async assert => {
|
||||
QUnit.test("redirects root to All top", async (assert) => {
|
||||
updateCurrentUser({
|
||||
should_be_redirected_to_top: true,
|
||||
redirected_to_top: {
|
||||
period: null,
|
||||
reason: "Welcome back!"
|
||||
}
|
||||
reason: "Welcome back!",
|
||||
},
|
||||
});
|
||||
|
||||
await visit("/");
|
||||
|
||||
@@ -1,34 +1,25 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Reports", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("Visit reports page", async assert => {
|
||||
QUnit.test("Visit reports page", async (assert) => {
|
||||
await visit("/admin/reports");
|
||||
|
||||
assert.equal($(".reports-list .report").length, 1);
|
||||
|
||||
const $report = $(".reports-list .report:first-child");
|
||||
|
||||
assert.equal(
|
||||
$report
|
||||
.find(".report-title")
|
||||
.html()
|
||||
.trim(),
|
||||
"My report"
|
||||
);
|
||||
assert.equal($report.find(".report-title").html().trim(), "My report");
|
||||
|
||||
assert.equal(
|
||||
$report
|
||||
.find(".report-description")
|
||||
.html()
|
||||
.trim(),
|
||||
$report.find(".report-description").html().trim(),
|
||||
"List of my activities"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Visit report page", async assert => {
|
||||
QUnit.test("Visit report page", async (assert) => {
|
||||
await visit("/admin/reports/staff_logins");
|
||||
|
||||
assert.ok(exists(".export-csv-btn"));
|
||||
|
||||
@@ -2,12 +2,12 @@ import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Review", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
const user = ".reviewable-item[data-reviewable-id=1234]";
|
||||
|
||||
QUnit.test("It returns a list of reviewable items", async assert => {
|
||||
QUnit.test("It returns a list of reviewable items", async (assert) => {
|
||||
await visit("/review");
|
||||
|
||||
assert.ok(find(".reviewable-item").length, "has a list of items");
|
||||
@@ -26,7 +26,7 @@ QUnit.test("It returns a list of reviewable items", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Grouped by topic", async assert => {
|
||||
QUnit.test("Grouped by topic", async (assert) => {
|
||||
await visit("/review/topics");
|
||||
assert.ok(
|
||||
find(".reviewable-topic").length,
|
||||
@@ -34,7 +34,7 @@ QUnit.test("Grouped by topic", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Settings", async assert => {
|
||||
QUnit.test("Settings", async (assert) => {
|
||||
await visit("/review/settings");
|
||||
|
||||
assert.ok(find(".reviewable-score-type").length, "has a list of bonuses");
|
||||
@@ -47,7 +47,7 @@ QUnit.test("Settings", async assert => {
|
||||
assert.ok(find(".reviewable-settings .saved").length, "it saved");
|
||||
});
|
||||
|
||||
QUnit.test("Flag related", async assert => {
|
||||
QUnit.test("Flag related", async (assert) => {
|
||||
await visit("/review");
|
||||
|
||||
assert.ok(
|
||||
@@ -56,16 +56,14 @@ QUnit.test("Flag related", async assert => {
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".reviewable-flagged-post .post-body")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".reviewable-flagged-post .post-body").html().trim(),
|
||||
"<b>cooked content</b>"
|
||||
);
|
||||
|
||||
assert.equal(find(".reviewable-flagged-post .reviewable-score").length, 2);
|
||||
});
|
||||
|
||||
QUnit.test("Flag related", async assert => {
|
||||
QUnit.test("Flag related", async (assert) => {
|
||||
await visit("/review/1");
|
||||
|
||||
assert.ok(
|
||||
@@ -74,13 +72,13 @@ QUnit.test("Flag related", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Clicking the buttons triggers actions", async assert => {
|
||||
QUnit.test("Clicking the buttons triggers actions", async (assert) => {
|
||||
await visit("/review");
|
||||
await click(`${user} .reviewable-action.approve`);
|
||||
assert.equal(find(user).length, 0, "it removes the reviewable on success");
|
||||
});
|
||||
|
||||
QUnit.test("Editing a reviewable", async assert => {
|
||||
QUnit.test("Editing a reviewable", async (assert) => {
|
||||
const topic = ".reviewable-item[data-reviewable-id=4321]";
|
||||
await visit("/review");
|
||||
assert.ok(find(`${topic} .reviewable-action.approve`).length);
|
||||
@@ -88,12 +86,7 @@ QUnit.test("Editing a reviewable", async assert => {
|
||||
assert.equal(find(`${topic} .discourse-tag:eq(0)`).text(), "hello");
|
||||
assert.equal(find(`${topic} .discourse-tag:eq(1)`).text(), "world");
|
||||
|
||||
assert.equal(
|
||||
find(`${topic} .post-body`)
|
||||
.text()
|
||||
.trim(),
|
||||
"existing body"
|
||||
);
|
||||
assert.equal(find(`${topic} .post-body`).text().trim(), "existing body");
|
||||
|
||||
await click(`${topic} .reviewable-action.edit`);
|
||||
await click(`${topic} .reviewable-action.save-edit`);
|
||||
@@ -112,9 +105,7 @@ QUnit.test("Editing a reviewable", async assert => {
|
||||
await fillIn(".editable-field.payload-raw textarea", "new raw contents");
|
||||
await click(`${topic} .reviewable-action.cancel-edit`);
|
||||
assert.equal(
|
||||
find(`${topic} .post-body`)
|
||||
.text()
|
||||
.trim(),
|
||||
find(`${topic} .post-body`).text().trim(),
|
||||
"existing body",
|
||||
"cancelling does not update the value"
|
||||
);
|
||||
@@ -136,16 +127,6 @@ QUnit.test("Editing a reviewable", async assert => {
|
||||
assert.equal(find(`${topic} .discourse-tag:eq(1)`).text(), "world");
|
||||
assert.equal(find(`${topic} .discourse-tag:eq(2)`).text(), "monkey");
|
||||
|
||||
assert.equal(
|
||||
find(`${topic} .post-body`)
|
||||
.text()
|
||||
.trim(),
|
||||
"new raw contents"
|
||||
);
|
||||
assert.equal(
|
||||
find(`${topic} .category-name`)
|
||||
.text()
|
||||
.trim(),
|
||||
"support"
|
||||
);
|
||||
assert.equal(find(`${topic} .post-body`).text().trim(), "new raw contents");
|
||||
assert.equal(find(`${topic} .category-name`).text().trim(), "support");
|
||||
});
|
||||
|
||||
@@ -15,9 +15,9 @@ acceptance("Search - Full Page", {
|
||||
{
|
||||
username: "admin",
|
||||
name: "admin",
|
||||
avatar_template: "/images/avatar.png"
|
||||
}
|
||||
]
|
||||
avatar_template: "/images/avatar.png",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ acceptance("Search - Full Page", {
|
||||
mentionable: false,
|
||||
flair_url: null,
|
||||
flair_bg_color: null,
|
||||
flair_color: null
|
||||
flair_color: null,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -53,8 +53,8 @@ acceptance("Search - Full Page", {
|
||||
name: "Getting Started",
|
||||
description: null,
|
||||
position: 10,
|
||||
system: true
|
||||
}
|
||||
system: true,
|
||||
},
|
||||
],
|
||||
badges: [
|
||||
{
|
||||
@@ -75,15 +75,15 @@ acceptance("Search - Full Page", {
|
||||
"This badge is granted the first time you read a long topic with more than 100 replies. Reading a conversation closely helps you follow the discussion, understand different viewpoints, and leads to more interesting conversations. The more you read, the better the conversation gets. As we like to say, Reading is Fundamental! :slight_smile:\n",
|
||||
slug: "reader",
|
||||
has_badge: false,
|
||||
badge_type_id: 3
|
||||
}
|
||||
]
|
||||
badge_type_id: 3,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("perform various searches", async assert => {
|
||||
QUnit.test("perform various searches", async (assert) => {
|
||||
await visit("/search");
|
||||
|
||||
assert.ok($("body.search-page").length, "has body class");
|
||||
@@ -103,7 +103,7 @@ QUnit.test("perform various searches", async assert => {
|
||||
assert.ok(find(".fps-topic").length === 1, "has one post");
|
||||
});
|
||||
|
||||
QUnit.test("escape search term", async assert => {
|
||||
QUnit.test("escape search term", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "@<script>prompt(1337)</script>gmail.com");
|
||||
|
||||
@@ -115,7 +115,7 @@ QUnit.test("escape search term", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.skip("update username through advanced search ui", async assert => {
|
||||
QUnit.skip("update username through advanced search ui", async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn(".search-advanced-options .user-selector", "admin");
|
||||
@@ -148,7 +148,7 @@ QUnit.skip("update username through advanced search ui", async assert => {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("update category through advanced search ui", async assert => {
|
||||
QUnit.test("update category through advanced search ui", async (assert) => {
|
||||
const categoryChooser = selectKit(
|
||||
".search-advanced-options .category-chooser"
|
||||
);
|
||||
@@ -174,7 +174,7 @@ QUnit.test("update category through advanced search ui", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"update in:title filter through advanced search ui",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-title");
|
||||
@@ -193,7 +193,7 @@ QUnit.test(
|
||||
|
||||
QUnit.test(
|
||||
"update in:likes filter through advanced search ui",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-likes");
|
||||
@@ -212,7 +212,7 @@ QUnit.test(
|
||||
|
||||
QUnit.test(
|
||||
"update in:personal filter through advanced search ui",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-private");
|
||||
@@ -229,24 +229,27 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("update in:seen filter through advanced search ui", async assert => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-seen");
|
||||
QUnit.test(
|
||||
"update in:seen filter through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await click(".search-advanced-options .in-seen");
|
||||
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-seen:checked"),
|
||||
"it should check the right checkbox"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".search-advanced-options .in-seen:checked"),
|
||||
"it should check the right checkbox"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:seen",
|
||||
"it should update the search term"
|
||||
);
|
||||
});
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none in:seen",
|
||||
"it should update the search term"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("update in filter through advanced search ui", async assert => {
|
||||
QUnit.test("update in filter through advanced search ui", async (assert) => {
|
||||
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
||||
|
||||
await visit("/search");
|
||||
@@ -267,7 +270,7 @@ QUnit.test("update in filter through advanced search ui", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("update status through advanced search ui", async assert => {
|
||||
QUnit.test("update status through advanced search ui", async (assert) => {
|
||||
const statusSelector = selectKit(
|
||||
".search-advanced-options .select-kit#status"
|
||||
);
|
||||
@@ -292,7 +295,7 @@ QUnit.test("update status through advanced search ui", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"doesn't update status filter header if wrong value entered through searchbox",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
const statusSelector = selectKit(
|
||||
".search-advanced-options .select-kit#status"
|
||||
);
|
||||
@@ -307,7 +310,7 @@ QUnit.test(
|
||||
|
||||
QUnit.test(
|
||||
"doesn't update in filter header if wrong value entered through searchbox",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
const inSelector = selectKit(".search-advanced-options .select-kit#in");
|
||||
|
||||
await visit("/search");
|
||||
@@ -318,7 +321,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("update post time through advanced search ui", async assert => {
|
||||
QUnit.test("update post time through advanced search ui", async (assert) => {
|
||||
await visit("/search?expanded=true&q=after:2018-08-22");
|
||||
|
||||
assert.equal(
|
||||
@@ -351,24 +354,27 @@ QUnit.test("update post time through advanced search ui", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("update min post count through advanced search ui", async assert => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn("#search-min-post-count", "5");
|
||||
QUnit.test(
|
||||
"update min post count through advanced search ui",
|
||||
async (assert) => {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "none");
|
||||
await fillIn("#search-min-post-count", "5");
|
||||
|
||||
assert.equal(
|
||||
find(".search-advanced-options #search-min-post-count").val(),
|
||||
"5",
|
||||
'has "5" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none min_post_count:5",
|
||||
'has updated search term to "none min_post_count:5"'
|
||||
);
|
||||
});
|
||||
assert.equal(
|
||||
find(".search-advanced-options #search-min-post-count").val(),
|
||||
"5",
|
||||
'has "5" populated'
|
||||
);
|
||||
assert.equal(
|
||||
find(".search-query").val(),
|
||||
"none min_post_count:5",
|
||||
'has updated search term to "none min_post_count:5"'
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("validate advanced search when initially empty", async assert => {
|
||||
QUnit.test("validate advanced search when initially empty", async (assert) => {
|
||||
await visit("/search?expanded=true");
|
||||
await click(".search-advanced-options .in-likes");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Search - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("search", async assert => {
|
||||
QUnit.test("search", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
|
||||
@@ -7,17 +7,17 @@ let searchArgs = {
|
||||
pretend(server) {
|
||||
server.handledRequest = (verb, path, request) => {
|
||||
if (request.queryParams["search_context[type]"] === undefined) {
|
||||
emptySearchContextCallbacks.forEach(callback => {
|
||||
emptySearchContextCallbacks.forEach((callback) => {
|
||||
callback.call();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
acceptance("Search", searchArgs);
|
||||
|
||||
QUnit.test("search", async assert => {
|
||||
QUnit.test("search", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
@@ -43,7 +43,7 @@ QUnit.test("search", async assert => {
|
||||
assert.ok(exists(".search-advanced-options"), "advanced search is expanded");
|
||||
});
|
||||
|
||||
QUnit.test("search for a tag", async assert => {
|
||||
QUnit.test("search for a tag", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
@@ -53,7 +53,7 @@ QUnit.test("search for a tag", async assert => {
|
||||
assert.ok(exists(".search-menu .results ul li"), "it shows results");
|
||||
});
|
||||
|
||||
QUnit.test("search scope checkbox", async assert => {
|
||||
QUnit.test("search scope checkbox", async (assert) => {
|
||||
await visit("/tag/important");
|
||||
await click("#search-button");
|
||||
assert.ok(
|
||||
@@ -86,7 +86,7 @@ QUnit.test("search scope checkbox", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Search with context", async assert => {
|
||||
QUnit.test("Search with context", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280/1");
|
||||
|
||||
await click("#search-button");
|
||||
@@ -126,7 +126,7 @@ QUnit.test("Search with context", async assert => {
|
||||
assert.ok(!$(".search-context input[type=checkbox]").is(":checked"));
|
||||
});
|
||||
|
||||
QUnit.test("Right filters are shown to anonymous users", async assert => {
|
||||
QUnit.test("Right filters are shown to anonymous users", async (assert) => {
|
||||
const inSelector = selectKit(".select-kit#in");
|
||||
|
||||
await visit("/search?expanded=true");
|
||||
@@ -151,7 +151,7 @@ QUnit.test("Right filters are shown to anonymous users", async assert => {
|
||||
|
||||
acceptance("Search", Object.assign({ loggedIn: true, searchArgs }));
|
||||
|
||||
QUnit.test("Right filters are shown to logged-in users", async assert => {
|
||||
QUnit.test("Right filters are shown to logged-in users", async (assert) => {
|
||||
const inSelector = selectKit(".select-kit#in");
|
||||
|
||||
await visit("/search?expanded=true");
|
||||
@@ -179,11 +179,11 @@ acceptance(
|
||||
Object.assign({
|
||||
loggedIn: true,
|
||||
searchArgs,
|
||||
settings: { tagging_enabled: true }
|
||||
settings: { tagging_enabled: true },
|
||||
})
|
||||
);
|
||||
|
||||
QUnit.test("displays tags", async assert => {
|
||||
QUnit.test("displays tags", async (assert) => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Share and Invite modal - desktop", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
});
|
||||
|
||||
QUnit.test("Topic footer button", async assert => {
|
||||
QUnit.test("Topic footer button", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
@@ -64,7 +64,7 @@ QUnit.test("Topic footer button", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Post date link", async assert => {
|
||||
QUnit.test("Post date link", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#post_2 .post-info.post-date a");
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Share and Invite modal - mobile", {
|
||||
loggedIn: true,
|
||||
mobileView: true
|
||||
mobileView: true,
|
||||
});
|
||||
|
||||
QUnit.test("Topic footer mobile button", async assert => {
|
||||
QUnit.test("Topic footer mobile button", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
@@ -54,7 +54,7 @@ QUnit.test("Topic footer mobile button", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Post date link", async assert => {
|
||||
QUnit.test("Post date link", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#post_2 .post-info.post-date a");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Shared Drafts", { loggedIn: true });
|
||||
|
||||
QUnit.test("Viewing", async assert => {
|
||||
QUnit.test("Viewing", async (assert) => {
|
||||
await visit("/t/some-topic/9");
|
||||
assert.ok(find(".shared-draft-controls").length === 1);
|
||||
let categoryChooser = selectKit(".shared-draft-controls .category-chooser");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Signing In");
|
||||
|
||||
QUnit.test("sign in", async assert => {
|
||||
QUnit.test("sign in", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
assert.ok(exists(".login-modal"), "it shows the login modal");
|
||||
@@ -25,7 +25,7 @@ QUnit.test("sign in", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("sign in - not activated", async assert => {
|
||||
QUnit.test("sign in - not activated", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
assert.ok(exists(".login-modal"), "it shows the login modal");
|
||||
@@ -47,7 +47,7 @@ QUnit.test("sign in - not activated", async assert => {
|
||||
assert.ok(!exists(".modal-body small"), "it escapes the email address");
|
||||
});
|
||||
|
||||
QUnit.test("sign in - not activated - edit email", async assert => {
|
||||
QUnit.test("sign in - not activated - edit email", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
assert.ok(exists(".login-modal"), "it shows the login modal");
|
||||
@@ -68,7 +68,7 @@ QUnit.test("sign in - not activated - edit email", async assert => {
|
||||
assert.equal(find(".modal-body b").text(), "different@example.com");
|
||||
});
|
||||
|
||||
QUnit.skip("second factor", async assert => {
|
||||
QUnit.skip("second factor", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
@@ -101,7 +101,7 @@ QUnit.skip("second factor", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.skip("security key", async assert => {
|
||||
QUnit.skip("security key", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
|
||||
@@ -127,7 +127,7 @@ QUnit.skip("security key", async assert => {
|
||||
assert.not(exists("#login-button:visible"), "hides the login button");
|
||||
});
|
||||
|
||||
QUnit.test("create account", async assert => {
|
||||
QUnit.test("create account", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .sign-up-button");
|
||||
|
||||
@@ -163,7 +163,7 @@ QUnit.test("create account", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("second factor backup - valid token", async assert => {
|
||||
QUnit.test("second factor backup - valid token", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
await fillIn("#login-account-name", "eviltrout");
|
||||
@@ -179,7 +179,7 @@ QUnit.test("second factor backup - valid token", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("second factor backup - invalid token", async assert => {
|
||||
QUnit.test("second factor backup - invalid token", async (assert) => {
|
||||
await visit("/");
|
||||
await click("header .login-button");
|
||||
await fillIn("#login-account-name", "eviltrout");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Static");
|
||||
|
||||
QUnit.test("Static Pages", async assert => {
|
||||
QUnit.test("Static Pages", async (assert) => {
|
||||
await visit("/faq");
|
||||
assert.ok($("body.static-faq").length, "has the body class");
|
||||
assert.ok(exists(".body-page"), "The content is present");
|
||||
|
||||
@@ -13,14 +13,14 @@ acceptance("Tag Groups", {
|
||||
tag_names: ["monkey"],
|
||||
parent_tag_name: [],
|
||||
one_per_topic: false,
|
||||
permissions: { everyone: 1 }
|
||||
}
|
||||
permissions: { everyone: 1 },
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("tag groups can be saved and deleted", async assert => {
|
||||
QUnit.test("tag groups can be saved and deleted", async (assert) => {
|
||||
const tags = selectKit(".tag-chooser");
|
||||
|
||||
await visit("/tag_groups");
|
||||
|
||||
@@ -7,7 +7,7 @@ acceptance("Tags intersection", {
|
||||
pretend(server, helper) {
|
||||
server.get("/tag/first/notifications", () => {
|
||||
return helper.response({
|
||||
tag_notification: { id: "first", notification_level: 1 }
|
||||
tag_notification: { id: "first", notification_level: 1 },
|
||||
});
|
||||
});
|
||||
server.get("/tags/intersection/first/second.json", () => {
|
||||
@@ -20,23 +20,21 @@ acceptance("Tags intersection", {
|
||||
topics: [{ id: 16, posters: [] }],
|
||||
tags: [
|
||||
{ id: 1, name: "second", topic_count: 1 },
|
||||
{ id: 2, name: "first", topic_count: 1 }
|
||||
]
|
||||
}
|
||||
{ id: 2, name: "first", topic_count: 1 },
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Populate tags when creating new topic", async assert => {
|
||||
QUnit.test("Populate tags when creating new topic", async (assert) => {
|
||||
await visit("/tags/intersection/first/second");
|
||||
await click("#create-topic");
|
||||
|
||||
assert.ok(exists(".mini-tag-chooser"), "The tag selector appears");
|
||||
assert.equal(
|
||||
$(".mini-tag-chooser")
|
||||
.text()
|
||||
.trim(),
|
||||
$(".mini-tag-chooser").text().trim(),
|
||||
"first, second",
|
||||
"populates the tags when clicking 'New topic'"
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import pretender from "helpers/create-pretender";
|
||||
|
||||
acceptance("Tags", { loggedIn: true });
|
||||
|
||||
QUnit.test("list the tags", async assert => {
|
||||
QUnit.test("list the tags", async (assert) => {
|
||||
await visit("/tags");
|
||||
|
||||
assert.ok($("body.tags-page").length, "has the body class");
|
||||
@@ -16,11 +16,11 @@ QUnit.test("list the tags", async assert => {
|
||||
acceptance("Tags listed by group", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
tags_listed_by_group: true
|
||||
}
|
||||
tags_listed_by_group: true,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("list the tags in groups", async assert => {
|
||||
QUnit.test("list the tags in groups", async (assert) => {
|
||||
await visit("/tags");
|
||||
assert.equal(
|
||||
$(".tag-list").length,
|
||||
@@ -30,7 +30,7 @@ QUnit.test("list the tags in groups", async assert => {
|
||||
assert.deepEqual(
|
||||
$(".tag-list h3")
|
||||
.toArray()
|
||||
.map(i => {
|
||||
.map((i) => {
|
||||
return $(i).text();
|
||||
}),
|
||||
["Ford Cars", "Honda Cars", "Makes", "Other Tags"],
|
||||
@@ -39,7 +39,7 @@ QUnit.test("list the tags in groups", async assert => {
|
||||
assert.deepEqual(
|
||||
$(".tag-list:first .discourse-tag")
|
||||
.toArray()
|
||||
.map(i => {
|
||||
.map((i) => {
|
||||
return $(i).text();
|
||||
}),
|
||||
["focus", "Escort"],
|
||||
@@ -48,7 +48,7 @@ QUnit.test("list the tags in groups", async assert => {
|
||||
assert.deepEqual(
|
||||
$(".tag-list:first .discourse-tag")
|
||||
.toArray()
|
||||
.map(i => {
|
||||
.map((i) => {
|
||||
return $(i).attr("href");
|
||||
}),
|
||||
["/tag/focus", "/tag/escort"],
|
||||
@@ -61,11 +61,11 @@ QUnit.test("list the tags in groups", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
test("new topic button is not available for staff-only tags", async assert => {
|
||||
test("new topic button is not available for staff-only tags", async (assert) => {
|
||||
pretender.get("/tag/regular-tag/notifications", () => [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{ tag_notification: { id: "regular-tag", notification_level: 1 } }
|
||||
{ tag_notification: { id: "regular-tag", notification_level: 1 } },
|
||||
]);
|
||||
|
||||
pretender.get("/tag/regular-tag/l/latest.json", () => [
|
||||
@@ -84,18 +84,18 @@ test("new topic button is not available for staff-only tags", async assert => {
|
||||
{
|
||||
id: 1,
|
||||
name: "regular-tag",
|
||||
topic_count: 1
|
||||
}
|
||||
topic_count: 1,
|
||||
},
|
||||
],
|
||||
topics: []
|
||||
}
|
||||
}
|
||||
topics: [],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
pretender.get("/tag/staff-only-tag/notifications", () => [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{ tag_notification: { id: "staff-only-tag", notification_level: 1 } }
|
||||
{ tag_notification: { id: "staff-only-tag", notification_level: 1 } },
|
||||
]);
|
||||
|
||||
pretender.get("/tag/staff-only-tag/l/latest.json", () => [
|
||||
@@ -115,12 +115,12 @@ test("new topic button is not available for staff-only tags", async assert => {
|
||||
id: 1,
|
||||
name: "staff-only-tag",
|
||||
topic_count: 1,
|
||||
staff: true
|
||||
}
|
||||
staff: true,
|
||||
},
|
||||
],
|
||||
topics: []
|
||||
}
|
||||
}
|
||||
topics: [],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
@@ -143,12 +143,12 @@ test("new topic button is not available for staff-only tags", async assert => {
|
||||
acceptance("Tag info", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
tags_listed_by_group: true
|
||||
tags_listed_by_group: true,
|
||||
},
|
||||
pretend(server, helper) {
|
||||
server.get("/tag/planters/notifications", () => {
|
||||
return helper.response({
|
||||
tag_notification: { id: "planters", notification_level: 1 }
|
||||
tag_notification: { id: "planters", notification_level: 1 },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -166,11 +166,11 @@ acceptance("Tag info", {
|
||||
{
|
||||
id: 1,
|
||||
name: "planters",
|
||||
topic_count: 1
|
||||
}
|
||||
topic_count: 1,
|
||||
},
|
||||
],
|
||||
topics: []
|
||||
}
|
||||
topics: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -185,15 +185,15 @@ acceptance("Tag info", {
|
||||
synonyms: [
|
||||
{
|
||||
id: "containers",
|
||||
text: "containers"
|
||||
text: "containers",
|
||||
},
|
||||
{
|
||||
id: "planter",
|
||||
text: "planter"
|
||||
}
|
||||
text: "planter",
|
||||
},
|
||||
],
|
||||
tag_group_names: ["Gardening"],
|
||||
category_ids: [7]
|
||||
category_ids: [7],
|
||||
},
|
||||
categories: [
|
||||
{
|
||||
@@ -209,15 +209,15 @@ acceptance("Tag info", {
|
||||
topic_url: "/t/category-definition-for-outdoors/1026",
|
||||
read_restricted: false,
|
||||
permission: null,
|
||||
notification_level: null
|
||||
}
|
||||
]
|
||||
notification_level: null,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
test("tag info can show synonyms", async assert => {
|
||||
test("tag info can show synonyms", async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/tag/planters");
|
||||
@@ -226,9 +226,7 @@ test("tag info can show synonyms", async assert => {
|
||||
await click("#show-tag-info");
|
||||
assert.ok(exists(".tag-info .tag-name"), "show tag");
|
||||
assert.ok(
|
||||
find(".tag-info .tag-associations")
|
||||
.text()
|
||||
.indexOf("Gardening") >= 0,
|
||||
find(".tag-info .tag-associations").text().indexOf("Gardening") >= 0,
|
||||
"show tag group names"
|
||||
);
|
||||
assert.ok(
|
||||
@@ -244,11 +242,11 @@ test("tag info can show synonyms", async assert => {
|
||||
assert.ok(!exists("#delete-tag"), "can't delete tag");
|
||||
});
|
||||
|
||||
test("admin can manage tags", async assert => {
|
||||
test("admin can manage tags", async (assert) => {
|
||||
pretender.delete("/tag/planters/synonyms/containers", () => [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{ success: true }
|
||||
{ success: true },
|
||||
]);
|
||||
|
||||
updateCurrentUser({ moderator: false, admin: true });
|
||||
|
||||
@@ -2,7 +2,7 @@ import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Topic - Admin Menu Anonymous Users", { loggedIn: false });
|
||||
|
||||
QUnit.test("Enter as a regular user", async assert => {
|
||||
QUnit.test("Enter as a regular user", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(
|
||||
@@ -13,17 +13,23 @@ QUnit.test("Enter as a regular user", async assert => {
|
||||
|
||||
acceptance("Topic - Admin Menu", { loggedIn: true });
|
||||
|
||||
QUnit.test("Enter as a user with group moderator permissions", async assert => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
QUnit.test(
|
||||
"Enter as a user with group moderator permissions",
|
||||
async (assert) => {
|
||||
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
||||
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(exists(".toggle-admin-menu"), "The admin menu button was rendered");
|
||||
});
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(
|
||||
exists(".toggle-admin-menu"),
|
||||
"The admin menu button was rendered"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"Enter as a user with moderator and admin permissions",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
updateCurrentUser({ moderator: true, admin: true, trust_level: 4 });
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -35,15 +41,18 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Toggle the menu as admin focuses the first item", async assert => {
|
||||
updateCurrentUser({ admin: true });
|
||||
QUnit.test(
|
||||
"Toggle the menu as admin focuses the first item",
|
||||
async (assert) => {
|
||||
updateCurrentUser({ admin: true });
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
await click(".toggle-admin-menu");
|
||||
await visit("/t/internationalization-localization/280");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
await click(".toggle-admin-menu");
|
||||
|
||||
assert.equal(
|
||||
document.activeElement,
|
||||
document.querySelector(".topic-admin-multi-select > button")
|
||||
);
|
||||
});
|
||||
assert.equal(
|
||||
document.activeElement,
|
||||
document.querySelector(".topic-admin-multi-select > button")
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Topic - Anonymous");
|
||||
|
||||
QUnit.test("Enter a Topic", async assert => {
|
||||
QUnit.test("Enter a Topic", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280/1");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
assert.ok(exists("#topic .cooked"), "The topic has cooked posts");
|
||||
@@ -11,24 +11,24 @@ QUnit.test("Enter a Topic", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Enter without an id", async assert => {
|
||||
QUnit.test("Enter without an id", async (assert) => {
|
||||
await visit("/t/internationalization-localization");
|
||||
assert.ok(exists("#topic"), "The topic was rendered");
|
||||
});
|
||||
|
||||
QUnit.test("Enter a 404 topic", async assert => {
|
||||
QUnit.test("Enter a 404 topic", async (assert) => {
|
||||
await visit("/t/not-found/404");
|
||||
assert.ok(!exists("#topic"), "The topic was not rendered");
|
||||
assert.ok(exists(".topic-error"), "An error message is displayed");
|
||||
});
|
||||
|
||||
QUnit.test("Enter without access", async assert => {
|
||||
QUnit.test("Enter without access", async (assert) => {
|
||||
await visit("/t/i-dont-have-access/403");
|
||||
assert.ok(!exists("#topic"), "The topic was not rendered");
|
||||
assert.ok(exists(".topic-error"), "An error message is displayed");
|
||||
});
|
||||
|
||||
QUnit.test("Enter with 500 errors", async assert => {
|
||||
QUnit.test("Enter with 500 errors", async (assert) => {
|
||||
await visit("/t/throws-error/500");
|
||||
assert.ok(!exists("#topic"), "The topic was not rendered");
|
||||
assert.ok(exists(".topic-error"), "An error message is displayed");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user