DEV: De-arrowify tests (#11068)

Using arrow functions changes `this` context, which is undesired in tests, e.g. it makes it impossible to setup things like pretender (`this.server`) in `beforeEach` hooks.

Ember guides always use classic functions in examples (e.g. https://guides.emberjs.com/release/testing/test-types/), and that's what it uses in its own test suite, as do various addons and ember apps.

It was also already used in Discourse where `this` was required. Moving forward, it will be needed in more places as we migrate toward ember-cli.

(I might later add a custom rule to eslint-discourse-ember to enforce this)
This commit is contained in:
Jarek Radosz 2020-10-30 17:37:32 +01:00 committed by GitHub
parent d5fb0b9435
commit a17d54d0bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
185 changed files with 762 additions and 762 deletions

View File

@ -4,7 +4,7 @@ import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("About", function () {
test("viewing", async (assert) => {
test("viewing", async function (assert) {
await visit("/about");
assert.ok($("body.about-page").length, "has body class");

View File

@ -6,7 +6,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import PreloadStore from "discourse/lib/preload-store";
acceptance("Account Created", function () {
test("account created - message", async (assert) => {
test("account created - message", async function (assert) {
PreloadStore.store("accountCreated", {
message: "Hello World",
});
@ -21,7 +21,7 @@ acceptance("Account Created", function () {
assert.notOk(exists(".activation-controls"));
});
test("account created - resend email", async (assert) => {
test("account created - resend email", async function (assert) {
PreloadStore.store("accountCreated", {
message: "Hello World",
username: "eviltrout",
@ -45,7 +45,7 @@ acceptance("Account Created", function () {
assert.equal(email, "eviltrout@example.com");
});
test("account created - update email - cancel", async (assert) => {
test("account created - update email - cancel", async function (assert) {
PreloadStore.store("accountCreated", {
message: "Hello World",
username: "eviltrout",
@ -65,7 +65,7 @@ acceptance("Account Created", function () {
assert.equal(currentPath(), "account-created.index");
});
test("account created - update email - submit", async (assert) => {
test("account created - update email - submit", async function (assert) {
PreloadStore.store("accountCreated", {
message: "Hello World",
username: "eviltrout",

View File

@ -28,7 +28,7 @@ acceptance("Admin - Emails", function (needs) {
});
});
test("shows selected and elided text", async (assert) => {
test("shows selected and elided text", async function (assert) {
await visit("/admin/email/advanced-test");
await fillIn("textarea.email-body", EMAIL.trim());
await click(".email-advanced-test button");

View File

@ -6,7 +6,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Search Log Term", function (needs) {
needs.user();
test("show search log term details", async (assert) => {
test("show search log term details", async function (assert) {
await visit("/admin/logs/search_logs/term?term=ruby");
assert.ok($("div.search-logs-filter").length, "has the search type filter");

View File

@ -6,7 +6,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Search Logs", function (needs) {
needs.user();
test("show search logs", async (assert) => {
test("show search logs", async function (assert) {
await visit("/admin/logs/search_logs");
assert.ok($("table.search-logs-list.grid").length, "has the div class");

View File

@ -30,7 +30,7 @@ acceptance("Admin - Site Settings", function (needs) {
updatedTitle = null;
});
test("upload site setting", async (assert) => {
test("upload site setting", async function (assert) {
await visit("/admin/site_settings");
assert.ok(
@ -41,7 +41,7 @@ acceptance("Admin - Site Settings", function (needs) {
assert.ok(exists(".row.setting.upload .undo"), "undo button is present");
});
test("changing value updates dirty state", async (assert) => {
test("changing value updates dirty state", async function (assert) {
await visit("/admin/site_settings");
await fillIn("#setting-filter", " title ");
assert.equal(count(".row.setting"), 1, "filter returns 1 site setting");
@ -88,7 +88,7 @@ acceptance("Admin - Site Settings", function (needs) {
);
});
test("always shows filtered site settings if a filter is set", async (assert) => {
test("always shows filtered site settings if a filter is set", async function (assert) {
await visit("/admin/site_settings");
await fillIn("#setting-filter", "title");
assert.equal(count(".row.setting"), 1);
@ -102,7 +102,7 @@ acceptance("Admin - Site Settings", function (needs) {
assert.equal(count(".row.setting"), 1);
});
test("filter settings by plugin name", async (assert) => {
test("filter settings by plugin name", async function (assert) {
await visit("/admin/site_settings");
await fillIn("#setting-filter", "plugin:discourse-logo");
@ -113,7 +113,7 @@ acceptance("Admin - Site Settings", function (needs) {
assert.equal(count(".row.setting"), 0);
});
test("category name is preserved", async (assert) => {
test("category name is preserved", async function (assert) {
await visit("admin/site_settings/category/basic?filter=menu");
assert.equal(
currentURL(),
@ -121,7 +121,7 @@ acceptance("Admin - Site Settings", function (needs) {
);
});
test("shows all_results if current category has none", async (assert) => {
test("shows all_results if current category has none", async function (assert) {
await visit("admin/site_settings");
await click(".admin-nav .basic a");

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Site Texts", function (needs) {
needs.user();
test("search for a key", async (assert) => {
test("search for a key", async function (assert) {
await visit("/admin/customize/site_texts");
await fillIn(".site-text-search", "Test");
@ -28,7 +28,7 @@ acceptance("Admin - Site Texts", function (needs) {
assert.ok(exists(".site-text.overridden"));
});
test("edit and revert a site text by key", async (assert) => {
test("edit and revert a site text by key", async function (assert) {
await visit("/admin/customize/site_texts/site.test");
assert.equal(queryAll(".title h3").text(), "site.test");

View File

@ -25,7 +25,7 @@ acceptance("Admin - Suspend User", function (needs) {
);
});
test("suspend a user - cancel", async (assert) => {
test("suspend a user - cancel", async function (assert) {
await visit("/admin/users/1234/regular");
await click(".suspend-user");
@ -36,7 +36,7 @@ acceptance("Admin - Suspend User", function (needs) {
assert.equal(queryAll(".suspend-user-modal:visible").length, 0);
});
test("suspend a user - cancel with input", async (assert) => {
test("suspend a user - cancel with input", async function (assert) {
await visit("/admin/users/1234/regular");
await click(".suspend-user");
@ -63,7 +63,7 @@ acceptance("Admin - Suspend User", function (needs) {
assert.equal(queryAll(".bootbox.modal:visible").length, 0);
});
test("suspend, then unsuspend a user", async (assert) => {
test("suspend, then unsuspend a user", async function (assert) {
const suspendUntilCombobox = selectKit(".suspend-until .combobox");
await visit("/admin/flags/active");

View File

@ -6,7 +6,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Users Badges", function (needs) {
needs.user();
test("lists badges", async (assert) => {
test("lists badges", async function (assert) {
await visit("/admin/users/1/eviltrout/badges");
assert.ok(exists(`span[data-badge-name="Badge 8"]`));

View File

@ -35,13 +35,13 @@ function assertMultipleSecondary(assert, firstEmail, secondEmail) {
acceptance("Admin - User Emails", function (needs) {
needs.user();
test("viewing self without secondary emails", async (assert) => {
test("viewing self without secondary emails", async function (assert) {
await visit("/admin/users/1/eviltrout");
assertNoSecondary(assert);
});
test("viewing self with multiple secondary emails", async (assert) => {
test("viewing self with multiple secondary emails", async function (assert) {
await visit("/admin/users/3/markvanlan");
assert.equal(
@ -57,14 +57,14 @@ acceptance("Admin - User Emails", function (needs) {
);
});
test("viewing another user with no secondary email", async (assert) => {
test("viewing another user with no secondary email", async function (assert) {
await visit("/admin/users/1234/regular");
await click(`.display-row.secondary-emails button`);
assertNoSecondary(assert);
});
test("viewing another account with secondary emails", async (assert) => {
test("viewing another account with secondary emails", async function (assert) {
await visit("/admin/users/1235/regular1");
await click(`.display-row.secondary-emails button`);

View File

@ -39,7 +39,7 @@ acceptance("Admin - User Index", function (needs) {
});
});
test("can edit username", async (assert) => {
test("can edit username", async function (assert) {
await visit("/admin/users/2/sam");
assert.equal(queryAll(".display-row.username .value").text().trim(), "sam");
@ -60,7 +60,7 @@ acceptance("Admin - User Index", function (needs) {
);
});
test("will clear unsaved groups when switching user", async (assert) => {
test("will clear unsaved groups when switching user", async function (assert) {
await visit("/admin/users/2/sam");
assert.equal(

View File

@ -8,14 +8,14 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Users List", function (needs) {
needs.user();
test("lists users", async (assert) => {
test("lists users", async function (assert) {
await visit("/admin/users/list/active");
assert.ok(exists(".users-list .user"));
assert.ok(!exists(".user:eq(0) .email small"), "escapes email");
});
test("sorts users", async (assert) => {
test("sorts users", async function (assert) {
await visit("/admin/users/list/active");
assert.ok(exists(".users-list .user"));
@ -39,7 +39,7 @@ acceptance("Admin - Users List", function (needs) {
);
});
test("toggles email visibility", async (assert) => {
test("toggles email visibility", async function (assert) {
await visit("/admin/users/list/active");
assert.ok(exists(".users-list .user"));
@ -61,7 +61,7 @@ acceptance("Admin - Users List", function (needs) {
);
});
test("switching tabs", async (assert) => {
test("switching tabs", async function (assert) {
const activeUser = "eviltrout";
const suspectUser = "sam";
const activeTitle = I18n.t("admin.users.titles.active");

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Watched Words", function (needs) {
needs.user();
test("list words in groups", async (assert) => {
test("list words in groups", async function (assert) {
await visit("/admin/logs/watched_words/action/block");
assert.ok(exists(".watched-words-list"));
@ -44,7 +44,7 @@ acceptance("Admin - Watched Words", function (needs) {
assert.ok(!exists(".watched-words-list .watched-word"), "Empty word list.");
});
test("add words", async (assert) => {
test("add words", async function (assert) {
await visit("/admin/logs/watched_words/action/block");
click(".show-words-checkbox");
@ -61,7 +61,7 @@ acceptance("Admin - Watched Words", function (needs) {
assert.equal(found.length, 1);
});
test("remove words", async (assert) => {
test("remove words", async function (assert) {
await visit("/admin/logs/watched_words/action/block");
await click(".show-words-checkbox");

View File

@ -20,7 +20,7 @@ acceptance("Auth Complete", function (needs) {
.removeChild(document.getElementById("data-authentication"));
});
test("when login not required", async (assert) => {
test("when login not required", async function (assert) {
await visit("/");
assert.equal(currentPath(), "discovery.latest", "it stays on the homepage");

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Badges", function (needs) {
needs.user();
test("Visit Badge Pages", async (assert) => {
test("Visit Badge Pages", async function (assert) {
await visit("/badges");
assert.ok($("body.badges-page").length, "has body class");
@ -20,7 +20,7 @@ acceptance("Badges", function (needs) {
assert.ok(!exists(".badge-card:eq(0) script"));
});
test("shows correct badge titles to choose from", async (assert) => {
test("shows correct badge titles to choose from", async function (assert) {
const availableBadgeTitles = selectKit(".select-kit");
await visit("/badges/50/custombadge");
await availableBadgeTitles.expand();

View File

@ -39,7 +39,7 @@ acceptance("Bookmarking", function (needs) {
);
});
test("Bookmarks modal opening", async (assert) => {
test("Bookmarks modal opening", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
assert.ok(
@ -48,7 +48,7 @@ acceptance("Bookmarking", function (needs) {
);
});
test("Bookmarks modal selecting reminder type", async (assert) => {
test("Bookmarks modal selecting reminder type", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
@ -79,7 +79,7 @@ acceptance("Bookmarking", function (needs) {
]);
});
test("Saving a bookmark with a reminder", async (assert) => {
test("Saving a bookmark with a reminder", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await fillIn("input#bookmark-name", "Check this out later");
@ -98,7 +98,7 @@ acceptance("Bookmarking", function (needs) {
assert.deepEqual(steps, ["tomorrow"]);
});
test("Opening the options panel and remembering the option", async (assert) => {
test("Opening the options panel and remembering the option", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click(".bookmark-options-button");
@ -119,7 +119,7 @@ acceptance("Bookmarking", function (needs) {
assert.deepEqual(steps, ["none"]);
});
test("Saving a bookmark with no reminder or name", async (assert) => {
test("Saving a bookmark with no reminder or name", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click("#save-bookmark");
@ -137,7 +137,7 @@ acceptance("Bookmarking", function (needs) {
assert.deepEqual(steps, ["none"]);
});
test("Deleting a bookmark with a reminder", async (assert) => {
test("Deleting a bookmark with a reminder", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click("#tap_tile_tomorrow");
@ -169,7 +169,7 @@ acceptance("Bookmarking", function (needs) {
);
});
test("Cancelling saving a bookmark", async (assert) => {
test("Cancelling saving a bookmark", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click(".d-modal-cancel");
@ -179,7 +179,7 @@ acceptance("Bookmarking", function (needs) {
);
});
test("Editing a bookmark", async (assert) => {
test("Editing a bookmark", async function (assert) {
await visit("/t/internationalization-localization/280");
let now = moment.tz(loggedInUser().resolvedTimezone(loggedInUser()));
let tomorrow = now.add(1, "day").format("YYYY-MM-DD");

View File

@ -37,7 +37,7 @@ acceptance("Category Banners", function (needs) {
],
});
test("Does not display category banners when not set", async (assert) => {
test("Does not display category banners when not set", async function (assert) {
await visit("/c/test-read-only-without-banner");
await click("#create-topic");
@ -48,7 +48,7 @@ acceptance("Category Banners", function (needs) {
);
});
test("Displays category banners when set", async (assert) => {
test("Displays category banners when set", async function (assert) {
await visit("/c/test-read-only-with-banner");
await click("#create-topic");
@ -85,7 +85,7 @@ acceptance("Anonymous Category Banners", function (needs) {
],
});
test("Does not display category banners when set", async (assert) => {
test("Does not display category banners when set", async function (assert) {
await visit("/c/test-read-only-with-banner");
assert.ok(
!visible(".category-read-only-banner"),

View File

@ -9,7 +9,7 @@ acceptance("CategoryChooser", function (needs) {
allow_uncategorized_topics: false,
});
test("does not display uncategorized if not allowed", async (assert) => {
test("does not display uncategorized if not allowed", async function (assert) {
const categoryChooser = selectKit(".category-chooser");
await visit("/");
@ -19,7 +19,7 @@ acceptance("CategoryChooser", function (needs) {
assert.ok(categoryChooser.rowByIndex(0).name() !== "uncategorized");
});
test("prefill category when category_id is set", async (assert) => {
test("prefill category when category_id is set", async function (assert) {
await visit("/new-topic?category_id=1");
assert.equal(selectKit(".category-chooser").header().value(), 1);

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Category Edit - security", function (needs) {
needs.user();
test("default", async (assert) => {
test("default", async function (assert) {
await visit("/c/bug/edit/security");
const $firstItem = queryAll(".permission-list li:eq(0)");
@ -19,7 +19,7 @@ acceptance("Category Edit - security", function (needs) {
assert.equal(permission, "Create / Reply / See");
});
test("removing a permission", async (assert) => {
test("removing a permission", async function (assert) {
const availableGroups = selectKit(".available-groups");
await visit("/c/bug/edit/security");
@ -43,7 +43,7 @@ acceptance("Category Edit - security", function (needs) {
);
});
test("adding a permission", async (assert) => {
test("adding a permission", async function (assert) {
const availableGroups = selectKit(".available-groups");
const permissionSelector = selectKit(".permission-selector");
@ -67,7 +67,7 @@ acceptance("Category Edit - security", function (needs) {
assert.equal(permission, "Reply / See");
});
test("adding a previously removed permission", async (assert) => {
test("adding a previously removed permission", async function (assert) {
const availableGroups = selectKit(".available-groups");
await visit("/c/bug/edit/security");

View File

@ -10,7 +10,7 @@ acceptance("Category Edit", function (needs) {
needs.user();
needs.settings({ email_in: true });
test("Editing the category", async (assert) => {
test("Editing the category", async function (assert) {
await visit("/c/bug");
await click("button.edit-category");
@ -57,7 +57,7 @@ acceptance("Category Edit", function (needs) {
);
});
test("Index Route", async (assert) => {
test("Index Route", async function (assert) {
await visit("/c/bug/edit");
assert.equal(
currentURL(),
@ -66,7 +66,7 @@ acceptance("Category Edit", function (needs) {
);
});
test("Slugless Route", async (assert) => {
test("Slugless Route", async function (assert) {
await visit("/c/1-category/edit");
assert.equal(
currentURL(),
@ -76,7 +76,7 @@ acceptance("Category Edit", function (needs) {
assert.equal(queryAll("input.category-name").val(), "bug");
});
test("Error Saving", async (assert) => {
test("Error Saving", async function (assert) {
await visit("/c/bug/edit/settings");
await fillIn(".email-in", "duplicate@example.com");
await click("#save-category");
@ -88,7 +88,7 @@ acceptance("Category Edit", function (needs) {
assert.ok(!visible(".bootbox"));
});
test("Subcategory list settings", async (assert) => {
test("Subcategory list settings", async function (assert) {
await visit("/c/bug/edit/settings");
assert.ok(

View File

@ -9,7 +9,7 @@ import sinon from "sinon";
acceptance("Category New", function (needs) {
needs.user();
test("Creating a new category", async (assert) => {
test("Creating a new category", async function (assert) {
await visit("/new-category");
assert.ok(queryAll(".badge-category"));

View File

@ -12,7 +12,7 @@ acceptance("Click Track", function (needs) {
});
});
test("Do not track mentions", async (assert) => {
test("Do not track mentions", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(
queryAll(".user-card.show").length === 0,

View File

@ -19,7 +19,7 @@ acceptance("Composer Actions", function (needs) {
needs.settings({ enable_whispers: true });
needs.site({ can_tag_topics: true });
test("creating new topic and then reply_as_private_message keeps attributes", async (assert) => {
test("creating new topic and then reply_as_private_message keeps attributes", async function (assert) {
await visit("/");
await click("button#create-topic");
@ -34,7 +34,7 @@ acceptance("Composer Actions", function (needs) {
assert.ok(queryAll(".d-editor-input").val(), "this is the reply");
});
test("replying to post", async (assert) => {
test("replying to post", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -52,7 +52,7 @@ acceptance("Composer Actions", function (needs) {
assert.equal(composerActions.rowByIndex(5).value(), undefined);
});
test("replying to post - reply_as_private_message", async (assert) => {
test("replying to post - reply_as_private_message", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -68,7 +68,7 @@ acceptance("Composer Actions", function (needs) {
);
});
test("replying to post - reply_to_topic", async (assert) => {
test("replying to post - reply_to_topic", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -95,7 +95,7 @@ acceptance("Composer Actions", function (needs) {
);
});
test("replying to post - toggle_whisper", async (assert) => {
test("replying to post - toggle_whisper", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -113,7 +113,7 @@ acceptance("Composer Actions", function (needs) {
);
});
test("replying to post - reply_as_new_topic", async (assert) => {
test("replying to post - reply_as_new_topic", async function (assert) {
sinon
.stub(Draft, "get")
.returns(Promise.resolve({ draft: "", draft_sequence: 0 }));
@ -144,7 +144,7 @@ acceptance("Composer Actions", function (needs) {
sinon.restore();
});
test("reply_as_new_topic without a new_topic draft", async (assert) => {
test("reply_as_new_topic without a new_topic draft", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".create.reply");
const composerActions = selectKit(".composer-actions");
@ -153,7 +153,7 @@ acceptance("Composer Actions", function (needs) {
assert.equal(exists(queryAll(".bootbox")), false);
});
test("reply_as_new_group_message", async (assert) => {
test("reply_as_new_group_message", async function (assert) {
await visit("/t/lorem-ipsum-dolor-sit-amet/130");
await click(".create.reply");
const composerActions = selectKit(".composer-actions");
@ -168,7 +168,7 @@ acceptance("Composer Actions", function (needs) {
assert.deepEqual(items, ["foo", "foo_group"]);
});
test("hide component if no content", async (assert) => {
test("hide component if no content", async function (assert) {
await visit("/");
await click("button#create-topic");
@ -184,7 +184,7 @@ acceptance("Composer Actions", function (needs) {
assert.equal(composerActions.rows().length, 2);
});
test("interactions", async (assert) => {
test("interactions", async function (assert) {
const composerActions = selectKit(".composer-actions");
const quote = "Life is like riding a bicycle.";
@ -265,7 +265,7 @@ acceptance("Composer Actions", function (needs) {
assert.equal(composerActions.rows().length, 3);
});
test("replying to post - toggle_topic_bump", async (assert) => {
test("replying to post - toggle_topic_bump", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -293,7 +293,7 @@ acceptance("Composer Actions", function (needs) {
);
});
test("replying to post as staff", async (assert) => {
test("replying to post as staff", async function (assert) {
const composerActions = selectKit(".composer-actions");
updateCurrentUser({ admin: true });
@ -305,7 +305,7 @@ acceptance("Composer Actions", function (needs) {
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
});
test("replying to post as TL3 user", async (assert) => {
test("replying to post as TL3 user", async function (assert) {
const composerActions = selectKit(".composer-actions");
updateCurrentUser({ moderator: false, admin: false, trust_level: 3 });
@ -323,7 +323,7 @@ acceptance("Composer Actions", function (needs) {
});
});
test("replying to post as TL4 user", async (assert) => {
test("replying to post as TL4 user", async function (assert) {
const composerActions = selectKit(".composer-actions");
updateCurrentUser({ moderator: false, admin: false, trust_level: 4 });
@ -335,7 +335,7 @@ acceptance("Composer Actions", function (needs) {
assert.equal(composerActions.rowByIndex(3).value(), "toggle_topic_bump");
});
test("replying to first post - reply_as_private_message", async (assert) => {
test("replying to first post - reply_as_private_message", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -351,7 +351,7 @@ acceptance("Composer Actions", function (needs) {
);
});
test("editing post", async (assert) => {
test("editing post", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -385,7 +385,7 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
needs.hooks.beforeEach(() => _clearSnapshots());
needs.hooks.afterEach(() => _clearSnapshots());
test("shared draft", async (assert) => {
test("shared draft", async function (assert) {
stubDraftResponse();
try {
toggleCheckDraftPopup(true);
@ -427,7 +427,7 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
sinon.restore();
});
test("reply_as_new_topic with new_topic draft", async (assert) => {
test("reply_as_new_topic with new_topic draft", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".create.reply");
const composerActions = selectKit(".composer-actions");

View File

@ -33,7 +33,7 @@ acceptance("Composer Attachment", function (needs) {
needs.user();
needs.pretender(pretender);
test("attachments are cooked properly", async (assert) => {
test("attachments are cooked properly", async function (assert) {
await writeInComposer(assert);
assert.equal(
queryAll(".d-editor-preview:visible").html().trim(),
@ -47,7 +47,7 @@ acceptance("Composer Attachment - Secure Media Enabled", function (needs) {
needs.settings({ secure_media: true });
needs.pretender(pretender);
test("attachments are cooked properly when secure media is enabled", async (assert) => {
test("attachments are cooked properly when secure media is enabled", async function (assert) {
await writeInComposer(assert);
assert.equal(
queryAll(".d-editor-preview:visible").html().trim(),

View File

@ -15,7 +15,7 @@ acceptance("Composer - Edit conflict", function (needs) {
});
});
test("Edit a post that causes an edit conflict", async (assert) => {
test("Edit a post that causes an edit conflict", async function (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");
@ -33,7 +33,7 @@ acceptance("Composer - Edit conflict", function (needs) {
await click(".modal .btn-primary");
});
test("Should not send originalText when posting a new reply", async (assert) => {
test("Should not send originalText when posting a new reply", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".topic-post:eq(0) button.reply");
await fillIn(
@ -43,7 +43,7 @@ acceptance("Composer - Edit conflict", function (needs) {
assert.ok(lastBody.indexOf("originalText") === -1);
});
test("Should send originalText when editing a reply", async (assert) => {
test("Should send originalText when editing a reply", async function (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");

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Composer - Hyperlink", function (needs) {
needs.user();
test("add a hyperlink to a reply", async (assert) => {
test("add a hyperlink to a reply", async function (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 ");

View File

@ -10,7 +10,7 @@ acceptance("Composer - Onebox", function (needs) {
enable_markdown_linkify: true,
});
test("Preview update should respect max_oneboxes_per_post site setting", async (assert) => {
test("Preview update should respect max_oneboxes_per_post site setting", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");

View File

@ -16,7 +16,7 @@ acceptance("Composer - Tags", function (needs) {
});
needs.site({ can_tag_topics: true });
test("staff bypass tag validation rule", async (assert) => {
test("staff bypass tag validation rule", async function (assert) {
await visit("/");
await click("#create-topic");
@ -33,7 +33,7 @@ acceptance("Composer - Tags", function (needs) {
assert.notEqual(currentURL(), "/");
});
test("users do not bypass tag validation rule", async (assert) => {
test("users do not bypass tag validation rule", async function (assert) {
await visit("/");
await click("#create-topic");

View File

@ -24,7 +24,7 @@ acceptance("Composer", function (needs) {
});
});
skip("Tests the Composer controls", async (assert) => {
skip("Tests the Composer controls", async function (assert) {
await visit("/");
assert.ok(exists("#create-topic"), "the create button is visible");
@ -102,7 +102,7 @@ acceptance("Composer", function (needs) {
assert.ok(!exists(".bootbox.modal"), "the confirmation can be cancelled");
});
test("Composer upload placeholder", async (assert) => {
test("Composer upload placeholder", async function (assert) {
await visit("/");
await click("#create-topic");
@ -198,7 +198,7 @@ acceptance("Composer", function (needs) {
);
});
test("Create a topic with server side errors", async (assert) => {
test("Create a topic with server side errors", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "this title triggers an error");
@ -210,7 +210,7 @@ acceptance("Composer", function (needs) {
assert.ok(exists(".d-editor-input"), "the composer input is visible");
});
test("Create a Topic", async (assert) => {
test("Create a Topic", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "Internationalization Localization");
@ -226,7 +226,7 @@ acceptance("Composer", function (needs) {
);
});
test("Create an enqueued Topic", async (assert) => {
test("Create an enqueued Topic", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "Internationalization Localization");
@ -239,7 +239,7 @@ acceptance("Composer", function (needs) {
assert.ok(invisible(".d-modal"), "the modal can be dismissed");
});
test("Can display a message and route to a URL", async (assert) => {
test("Can display a message and route to a URL", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "This title doesn't matter");
@ -259,7 +259,7 @@ acceptance("Composer", function (needs) {
);
});
test("Create a Reply", async (assert) => {
test("Create a Reply", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(
@ -282,7 +282,7 @@ acceptance("Composer", function (needs) {
);
});
test("Can edit a post after starting a reply", async (assert) => {
test("Can edit a post after starting a reply", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .create");
@ -300,7 +300,7 @@ acceptance("Composer", function (needs) {
);
});
test("Posting on a different topic", async (assert) => {
test("Posting on a different topic", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
await fillIn(
@ -320,7 +320,7 @@ acceptance("Composer", function (needs) {
);
});
test("Create an enqueued Reply", async (assert) => {
test("Create an enqueued Reply", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.notOk(queryAll(".pending-posts .reviewable-item").length);
@ -347,7 +347,7 @@ acceptance("Composer", function (needs) {
assert.ok(queryAll(".pending-posts .reviewable-item").length);
});
test("Edit the first post", async (assert) => {
test("Edit the first post", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(
@ -385,7 +385,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer can switch between edits", async (assert) => {
test("Composer can switch between edits", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.edit");
@ -402,7 +402,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer with dirty edit can toggle to another edit", async (assert) => {
test("Composer with dirty edit can toggle to another edit", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.edit");
@ -418,7 +418,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer can toggle between edit and reply", async (assert) => {
test("Composer can toggle between edit and reply", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.edit");
@ -437,7 +437,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer can toggle whispers", async (assert) => {
test("Composer can toggle whispers", async function (assert) {
const menu = selectKit(".toolbar-popup-menu-options");
await visit("/t/this-is-a-test-topic/9");
@ -472,7 +472,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer can toggle layouts (open, fullscreen and draft)", async (assert) => {
test("Composer can toggle layouts (open, fullscreen and draft)", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.reply");
@ -511,7 +511,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer can toggle between reply and createTopic", async (assert) => {
test("Composer can toggle between reply and createTopic", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.reply");
@ -557,7 +557,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer with dirty reply can toggle to edit", async (assert) => {
test("Composer with dirty reply can toggle to edit", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.reply");
@ -572,7 +572,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer draft with dirty reply can toggle to edit", async (assert) => {
test("Composer draft with dirty reply can toggle to edit", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.reply");
@ -592,7 +592,7 @@ acceptance("Composer", function (needs) {
);
});
test("Composer draft can switch to draft in new context without destroying current draft", async (assert) => {
test("Composer draft can switch to draft in new context without destroying current draft", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.reply");
@ -614,7 +614,7 @@ acceptance("Composer", function (needs) {
);
});
test("Checks for existing draft", async (assert) => {
test("Checks for existing draft", async function (assert) {
try {
toggleCheckDraftPopup(true);
@ -634,7 +634,7 @@ acceptance("Composer", function (needs) {
}
});
test("Can switch states without abandon popup", async (assert) => {
test("Can switch states without abandon popup", async function (assert) {
try {
toggleCheckDraftPopup(true);
@ -684,7 +684,7 @@ acceptance("Composer", function (needs) {
sinon.restore();
});
test("Loading draft also replaces the recipients", async (assert) => {
test("Loading draft also replaces the recipients", async function (assert) {
try {
toggleCheckDraftPopup(true);
@ -706,7 +706,7 @@ acceptance("Composer", function (needs) {
}
});
test("Deleting the text content of the first post in a private message", async (assert) => {
test("Deleting the text content of the first post in a private message", async function (assert) {
await visit("/t/34");
await click("#post_1 .d-icon-ellipsis-h");
@ -730,7 +730,7 @@ acceptance("Composer", function (needs) {
);
};
test("Image resizing buttons", async (assert) => {
test("Image resizing buttons", async function (assert) {
await visit("/");
await click("#create-topic");

View File

@ -12,7 +12,7 @@ acceptance("Composer topic featured links", function (needs) {
enable_markdown_linkify: true,
});
test("onebox with title", async (assert) => {
test("onebox with title", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "http://www.example.com/has-title.html");
@ -31,7 +31,7 @@ acceptance("Composer topic featured links", function (needs) {
);
});
test("onebox result doesn't include a title", async (assert) => {
test("onebox result doesn't include a title", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "http://www.example.com/no-title.html");
@ -50,7 +50,7 @@ acceptance("Composer topic featured links", function (needs) {
);
});
test("no onebox result", async (assert) => {
test("no onebox result", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "http://www.example.com/nope-onebox.html");
@ -69,7 +69,7 @@ acceptance("Composer topic featured links", function (needs) {
);
});
test("ignore internal links", async (assert) => {
test("ignore internal links", async function (assert) {
await visit("/");
await click("#create-topic");
const title = "http://" + window.location.hostname + "/internal-page.html";
@ -91,7 +91,7 @@ acceptance("Composer topic featured links", function (needs) {
);
});
test("link is longer than max title length", async (assert) => {
test("link is longer than max title length", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn(
@ -113,7 +113,7 @@ acceptance("Composer topic featured links", function (needs) {
);
});
test("onebox with title but extra words in title field", async (assert) => {
test("onebox with title but extra words in title field", async function (assert) {
await visit("/");
await click("#create-topic");
await fillIn("#reply-title", "http://www.example.com/has-title.html test");
@ -146,7 +146,7 @@ acceptance(
allow_uncategorized_topics: false,
});
test("Pasting a link enables the text input area", async (assert) => {
test("Pasting a link enables the text input area", async function (assert) {
await visit("/");
await click("#create-topic");
assert.ok(

View File

@ -14,7 +14,7 @@ acceptance(
allow_uncategorized_topics: false,
});
test("Disable body until category is selected", async (assert) => {
test("Disable body until category is selected", async function (assert) {
await visit("/");
await click("#create-topic");
assert.ok(exists(".d-editor-input"), "the composer input is visible");
@ -80,7 +80,7 @@ acceptance(
},
],
});
test("Enable composer/body if no topic templates present", async (assert) => {
test("Enable composer/body if no topic templates present", async function (assert) {
await visit("/");
await click("#create-topic");
assert.ok(exists(".d-editor-input"), "the composer input is visible");

View File

@ -21,7 +21,7 @@ acceptance("Create Account - external auth", function (needs) {
.removeChild(document.getElementById("data-authentication"));
});
test("when skip is disabled (default)", async (assert) => {
test("when skip is disabled (default)", async function (assert) {
await visit("/");
assert.ok(

View File

@ -28,7 +28,7 @@ acceptance("Create Account - User Fields", function (needs) {
],
});
test("create account with user fields", async (assert) => {
test("create account with user fields", async function (assert) {
await visit("/");
await click("header .sign-up-button");

View File

@ -7,12 +7,12 @@ import { setCustomHTML } from "discourse/helpers/custom-html";
import PreloadStore from "discourse/lib/preload-store";
acceptance("CustomHTML set", function () {
test("has no custom HTML in the top", async (assert) => {
test("has no custom HTML in the top", async function (assert) {
await visit("/static/faq");
assert.ok(!exists("span.custom-html-test"), "it has no markup");
});
test("renders set HTML", async (assert) => {
test("renders set HTML", async function (assert) {
setCustomHTML("top", '<span class="custom-html-test">HTML</span>');
await visit("/static/faq");
@ -23,7 +23,7 @@ acceptance("CustomHTML set", function () {
);
});
test("renders preloaded HTML", async (assert) => {
test("renders preloaded HTML", async function (assert) {
PreloadStore.store("customHTML", {
top: "<span class='cookie'>monster</span>",
});

View File

@ -14,7 +14,7 @@ acceptance("CustomHTML template", function (needs) {
delete Ember.TEMPLATES["top"];
});
test("renders custom template", async (assert) => {
test("renders custom template", async function (assert) {
await visit("/static/faq");
assert.equal(
queryAll("span.top-span").text(),

View File

@ -24,13 +24,13 @@ acceptance("Dashboard", function (needs) {
],
});
test("default", async (assert) => {
test("default", async function (assert) {
await visit("/admin");
assert.ok(exists(".dashboard"), "has dashboard-next class");
});
test("tabs", async (assert) => {
test("tabs", async function (assert) {
await visit("/admin");
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
@ -42,7 +42,7 @@ acceptance("Dashboard", function (needs) {
assert.ok(exists(".dashboard .navigation-item.reports"), "reports tab");
});
test("general tab", async (assert) => {
test("general tab", async function (assert) {
await visit("/admin");
assert.ok(exists(".admin-report.signups"), "signups report");
assert.ok(exists(".admin-report.posts"), "posts report");
@ -65,7 +65,7 @@ acceptance("Dashboard", function (needs) {
);
});
test("activity metrics", async (assert) => {
test("activity metrics", async function (assert) {
await visit("/admin");
assert.ok(exists(".admin-report.page-view-total-reqs .today-count"));
@ -74,7 +74,7 @@ acceptance("Dashboard", function (needs) {
assert.ok(exists(".admin-report.page-view-total-reqs .thirty-days-count"));
});
test("reports tab", async (assert) => {
test("reports tab", async function (assert) {
await visit("/admin");
await click(".dashboard .navigation-item.reports .navigation-link");
@ -112,7 +112,7 @@ acceptance("Dashboard", function (needs) {
);
});
test("reports filters", async (assert) => {
test("reports filters", async function (assert) {
await visit(
'/admin/reports/signups_with_groups?end_date=2018-07-16&filters=%7B"group"%3A88%7D&start_date=2018-06-16'
);
@ -131,7 +131,7 @@ acceptance("Dashboard: dashboard_visible_tabs", function (needs) {
needs.user();
needs.settings({ dashboard_visible_tabs: "general|security|reports" });
test("visible tabs", async (assert) => {
test("visible tabs", async function (assert) {
await visit("/admin");
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
@ -151,7 +151,7 @@ acceptance("Dashboard: dashboard_hidden_reports", function (needs) {
dashboard_hidden_reports: "posts|dau_by_mau",
});
test("hidden reports", async (assert) => {
test("hidden reports", async function (assert) {
await visit("/admin");
assert.ok(exists(".admin-report.signups.is-visible"), "signups report");

View File

@ -15,7 +15,7 @@ acceptance("EmojiPicker", function (needs) {
this.emojiStore.reset();
});
test("emoji picker can be opened/closed", async (assert) => {
test("emoji picker can be opened/closed", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
@ -26,7 +26,7 @@ acceptance("EmojiPicker", function (needs) {
assert.notOk(exists(".emoji-picker.opened"), "it closes the picker");
});
test("emoji picker triggers event when picking emoji", async (assert) => {
test("emoji picker triggers event when picking emoji", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
await click("button.emoji.btn");
@ -39,7 +39,7 @@ acceptance("EmojiPicker", function (needs) {
);
});
test("emoji picker adds leading whitespace before emoji", async (assert) => {
test("emoji picker adds leading whitespace before emoji", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
@ -64,7 +64,7 @@ acceptance("EmojiPicker", function (needs) {
);
});
test("emoji picker has a list of recently used emojis", async (assert) => {
test("emoji picker has a list of recently used emojis", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
await click("button.emoji.btn");
@ -102,7 +102,7 @@ acceptance("EmojiPicker", function (needs) {
);
});
test("emoji picker correctly orders recently used emojis", async (assert) => {
test("emoji picker correctly orders recently used emojis", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
await click("button.emoji.btn");
@ -125,7 +125,7 @@ acceptance("EmojiPicker", function (needs) {
);
});
test("emoji picker persists state", async (assert) => {
test("emoji picker persists state", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
await click("button.emoji.btn");

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Emoji", function (needs) {
needs.user();
test("emoji is cooked properly", async (assert) => {
test("emoji is cooked properly", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
@ -18,7 +18,7 @@ acceptance("Emoji", function (needs) {
);
});
test("skin toned emoji is cooked properly", async (assert) => {
test("skin toned emoji is cooked properly", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");

View File

@ -43,7 +43,7 @@ acceptance("Encoded Sub Category Discovery", function (needs) {
);
});
test("Visit subcategory by slug", async (assert) => {
test("Visit subcategory by slug", async function (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");

View File

@ -82,13 +82,13 @@ acceptance("flagging", function (needs) {
});
});
test("Flag modal opening", async (assert) => {
test("Flag modal opening", async function (assert) {
await visit("/t/internationalization-localization/280");
await openFlagModal();
assert.ok(exists(".flag-modal-body"), "it shows the flag modal");
});
test("Flag take action dropdown exists", async (assert) => {
test("Flag take action dropdown exists", async function (assert) {
await visit("/t/internationalization-localization/280");
await openFlagModal();
await click("#radio_inappropriate");
@ -101,7 +101,7 @@ acceptance("flagging", function (needs) {
assert.ok(exists(".silence-user-modal"), "it shows the silence modal");
});
test("Can silence from take action", async (assert) => {
test("Can silence from take action", async function (assert) {
await visit("/t/internationalization-localization/280");
await openFlagModal();
await click("#radio_inappropriate");
@ -116,7 +116,7 @@ acceptance("flagging", function (needs) {
assert.equal(queryAll(".bootbox.modal:visible").length, 0);
});
test("Gets dismissable warning from canceling incomplete silence from take action", async (assert) => {
test("Gets dismissable warning from canceling incomplete silence from take action", async function (assert) {
await visit("/t/internationalization-localization/280");
await openFlagModal();
await click("#radio_inappropriate");

View File

@ -16,7 +16,7 @@ acceptance("Forgot password", function (needs) {
});
});
test("requesting password reset", async (assert) => {
test("requesting password reset", async function (assert) {
await visit("/");
await click("header .login-button");
await click("#forgot-password-link");

View File

@ -9,7 +9,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Group Members - Anonymous", function () {
test("Viewing Members as anon user", async (assert) => {
test("Viewing Members as anon user", async function (assert) {
await visit("/g/discourse");
assert.ok(
@ -34,7 +34,7 @@ acceptance("Group Members - Anonymous", function () {
acceptance("Group Members", function (needs) {
needs.user();
test("Viewing Members as a group owner", async (assert) => {
test("Viewing Members as a group owner", async function (assert) {
updateCurrentUser({ moderator: false, admin: false });
await visit("/g/discourse");
@ -47,7 +47,7 @@ acceptance("Group Members", function (needs) {
);
});
test("Viewing Members as an admin user", async (assert) => {
test("Viewing Members as an admin user", async function (assert) {
await visit("/g/discourse");
assert.ok(

View File

@ -8,7 +8,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Managing Group Category Notification Defaults", function () {
test("As an anonymous user", async (assert) => {
test("As an anonymous user", async function (assert) {
await visit("/g/discourse/manage/categories");
assert.ok(
@ -20,7 +20,7 @@ acceptance("Managing Group Category Notification Defaults", function () {
acceptance("Managing Group Category Notification Defaults", function (needs) {
needs.user();
test("As an admin", async (assert) => {
test("As an admin", async function (assert) {
await visit("/g/discourse/manage/categories");
assert.ok(
@ -29,7 +29,7 @@ acceptance("Managing Group Category Notification Defaults", function (needs) {
);
});
test("As a group owner", async (assert) => {
test("As a group owner", async function (assert) {
updateCurrentUser({ moderator: false, admin: false });
await visit("/g/discourse/manage/categories");

View File

@ -10,7 +10,7 @@ acceptance("Managing Group Interaction Settings", function (needs) {
needs.user();
needs.settings({ email_in: true });
test("As an admin", async (assert) => {
test("As an admin", async function (assert) {
updateCurrentUser({
moderator: false,
admin: true,
@ -50,7 +50,7 @@ acceptance("Managing Group Interaction Settings", function (needs) {
);
});
test("As a group owner", async (assert) => {
test("As a group owner", async function (assert) {
updateCurrentUser({
moderator: false,
admin: false,

View File

@ -94,7 +94,7 @@ acceptance("Group logs", function (needs) {
});
});
test("Browsing group logs", async (assert) => {
test("Browsing group logs", async function (assert) {
await visit("/g/snorlax/manage/logs");
assert.ok(
queryAll("tr.group-manage-logs-row").length === 2,

View File

@ -10,7 +10,7 @@ import selectKit from "discourse/tests/helpers/select-kit-helper";
acceptance("Managing Group Membership", function (needs) {
needs.user();
test("As an admin", async (assert) => {
test("As an admin", async function (assert) {
updateCurrentUser({ can_create_group: true });
await visit("/g/alternative-group/manage/membership");
@ -79,7 +79,7 @@ acceptance("Managing Group Membership", function (needs) {
assert.equal(emailDomains.header().value(), "foo.com");
});
test("As a group owner", async (assert) => {
test("As a group owner", async function (assert) {
updateCurrentUser({ moderator: false, admin: false });
await visit("/g/discourse/manage/membership");

View File

@ -8,7 +8,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Managing Group Profile", function () {
test("As an anonymous user", async (assert) => {
test("As an anonymous user", async function (assert) {
await visit("/g/discourse/manage/profile");
assert.ok(
@ -21,7 +21,7 @@ acceptance("Managing Group Profile", function () {
acceptance("Managing Group Profile", function (needs) {
needs.user();
test("As an admin", async (assert) => {
test("As an admin", async function (assert) {
await visit("/g/discourse/manage/profile");
assert.ok(
@ -42,7 +42,7 @@ acceptance("Managing Group Profile", function (needs) {
);
});
test("As a group owner", async (assert) => {
test("As a group owner", async function (assert) {
updateCurrentUser({
moderator: false,
admin: false,

View File

@ -8,7 +8,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Managing Group Tag Notification Defaults", function () {
test("As an anonymous user", async (assert) => {
test("As an anonymous user", async function (assert) {
await visit("/g/discourse/manage/tags");
assert.ok(
@ -21,7 +21,7 @@ acceptance("Managing Group Tag Notification Defaults", function () {
acceptance("Managing Group Tag Notification Defaults", function (needs) {
needs.user();
test("As an admin", async (assert) => {
test("As an admin", async function (assert) {
await visit("/g/discourse/manage/tags");
assert.ok(
@ -30,7 +30,7 @@ acceptance("Managing Group Tag Notification Defaults", function (needs) {
);
});
test("As a group owner", async (assert) => {
test("As a group owner", async function (assert) {
updateCurrentUser({ moderator: false, admin: false });
await visit("/g/discourse/manage/tags");

View File

@ -83,7 +83,7 @@ acceptance("Group Requests", function (needs) {
});
});
test("Group Requests", async (assert) => {
test("Group Requests", async function (assert) {
await visit("/g/Macdonald/requests");
assert.equal(queryAll(".group-members tr").length, 2);

View File

@ -76,7 +76,7 @@ acceptance("Group - Anonymous", function (needs) {
);
});
test("Anonymous Viewing Automatic Group", async (assert) => {
test("Anonymous Viewing Automatic Group", async function (assert) {
await visit("/g/moderators");
assert.equal(
@ -185,7 +185,7 @@ acceptance("Group - Authenticated", function (needs) {
);
});
test("User Viewing Group", async (assert) => {
test("User Viewing Group", async function (assert) {
await visit("/g");
await click(".group-index-request");
@ -218,7 +218,7 @@ acceptance("Group - Authenticated", function (needs) {
);
});
test("Admin viewing group messages when there are no messages", async (assert) => {
test("Admin viewing group messages when there are no messages", async function (assert) {
await visit("/g/alternative-group");
await click(".nav-pills li a[title='Messages']");
@ -229,7 +229,7 @@ acceptance("Group - Authenticated", function (needs) {
);
});
test("Admin viewing group messages", async (assert) => {
test("Admin viewing group messages", async function (assert) {
await visit("/g/discourse");
await click(".nav-pills li a[title='Messages']");
@ -240,7 +240,7 @@ acceptance("Group - Authenticated", function (needs) {
);
});
test("Admin Viewing Group", async (assert) => {
test("Admin Viewing Group", async function (assert) {
await visit("/g/discourse");
assert.ok(
@ -260,7 +260,7 @@ acceptance("Group - Authenticated", function (needs) {
);
});
test("Moderator Viewing Group", async (assert) => {
test("Moderator Viewing Group", async function (assert) {
await visit("/g/alternative-group");
assert.ok(

View File

@ -9,7 +9,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Groups", function () {
test("Browsing Groups", async (assert) => {
test("Browsing Groups", async function (assert) {
await visit("/g?username=eviltrout");
assert.equal(count(".group-box"), 1, "it displays user's groups");

View File

@ -5,7 +5,7 @@ import I18n from "I18n";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("New Group - Anonymous", function () {
test("As an anon user", async (assert) => {
test("As an anon user", async function (assert) {
await visit("/g");
assert.equal(
@ -18,7 +18,7 @@ acceptance("New Group - Anonymous", function () {
acceptance("New Group - Authenticated", function (needs) {
needs.user();
test("Creating a new group", async (assert) => {
test("Creating a new group", async function (assert) {
await visit("/g");
await click(".groups-header-new");

View File

@ -13,7 +13,7 @@ acceptance("Opening the hamburger menu with some reviewables", function (
needs.pretender((server, helper) => {
server.get("/review/count.json", () => helper.response({ count: 3 }));
});
test("As a staff member", async (assert) => {
test("As a staff member", async function (assert) {
updateCurrentUser({ moderator: true, admin: false });
await visit("/");

View File

@ -18,7 +18,7 @@ acceptance("Category and Tag Hashtags", function (needs) {
});
});
test("hashtags are cooked properly", async (assert) => {
test("hashtags are cooked properly", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");

View File

@ -8,7 +8,7 @@ import PreloadStore from "discourse/lib/preload-store";
acceptance("Invite Accept", function (needs) {
needs.settings({ full_name_required: true });
test("Invite Acceptance Page", async (assert) => {
test("Invite Acceptance Page", async function (assert) {
PreloadStore.store("invite_info", {
invited_by: {
id: 123,

View File

@ -28,7 +28,7 @@ acceptance("Accept Invite - User Fields", function (needs) {
],
});
test("accept invite with user fields", async (assert) => {
test("accept invite with user fields", async function (assert) {
PreloadStore.store("invite_info", {
invited_by: {
id: 123,

View File

@ -21,7 +21,7 @@ acceptance("Jump to", function (needs) {
});
});
test("default", async (assert) => {
test("default", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("nav#topic-progress .nums");
await click("button.jump-to-post");
@ -38,7 +38,7 @@ acceptance("Jump to", function (needs) {
);
});
test("invalid date", async (assert) => {
test("invalid date", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("nav#topic-progress .nums");
await click("button.jump-to-post");

View File

@ -23,7 +23,7 @@ acceptance("Keyboard Shortcuts", function (needs) {
});
});
test("go to first suggested topic", async (assert) => {
test("go to first suggested topic", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
await keyEvent(document, "keypress", "g".charCodeAt(0));
await keyEvent(document, "keypress", "s".charCodeAt(0));

View File

@ -6,7 +6,7 @@ import { acceptance, invisible } from "discourse/tests/helpers/qunit-helpers";
acceptance("Login Required", function (needs) {
needs.settings({ login_required: true });
test("redirect", async (assert) => {
test("redirect", async function (assert) {
await visit("/latest");
assert.equal(currentPath(), "login", "it redirects them to login");

View File

@ -16,7 +16,7 @@ acceptance("Login with email - hide email address taken", function (needs) {
});
});
test("with hide_email_address_taken enabled", async (assert) => {
test("with hide_email_address_taken enabled", async function (assert) {
await visit("/");
await click("header .login-button");
await fillIn("#login-account-name", "someuser@example.com");

View File

@ -9,14 +9,14 @@ acceptance("Login with email - no social logins", function (needs) {
needs.pretender((server, helper) => {
server.post("/u/email-login", () => helper.response({ success: "OK" }));
});
test("with login with email enabled", async (assert) => {
test("with login with email enabled", async function (assert) {
await visit("/");
await click("header .login-button");
assert.ok(exists(".login-with-email-button"));
});
test("with login with email disabled", async (assert) => {
test("with login with email disabled", async function (assert) {
await visit("/");
await click("header .login-button");

View File

@ -9,7 +9,7 @@ acceptance("Login with email disabled", function (needs) {
enable_facebook_logins: true,
});
test("with email button", async (assert) => {
test("with email button", async function (assert) {
await visit("/");
await click("header .login-button");

View File

@ -18,7 +18,7 @@ acceptance("Login with email", function (needs) {
);
});
test("with email button", async (assert) => {
test("with email button", async function (assert) {
await visit("/");
await click("header .login-button");

View File

@ -5,7 +5,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Topic Discovery - Mobile", function (needs) {
needs.mobileView();
test("Visit Discovery Pages", async (assert) => {
test("Visit Discovery Pages", async function (assert) {
await visit("/");
assert.ok(exists(".topic-list"), "The list of topics was rendered");
assert.ok(exists(".topic-list .topic-list-item"), "has topics");

View File

@ -5,7 +5,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Signing In - Mobile", function (needs) {
needs.mobileView();
test("sign in", async (assert) => {
test("sign in", async function (assert) {
await visit("/");
await click("header .login-button");
assert.ok(exists("#login-form"), "it shows the login modal");

View File

@ -5,7 +5,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("User Directory - Mobile", function (needs) {
needs.mobileView();
test("Visit Page", async (assert) => {
test("Visit Page", async function (assert) {
await visit("/u");
assert.ok(exists(".directory .user"), "has a list of users");
});

View File

@ -5,7 +5,7 @@ import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("New Message - Anonymous", function () {
test("accessing new-message route when logged out", async (assert) => {
test("accessing new-message route when logged out", async function (assert) {
await visit(
"/new-message?username=charlie&title=message%20title&body=message%20body"
);
@ -17,7 +17,7 @@ acceptance("New Message - Anonymous", function () {
acceptance("New Message - Authenticated", function (needs) {
needs.user();
test("accessing new-message route when logged in", async (assert) => {
test("accessing new-message route when logged in", async function (assert) {
await visit(
"/new-message?username=charlie&title=message%20title&body=message%20body"
);

View File

@ -6,7 +6,7 @@ import selectKit from "discourse/tests/helpers/select-kit-helper";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("New Topic - Anonymous", function () {
test("accessing new-topic route when logged out", async (assert) => {
test("accessing new-topic route when logged out", async function (assert) {
await visit("/new-topic?title=topic%20title&body=topic%20body");
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
@ -15,7 +15,7 @@ acceptance("New Topic - Anonymous", function () {
acceptance("New Topic - Authenticated", function (needs) {
needs.user();
test("accessing new-topic route when logged in", async (assert) => {
test("accessing new-topic route when logged in", async function (assert) {
await visit(
"/new-topic?title=topic%20title&body=topic%20body&category=bug"
);

View File

@ -7,13 +7,13 @@ import selectKit from "discourse/tests/helpers/select-kit-helper";
acceptance("Notifications filter", function (needs) {
needs.user();
test("Notifications filter true", async (assert) => {
test("Notifications filter true", async function (assert) {
await visit("/u/eviltrout/notifications");
assert.ok(queryAll(".large-notification").length >= 0);
});
test("Notifications filter read", async (assert) => {
test("Notifications filter read", async function (assert) {
await visit("/u/eviltrout/notifications");
const dropdown = selectKit(".notifications-filter");
@ -23,7 +23,7 @@ acceptance("Notifications filter", function (needs) {
assert.ok(queryAll(".large-notification").length >= 0);
});
test("Notifications filter unread", async (assert) => {
test("Notifications filter unread", async function (assert) {
await visit("/u/eviltrout/notifications");
const dropdown = selectKit(".notifications-filter");

View File

@ -25,7 +25,7 @@ acceptance("Page Publishing", function (needs) {
});
});
test("can publish a page via modal", async (assert) => {
test("can publish a page via modal", async function (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");

View File

@ -59,7 +59,7 @@ acceptance("Password Reset", function (needs) {
});
});
test("Password Reset Page", async (assert) => {
test("Password Reset Page", async function (assert) {
PreloadStore.store("password_reset", { is_developer: false });
await visit("/u/password-reset/myvalidtoken");
@ -93,7 +93,7 @@ acceptance("Password Reset", function (needs) {
assert.ok(DiscourseURL.redirectTo.calledWith("/"), "form is gone");
});
test("Password Reset Page With Second Factor", async (assert) => {
test("Password Reset Page With Second Factor", async function (assert) {
PreloadStore.store("password_reset", {
is_developer: false,
second_factor_required: true,

View File

@ -8,7 +8,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Personal Message", function (needs) {
needs.user();
test("footer edit button", async (assert) => {
test("footer edit button", async function (assert) {
await visit("/t/pm-for-testing/12");
assert.ok(
@ -17,7 +17,7 @@ acceptance("Personal Message", function (needs) {
);
});
test("suggested messages", async (assert) => {
test("suggested messages", async function (assert) {
await visit("/t/pm-for-testing/12");
assert.equal(

View File

@ -11,7 +11,7 @@ acceptance("Plugin Keyboard Shortcuts - Logged In", function (needs) {
needs.hooks.beforeEach(function () {
KeyboardShortcutInitializer.initialize(this.container);
});
test("a plugin can add a keyboard shortcut", async (assert) => {
test("a plugin can add a keyboard shortcut", async function (assert) {
withPluginApi("0.8.38", (api) => {
api.addKeyboardShortcut("]", () => {
$("#qunit-fixture").html(
@ -34,7 +34,7 @@ acceptance("Plugin Keyboard Shortcuts - Anonymous", function (needs) {
needs.hooks.beforeEach(function () {
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 function (assert) {
let spy = sinon.spy(KeyboardShortcuts, "_bindToPath");
withPluginApi("0.8.38", (api) => {
api.addKeyboardShortcut("]", () => {}, {

View File

@ -67,7 +67,7 @@ acceptance("Plugin Outlet - Connector Class", function (needs) {
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`];
});
test("Renders a template into the outlet", async (assert) => {
test("Renders a template into the outlet", async function (assert) {
await visit("/u/eviltrout");
assert.ok(
queryAll(".user-profile-primary-outlet.hello").length === 1,

View File

@ -42,7 +42,7 @@ acceptance("Plugin Outlet - Decorator", function (needs) {
delete Ember.TEMPLATES[`${PREFIX}/discovery-list-container-top/bar`];
});
test("Calls the plugin callback with the rendered outlet", async (assert) => {
test("Calls the plugin callback with the rendered outlet", async function (assert) {
await visit("/");
const fooConnector = queryAll(

View File

@ -25,7 +25,7 @@ acceptance("Plugin Outlet - Multi Template", function (needs) {
clearCache();
});
test("Renders a template into the outlet", async (assert) => {
test("Renders a template into the outlet", async function (assert) {
await visit("/u/eviltrout");
assert.ok(
queryAll(".user-profile-primary-outlet.hello").length === 1,

View File

@ -17,7 +17,7 @@ acceptance("Plugin Outlet - Single Template", function (needs) {
delete Ember.TEMPLATES[CONNECTOR];
});
test("Renders a template into the outlet", async (assert) => {
test("Renders a template into the outlet", async function (assert) {
await visit("/u/eviltrout");
assert.ok(
queryAll(".user-profile-primary-outlet.hello").length === 1,

View File

@ -4,7 +4,7 @@ import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Post - Admin Menu - Anonymous", function () {
test("Enter as a anon user", async (assert) => {
test("Enter as a anon user", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".show-more-actions");
@ -22,7 +22,7 @@ acceptance("Post - Admin Menu - Anonymous", function () {
acceptance("Post - Admin Menu - Authenticated", function (needs) {
needs.user();
test("Enter as a user with group moderator permissions", async (assert) => {
test("Enter as a user with group moderator permissions", async function (assert) {
await visit("/t/topic-for-group-moderators/2480");
await click(".show-more-actions");
await click(".show-post-admin-menu");

View File

@ -71,7 +71,7 @@ function preferencesPretender(server, helper) {
acceptance("User Preferences", function (needs) {
needs.user();
needs.pretender(preferencesPretender);
test("update some fields", async (assert) => {
test("update some fields", async function (assert) {
await visit("/u/eviltrout/preferences");
assert.ok($("body.user-preferences-page").length, "has the body class");
@ -128,12 +128,12 @@ acceptance("User Preferences", function (needs) {
);
});
test("username", async (assert) => {
test("username", async function (assert) {
await visit("/u/eviltrout/preferences/username");
assert.ok(exists("#change_username"), "it has the input element");
});
test("email", async (assert) => {
test("email", async function (assert) {
await visit("/u/eviltrout/preferences/email");
assert.ok(exists("#change-email"), "it has the input element");
@ -147,7 +147,7 @@ acceptance("User Preferences", function (needs) {
);
});
test("email field always shows up", async (assert) => {
test("email field always shows up", async function (assert) {
await visit("/u/eviltrout/preferences/email");
assert.ok(exists("#change-email"), "it has the input element");
@ -161,7 +161,7 @@ acceptance("User Preferences", function (needs) {
assert.ok(exists("#change-email"), "it has the input element");
});
test("connected accounts", async (assert) => {
test("connected accounts", async function (assert) {
await visit("/u/eviltrout/preferences/account");
assert.ok(
@ -182,7 +182,7 @@ acceptance("User Preferences", function (needs) {
.indexOf("Connect") > -1;
});
test("second factor totp", async (assert) => {
test("second factor totp", async function (assert) {
await visit("/u/eviltrout/preferences/second-factor");
assert.ok(exists("#password"), "it has a password input");
@ -203,7 +203,7 @@ acceptance("User Preferences", function (needs) {
);
});
test("second factor security keys", async (assert) => {
test("second factor security keys", async function (assert) {
await visit("/u/eviltrout/preferences/second-factor");
assert.ok(exists("#password"), "it has a password input");
@ -229,7 +229,7 @@ acceptance("User Preferences", function (needs) {
}
});
test("default avatar selector", async (assert) => {
test("default avatar selector", async function (assert) {
await visit("/u/eviltrout/preferences");
await click(".pref-avatar .btn");
@ -266,7 +266,7 @@ acceptance("Second Factor Backups", function (needs) {
});
});
test("second factor backup", async (assert) => {
test("second factor backup", async function (assert) {
updateCurrentUser({ second_factor_enabled: true });
await visit("/u/eviltrout/preferences/second-factor");
await click(".edit-2fa-backup");
@ -294,7 +294,7 @@ acceptance("Avatar selector when selectable avatars is enabled", function (
);
});
test("selectable avatars", async (assert) => {
test("selectable avatars", async function (assert) {
await visit("/u/eviltrout/preferences");
await click(".pref-avatar .btn");
assert.ok(
@ -308,7 +308,7 @@ acceptance("User Preferences when badges are disabled", function (needs) {
needs.settings({ enable_badges: false });
needs.pretender(preferencesPretender);
test("visit my preferences", async (assert) => {
test("visit my preferences", async function (assert) {
await visit("/u/eviltrout/preferences");
assert.ok($("body.user-preferences-page").length, "has the body class");
assert.equal(
@ -319,7 +319,7 @@ acceptance("User Preferences when badges are disabled", function (needs) {
assert.ok(exists(".user-preferences"), "it shows the preferences");
});
test("recently connected devices", async (assert) => {
test("recently connected devices", async function (assert) {
await visit("/u/eviltrout/preferences");
assert.equal(
@ -374,7 +374,7 @@ acceptance(
});
});
test("setting featured topic on profile", async (assert) => {
test("setting featured topic on profile", async function (assert) {
await visit("/u/eviltrout/preferences/profile");
assert.ok(
@ -429,7 +429,7 @@ acceptance("Custom User Fields", function (needs) {
});
needs.pretender(preferencesPretender);
test("can select an option from a dropdown", async (assert) => {
test("can select an option from a dropdown", async function (assert) {
await visit("/u/eviltrout/preferences/profile");
assert.ok(exists(".user-field"), "it has at least one user field");
await click(".user-field.dropdown");
@ -455,7 +455,7 @@ acceptance(
top_menu: "categories|latest|top|bookmarks",
});
test("selecting bookmarks as home directs home to bookmarks", async (assert) => {
test("selecting bookmarks as home directs home to bookmarks", async function (assert) {
await visit("/u/eviltrout/preferences/interface");
assert.ok(exists(".home .combo-box"), "it has a home selector combo-box");

View File

@ -22,7 +22,7 @@ acceptance("Raw Plugin Outlet", function (needs) {
needs.hooks.afterEach(() => {
removeRawTemplate(CONNECTOR);
});
test("Renders the raw plugin outlet", async (assert) => {
test("Renders the raw plugin outlet", async function (assert) {
await visit("/");
assert.ok(queryAll(".topic-lala").length > 0, "it renders the outlet");
assert.equal(

View File

@ -20,7 +20,7 @@ acceptance("Redirect to Top", function (needs) {
});
needs.user();
test("redirects categories to weekly top", async (assert) => {
test("redirects categories to weekly top", async function (assert) {
updateCurrentUser({
should_be_redirected_to_top: true,
redirected_to_top: {
@ -37,7 +37,7 @@ acceptance("Redirect to Top", function (needs) {
);
});
test("redirects latest to monthly top", async (assert) => {
test("redirects latest to monthly top", async function (assert) {
updateCurrentUser({
should_be_redirected_to_top: true,
redirected_to_top: {
@ -50,7 +50,7 @@ acceptance("Redirect to Top", function (needs) {
assert.equal(currentPath(), "discovery.topMonthly", "it works for latest");
});
test("redirects root to All top", async (assert) => {
test("redirects root to All top", async function (assert) {
updateCurrentUser({
should_be_redirected_to_top: true,
redirected_to_top: {

View File

@ -6,7 +6,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Reports", function (needs) {
needs.user();
test("Visit reports page", async (assert) => {
test("Visit reports page", async function (assert) {
await visit("/admin/reports");
assert.equal($(".reports-list .report").length, 1);
@ -21,7 +21,7 @@ acceptance("Reports", function (needs) {
);
});
test("Visit report page", async (assert) => {
test("Visit report page", async function (assert) {
await visit("/admin/reports/staff_logins");
assert.ok(exists(".export-csv-btn"));

View File

@ -9,7 +9,7 @@ acceptance("Review", function (needs) {
const user = ".reviewable-item[data-reviewable-id=1234]";
test("It returns a list of reviewable items", async (assert) => {
test("It returns a list of reviewable items", async function (assert) {
await visit("/review");
assert.ok(queryAll(".reviewable-item").length, "has a list of items");
@ -28,7 +28,7 @@ acceptance("Review", function (needs) {
);
});
test("Grouped by topic", async (assert) => {
test("Grouped by topic", async function (assert) {
await visit("/review/topics");
assert.ok(
queryAll(".reviewable-topic").length,
@ -36,7 +36,7 @@ acceptance("Review", function (needs) {
);
});
test("Settings", async (assert) => {
test("Settings", async function (assert) {
await visit("/review/settings");
assert.ok(
@ -52,7 +52,7 @@ acceptance("Review", function (needs) {
assert.ok(queryAll(".reviewable-settings .saved").length, "it saved");
});
test("Flag related", async (assert) => {
test("Flag related", async function (assert) {
await visit("/review");
assert.ok(
@ -72,7 +72,7 @@ acceptance("Review", function (needs) {
);
});
test("Flag related", async (assert) => {
test("Flag related", async function (assert) {
await visit("/review/1");
assert.ok(
@ -81,7 +81,7 @@ acceptance("Review", function (needs) {
);
});
test("Clicking the buttons triggers actions", async (assert) => {
test("Clicking the buttons triggers actions", async function (assert) {
await visit("/review");
await click(`${user} .reviewable-action.approve`);
assert.equal(
@ -91,7 +91,7 @@ acceptance("Review", function (needs) {
);
});
test("Editing a reviewable", async (assert) => {
test("Editing a reviewable", async function (assert) {
const topic = ".reviewable-item[data-reviewable-id=4321]";
await visit("/review");
assert.ok(queryAll(`${topic} .reviewable-action.approve`).length);

View File

@ -91,7 +91,7 @@ acceptance("Search - Full Page", function (needs) {
});
});
test("perform various searches", async (assert) => {
test("perform various searches", async function (assert) {
await visit("/search");
assert.ok($("body.search-page").length, "has body class");
@ -111,7 +111,7 @@ acceptance("Search - Full Page", function (needs) {
assert.ok(queryAll(".fps-topic").length === 1, "has one post");
});
test("escape search term", async (assert) => {
test("escape search term", async function (assert) {
await visit("/search");
await fillIn(".search-query", "@<script>prompt(1337)</script>gmail.com");
@ -123,7 +123,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
skip("update username through advanced search ui", async (assert) => {
skip("update username through advanced search ui", async function (assert) {
await visit("/search");
await fillIn(".search-query", "none");
await fillIn(".search-advanced-options .user-selector", "admin");
@ -156,7 +156,7 @@ acceptance("Search - Full Page", function (needs) {
});
});
test("update category through advanced search ui", async (assert) => {
test("update category through advanced search ui", async function (assert) {
const categoryChooser = selectKit(
".search-advanced-options .category-chooser"
);
@ -180,7 +180,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update in:title filter through advanced search ui", async (assert) => {
test("update in:title filter through advanced search ui", async function (assert) {
await visit("/search");
await fillIn(".search-query", "none");
await click(".search-advanced-options .in-title");
@ -203,7 +203,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update in:likes filter through advanced search ui", async (assert) => {
test("update in:likes filter through advanced search ui", async function (assert) {
await visit("/search");
await fillIn(".search-query", "none");
await click(".search-advanced-options .in-likes");
@ -219,7 +219,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update in:personal filter through advanced search ui", async (assert) => {
test("update in:personal filter through advanced search ui", async function (assert) {
await visit("/search");
await fillIn(".search-query", "none");
await click(".search-advanced-options .in-private");
@ -243,7 +243,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update in:seen filter through advanced search ui", async (assert) => {
test("update in:seen filter through advanced search ui", async function (assert) {
await visit("/search");
await fillIn(".search-query", "none");
await click(".search-advanced-options .in-seen");
@ -267,7 +267,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update in filter through advanced search ui", async (assert) => {
test("update in filter through advanced search ui", async function (assert) {
const inSelector = selectKit(".search-advanced-options .select-kit#in");
await visit("/search");
@ -288,7 +288,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update status through advanced search ui", async (assert) => {
test("update status through advanced search ui", async function (assert) {
const statusSelector = selectKit(
".search-advanced-options .select-kit#status"
);
@ -311,7 +311,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("doesn't update status filter header if wrong value entered through searchbox", async (assert) => {
test("doesn't update status filter header if wrong value entered through searchbox", async function (assert) {
const statusSelector = selectKit(
".search-advanced-options .select-kit#status"
);
@ -323,7 +323,7 @@ acceptance("Search - Full Page", function (needs) {
assert.equal(statusSelector.header().label(), "any", 'has "any" populated');
});
test("doesn't update in filter header if wrong value entered through searchbox", async (assert) => {
test("doesn't update in filter header if wrong value entered through searchbox", async function (assert) {
const inSelector = selectKit(".search-advanced-options .select-kit#in");
await visit("/search");
@ -333,7 +333,7 @@ acceptance("Search - Full Page", function (needs) {
assert.equal(inSelector.header().label(), "any", 'has "any" populated');
});
test("update post time through advanced search ui", async (assert) => {
test("update post time through advanced search ui", async function (assert) {
await visit("/search?expanded=true&q=after:2018-08-22");
assert.equal(
@ -366,7 +366,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update min post count through advanced search ui", async (assert) => {
test("update min post count through advanced search ui", async function (assert) {
await visit("/search");
await fillIn(".search-query", "none");
await fillIn("#search-min-post-count", "5");
@ -383,7 +383,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("update max post count through advanced search ui", async (assert) => {
test("update max post count through advanced search ui", async function (assert) {
await visit("/search");
await fillIn(".search-query", "none");
await fillIn("#search-max-post-count", "5");
@ -400,7 +400,7 @@ acceptance("Search - Full Page", function (needs) {
);
});
test("validate advanced search when initially empty", async (assert) => {
test("validate advanced search when initially empty", async function (assert) {
await visit("/search?expanded=true");
await click(".search-advanced-options .in-likes");

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Search - Mobile", function (needs) {
needs.mobileView();
test("search", async (assert) => {
test("search", async function (assert) {
await visit("/");
await click("#search-button");

View File

@ -19,7 +19,7 @@ acceptance("Search - Anonymous", function (needs) {
});
});
test("search", async (assert) => {
test("search", async function (assert) {
await visit("/");
await click("#search-button");
@ -48,7 +48,7 @@ acceptance("Search - Anonymous", function (needs) {
);
});
test("search for a tag", async (assert) => {
test("search for a tag", async function (assert) {
await visit("/");
await click("#search-button");
@ -58,7 +58,7 @@ acceptance("Search - Anonymous", function (needs) {
assert.ok(exists(".search-menu .results ul li"), "it shows results");
});
test("search scope checkbox", async (assert) => {
test("search scope checkbox", async function (assert) {
await visit("/tag/important");
await click("#search-button");
assert.ok(
@ -91,7 +91,7 @@ acceptance("Search - Anonymous", function (needs) {
);
});
test("Search with context", async (assert) => {
test("Search with context", async function (assert) {
await visit("/t/internationalization-localization/280/1");
await click("#search-button");
@ -126,7 +126,7 @@ acceptance("Search - Anonymous", function (needs) {
assert.ok(!$(".search-context input[type=checkbox]").is(":checked"));
});
test("Right filters are shown to anonymous users", async (assert) => {
test("Right filters are shown to anonymous users", async function (assert) {
const inSelector = selectKit(".select-kit#in");
await visit("/search?expanded=true");
@ -153,7 +153,7 @@ acceptance("Search - Anonymous", function (needs) {
acceptance("Search - Authenticated", function (needs) {
needs.user();
test("Right filters are shown to logged-in users", async (assert) => {
test("Right filters are shown to logged-in users", async function (assert) {
const inSelector = selectKit(".select-kit#in");
await visit("/search?expanded=true");
@ -181,7 +181,7 @@ acceptance("Search - with tagging enabled", function (needs) {
needs.user();
needs.settings({ tagging_enabled: true });
test("displays tags", async (assert) => {
test("displays tags", async function (assert) {
await visit("/");
await click("#search-button");

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Share and Invite modal - desktop", function (needs) {
needs.user();
test("Topic footer button", async (assert) => {
test("Topic footer button", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(
@ -69,7 +69,7 @@ acceptance("Share and Invite modal - desktop", function (needs) {
);
});
test("Post date link", async (assert) => {
test("Post date link", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#post_2 .post-info.post-date a");
@ -80,7 +80,7 @@ acceptance("Share and Invite modal - desktop", function (needs) {
acceptance("Share url with badges disabled - desktop", function (needs) {
needs.user();
needs.settings({ enable_badges: false });
test("topic footer button - badges disabled - desktop", async (assert) => {
test("topic footer button - badges disabled - desktop", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-button-share-and-invite");

View File

@ -9,7 +9,7 @@ acceptance("Share and Invite modal - mobile", function (needs) {
needs.user();
needs.mobileView();
test("Topic footer mobile button", async (assert) => {
test("Topic footer mobile button", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(
@ -57,7 +57,7 @@ acceptance("Share and Invite modal - mobile", function (needs) {
);
});
test("Post date link", async (assert) => {
test("Post date link", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#post_2 .post-info.post-date a");
@ -71,7 +71,7 @@ acceptance("Share url with badges disabled - mobile", function (needs) {
needs.settings({
enable_badges: false,
});
test("topic footer button - badges disabled - mobile", async (assert) => {
test("topic footer button - badges disabled - mobile", async function (assert) {
await visit("/t/internationalization-localization/280");
const subject = selectKit(".topic-footer-mobile-dropdown");

View File

@ -5,7 +5,7 @@ import selectKit from "discourse/tests/helpers/select-kit-helper";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Shared Drafts", function () {
test("Viewing", async (assert) => {
test("Viewing", async function (assert) {
await visit("/t/some-topic/9");
assert.ok(queryAll(".shared-draft-controls").length === 1);
let categoryChooser = selectKit(".shared-draft-controls .category-chooser");

View File

@ -5,7 +5,7 @@ import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Signing In", function () {
test("sign in", async (assert) => {
test("sign in", async function (assert) {
await visit("/");
await click("header .login-button");
assert.ok(exists(".login-modal"), "it shows the login modal");
@ -29,7 +29,7 @@ acceptance("Signing In", function () {
);
});
test("sign in - not activated", async (assert) => {
test("sign in - not activated", async function (assert) {
await visit("/");
await click("header .login-button");
assert.ok(exists(".login-modal"), "it shows the login modal");
@ -51,7 +51,7 @@ acceptance("Signing In", function () {
assert.ok(!exists(".modal-body small"), "it escapes the email address");
});
test("sign in - not activated - edit email", async (assert) => {
test("sign in - not activated - edit email", async function (assert) {
await visit("/");
await click("header .login-button");
assert.ok(exists(".login-modal"), "it shows the login modal");
@ -72,7 +72,7 @@ acceptance("Signing In", function () {
assert.equal(queryAll(".modal-body b").text(), "different@example.com");
});
test("second factor", async (assert) => {
test("second factor", async function (assert) {
await visit("/");
await click("header .login-button");
@ -105,7 +105,7 @@ acceptance("Signing In", function () {
);
});
test("security key", async (assert) => {
test("security key", async function (assert) {
await visit("/");
await click("header .login-button");
@ -131,7 +131,7 @@ acceptance("Signing In", function () {
assert.not(exists("#login-button:visible"), "hides the login button");
});
test("create account", async (assert) => {
test("create account", async function (assert) {
await visit("/");
await click("header .sign-up-button");
@ -170,7 +170,7 @@ acceptance("Signing In", function () {
);
});
test("second factor backup - valid token", async (assert) => {
test("second factor backup - valid token", async function (assert) {
await visit("/");
await click("header .login-button");
await fillIn("#login-account-name", "eviltrout");
@ -186,7 +186,7 @@ acceptance("Signing In", function () {
);
});
test("second factor backup - invalid token", async (assert) => {
test("second factor backup - invalid token", async function (assert) {
await visit("/");
await click("header .login-button");
await fillIn("#login-account-name", "eviltrout");

View File

@ -4,7 +4,7 @@ import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Static", function () {
test("Static Pages", async (assert) => {
test("Static Pages", async function (assert) {
await visit("/faq");
assert.ok($("body.static-faq").length, "has the body class");
assert.ok(exists(".body-page"), "The content is present");

View File

@ -35,7 +35,7 @@ acceptance("Tag Groups", function (needs) {
});
});
test("tag groups can be saved and deleted", async (assert) => {
test("tag groups can be saved and deleted", async function (assert) {
const tags = selectKit(".tag-chooser");
await visit("/tag_groups");
@ -51,7 +51,7 @@ acceptance("Tag Groups", function (needs) {
assert.ok(!queryAll(".tag-group-content .btn.btn-danger")[0].disabled);
});
test("tag groups can have multiple groups added to them", async (assert) => {
test("tag groups can have multiple groups added to them", async function (assert) {
const tags = selectKit(".tag-chooser");
const groups = selectKit(".group-chooser");

View File

@ -31,7 +31,7 @@ acceptance("Tags intersection", function (needs) {
});
});
test("Populate tags when creating new topic", async (assert) => {
test("Populate tags when creating new topic", async function (assert) {
await visit("/tags/intersection/first/second");
await click("#create-topic");

View File

@ -10,7 +10,7 @@ import {
acceptance("Tags", function (needs) {
needs.user();
test("list the tags", async (assert) => {
test("list the tags", async function (assert) {
await visit("/tags");
assert.ok($("body.tags-page").length, "has the body class");
@ -85,7 +85,7 @@ acceptance("Tags listed by group", function (needs) {
);
});
test("list the tags in groups", async (assert) => {
test("list the tags in groups", async function (assert) {
await visit("/tags");
assert.equal(
$(".tag-list").length,
@ -126,7 +126,7 @@ acceptance("Tags listed by group", function (needs) {
);
});
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 function (assert) {
updateCurrentUser({ moderator: false, admin: false });
await visit("/tag/regular-tag");
@ -225,7 +225,7 @@ acceptance("Tag info", function (needs) {
);
});
test("tag info can show synonyms", async (assert) => {
test("tag info can show synonyms", async function (assert) {
updateCurrentUser({ moderator: false, admin: false });
await visit("/tag/planters");
@ -250,7 +250,7 @@ acceptance("Tag info", function (needs) {
assert.ok(!exists("#delete-tag"), "can't delete tag");
});
test("admin can manage tags", async (assert) => {
test("admin can manage tags", async function (assert) {
updateCurrentUser({ moderator: false, admin: true });
await visit("/tag/planters");

View File

@ -7,7 +7,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Topic - Admin Menu Anonymous Users", function () {
test("Enter as a regular user", async (assert) => {
test("Enter as a regular user", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(exists("#topic"), "The topic was rendered");
assert.ok(
@ -19,7 +19,7 @@ acceptance("Topic - Admin Menu Anonymous Users", function () {
acceptance("Topic - Admin Menu", function (needs) {
needs.user();
test("Enter as a user with group moderator permissions", async (assert) => {
test("Enter as a user with group moderator permissions", async function (assert) {
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
await visit("/t/topic-for-group-moderators/2480");
@ -30,7 +30,7 @@ acceptance("Topic - Admin Menu", function (needs) {
);
});
test("Enter as a user with moderator and admin permissions", async (assert) => {
test("Enter as a user with moderator and admin permissions", async function (assert) {
updateCurrentUser({ moderator: true, admin: true, trust_level: 4 });
await visit("/t/internationalization-localization/280");
@ -41,7 +41,7 @@ acceptance("Topic - Admin Menu", function (needs) {
);
});
test("Toggle the menu as admin focuses the first item", async (assert) => {
test("Toggle the menu as admin focuses the first item", async function (assert) {
updateCurrentUser({ admin: true });
await visit("/t/internationalization-localization/280");

View File

@ -5,7 +5,7 @@ import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Topic - Anonymous", function () {
test("Enter a Topic", async (assert) => {
test("Enter a Topic", async function (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");
@ -15,24 +15,24 @@ acceptance("Topic - Anonymous", function () {
);
});
test("Enter without an id", async (assert) => {
test("Enter without an id", async function (assert) {
await visit("/t/internationalization-localization");
assert.ok(exists("#topic"), "The topic was rendered");
});
test("Enter a 404 topic", async (assert) => {
test("Enter a 404 topic", async function (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");
});
test("Enter without access", async (assert) => {
test("Enter without access", async function (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");
});
test("Enter with 500 errors", async (assert) => {
test("Enter with 500 errors", async function (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");

View File

@ -13,7 +13,7 @@ acceptance("Topic Discovery", function (needs) {
show_pinned_excerpt_desktop: true,
});
test("Visit Discovery Pages", async (assert) => {
test("Visit Discovery Pages", async function (assert) {
await visit("/");
assert.ok($("body.navigation-topics").length, "has the default navigation");
assert.ok(exists(".topic-list"), "The list of topics was rendered");
@ -72,7 +72,7 @@ acceptance("Topic Discovery", function (needs) {
);
});
test("Clearing state after leaving a category", async (assert) => {
test("Clearing state after leaving a category", async function (assert) {
await visit("/c/dev");
assert.ok(
exists(".topic-list-item[data-topic-id=11994] .topic-excerpt"),
@ -85,7 +85,7 @@ acceptance("Topic Discovery", function (needs) {
);
});
test("Live update unread state", async (assert) => {
test("Live update unread state", async function (assert) {
await visit("/");
assert.ok(
exists(".topic-list-item:not(.visited) a[data-topic-id='11995']"),
@ -114,7 +114,7 @@ acceptance("Topic Discovery", function (needs) {
);
});
test("Using period chooser when query params are present", async (assert) => {
test("Using period chooser when query params are present", async function (assert) {
await visit("/top?f=foo&d=bar");
sinon.stub(DiscourseURL, "routeTo");

View File

@ -25,7 +25,7 @@ acceptance("Topic - Edit timer", function (needs) {
);
});
test("default", async (assert) => {
test("default", async function (assert) {
updateCurrentUser({ moderator: true });
const futureDateInputSelector = selectKit(".future-date-input-selector");
@ -40,7 +40,7 @@ acceptance("Topic - Edit timer", function (needs) {
assert.equal(futureDateInputSelector.header().value(), null);
});
test("autoclose - specific time", async (assert) => {
test("autoclose - specific time", async function (assert) {
updateCurrentUser({ moderator: true });
const futureDateInputSelector = selectKit(".future-date-input-selector");
@ -61,7 +61,7 @@ acceptance("Topic - Edit timer", function (needs) {
assert.ok(regex.test(html));
});
skip("autoclose", async (assert) => {
skip("autoclose", async function (assert) {
updateCurrentUser({ moderator: true });
const futureDateInputSelector = selectKit(".future-date-input-selector");
@ -123,7 +123,7 @@ acceptance("Topic - Edit timer", function (needs) {
assert.ok(regex3.test(html3));
});
test("close temporarily", async (assert) => {
test("close temporarily", async function (assert) {
updateCurrentUser({ moderator: true });
const timerType = selectKit(".select-kit.timer-type");
const futureDateInputSelector = selectKit(".future-date-input-selector");
@ -174,7 +174,7 @@ acceptance("Topic - Edit timer", function (needs) {
assert.ok(regex2.test(html2));
});
test("schedule", async (assert) => {
test("schedule", async function (assert) {
updateCurrentUser({ moderator: true });
const timerType = selectKit(".select-kit.timer-type");
const categoryChooser = selectKit(".modal-body .category-chooser");
@ -212,7 +212,7 @@ acceptance("Topic - Edit timer", function (needs) {
assert.ok(regex.test(text));
});
test("TL4 can't auto-delete", async (assert) => {
test("TL4 can't auto-delete", async function (assert) {
updateCurrentUser({ moderator: false, admin: false, trust_level: 4 });
await visit("/t/internationalization-localization");
@ -226,7 +226,7 @@ acceptance("Topic - Edit timer", function (needs) {
assert.ok(!timerType.rowByValue("delete").exists());
});
test("auto delete", async (assert) => {
test("auto delete", async function (assert) {
updateCurrentUser({ moderator: true });
const timerType = selectKit(".select-kit.timer-type");
const futureDateInputSelector = selectKit(".future-date-input-selector");
@ -257,7 +257,7 @@ acceptance("Topic - Edit timer", function (needs) {
assert.ok(regex.test(html));
});
test("Inline delete timer", async (assert) => {
test("Inline delete timer", async function (assert) {
updateCurrentUser({ moderator: true });
const futureDateInputSelector = selectKit(".future-date-input-selector");

View File

@ -37,7 +37,7 @@ acceptance("Topic footer buttons mobile", function (needs) {
_test = undefined;
});
test("default", async (assert) => {
test("default", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.equal(_test, null);

View File

@ -8,7 +8,7 @@ import {
} from "discourse/lib/topic-list-tracker";
acceptance("Topic list tracking", function () {
test("Navigation", async (assert) => {
test("Navigation", async function (assert) {
await visit("/");
let url = await nextTopicUrl();
assert.equal(url, "/t/error-after-upgrade-to-0-9-7-9/11557");

Some files were not shown because too many files have changed in this diff Show More