diff --git a/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-item-test.js b/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-item-test.js index 70bace09ad..ff2356ba6e 100644 --- a/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-item-test.js +++ b/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-item-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { moduleForComponent } from "ember-qunit"; import I18n from "I18n"; import componentTest from "discourse/tests/helpers/component-test"; @@ -13,7 +14,11 @@ componentTest("default theme", { test(assert) { assert.expect(1); - assert.equal(find(".d-icon-check").length, 1, "shows default theme icon"); + assert.equal( + queryAll(".d-icon-check").length, + 1, + "shows default theme icon" + ); }, }); @@ -28,7 +33,11 @@ componentTest("pending updates", { test(assert) { assert.expect(1); - assert.equal(find(".d-icon-sync").length, 1, "shows pending update icon"); + assert.equal( + queryAll(".d-icon-sync").length, + 1, + "shows pending update icon" + ); }, }); @@ -47,7 +56,7 @@ componentTest("broken theme", { test(assert) { assert.expect(1); assert.equal( - find(".d-icon-exclamation-circle").length, + queryAll(".d-icon-exclamation-circle").length, 1, "shows broken theme icon" ); @@ -75,7 +84,7 @@ componentTest("with children", { test(assert) { assert.expect(2); assert.deepEqual( - find(".components") + queryAll(".components") .text() .trim() .split(",") @@ -88,7 +97,7 @@ componentTest("with children", { "lists the first 4 children" ); assert.deepEqual( - find(".others-count").text().trim(), + queryAll(".others-count").text().trim(), I18n.t("admin.customize.theme.and_x_more", { count: 1 }), "shows count of remaining children" ); diff --git a/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-test.js b/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-test.js index 7dc377972f..0eaa6ebd79 100644 --- a/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-test.js +++ b/app/assets/javascripts/admin/tests/admin/integration/components/themes-list-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { moduleForComponent } from "ember-qunit"; import I18n from "I18n"; import componentTest from "discourse/tests/helpers/component-test"; @@ -29,36 +30,40 @@ componentTest("current tab is themes", { test(assert) { assert.equal( - find(".themes-tab").hasClass("active"), + queryAll(".themes-tab").hasClass("active"), true, "themes tab is active" ); assert.equal( - find(".components-tab").hasClass("active"), + queryAll(".components-tab").hasClass("active"), false, "components tab is not active" ); assert.equal( - find(".inactive-indicator").index(), + queryAll(".inactive-indicator").index(), -1, "there is no inactive themes separator when all themes are inactive" ); - assert.equal(find(".themes-list-item").length, 5, "displays all themes"); + assert.equal( + queryAll(".themes-list-item").length, + 5, + "displays all themes" + ); [2, 3].forEach((num) => this.themes[num].set("user_selectable", true)); this.themes[4].set("default", true); this.set("themes", this.themes); const names = [4, 2, 3, 0, 1].map((num) => this.themes[num].get("name")); // default theme always on top, followed by user-selectable ones and then the rest assert.deepEqual( - Array.from(find(".themes-list-item").find(".name")).map((node) => + Array.from(queryAll(".themes-list-item .name")).map((node) => node.innerText.trim() ), names, "sorts themes correctly" ); assert.equal( - find(".inactive-indicator").index(), + queryAll(".inactive-indicator").index(), 3, "the separator is in the right location" ); @@ -66,19 +71,19 @@ componentTest("current tab is themes", { this.themes.forEach((theme) => theme.set("user_selectable", true)); this.set("themes", this.themes); assert.equal( - find(".inactive-indicator").index(), + queryAll(".inactive-indicator").index(), -1, "there is no inactive themes separator when all themes are user-selectable" ); this.set("themes", []); assert.equal( - find(".themes-list-item").length, + queryAll(".themes-list-item").length, 1, "shows one entry with a message when there is nothing to display" ); assert.equal( - find(".themes-list-item span.empty").text().trim(), + queryAll(".themes-list-item span.empty").text().trim(), I18n.t("admin.customize.theme.empty"), "displays the right message" ); @@ -109,35 +114,35 @@ componentTest("current tab is components", { test(assert) { assert.equal( - find(".components-tab").hasClass("active"), + queryAll(".components-tab").hasClass("active"), true, "components tab is active" ); assert.equal( - find(".themes-tab").hasClass("active"), + queryAll(".themes-tab").hasClass("active"), false, "themes tab is not active" ); assert.equal( - find(".inactive-indicator").index(), + queryAll(".inactive-indicator").index(), -1, "there is no separator" ); assert.equal( - find(".themes-list-item").length, + queryAll(".themes-list-item").length, 5, "displays all components" ); this.set("components", []); assert.equal( - find(".themes-list-item").length, + queryAll(".themes-list-item").length, 1, "shows one entry with a message when there is nothing to display" ); assert.equal( - find(".themes-list-item span.empty").text().trim(), + queryAll(".themes-list-item span.empty").text().trim(), I18n.t("admin.customize.theme.empty"), "displays the right message" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js b/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js index 3c576b0fa4..a7111dd861 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit, click, fillIn } from "@ember/test-helpers"; import { test } from "qunit"; @@ -13,7 +14,7 @@ acceptance("Account Created", function () { assert.ok(exists(".account-created")); assert.equal( - find(".account-created .ac-message").text().trim(), + queryAll(".account-created .ac-message").text().trim(), "Hello World", "it displays the message" ); @@ -32,7 +33,7 @@ acceptance("Account Created", function () { assert.ok(exists(".account-created")); assert.equal( - find(".account-created .ac-message").text().trim(), + queryAll(".account-created .ac-message").text().trim(), "Hello World", "it displays the message" ); @@ -40,7 +41,7 @@ acceptance("Account Created", function () { await click(".activation-controls .resend"); assert.equal(currentPath(), "account-created.resent"); - const email = find(".account-created .ac-message b").text(); + const email = queryAll(".account-created .ac-message b").text(); assert.equal(email, "eviltrout@example.com"); }); @@ -57,7 +58,7 @@ acceptance("Account Created", function () { await click(".activation-controls .edit-email"); assert.equal(currentPath(), "account-created.edit-email"); - assert.ok(find(".activation-controls .btn-primary:disabled").length); + assert.ok(queryAll(".activation-controls .btn-primary:disabled").length); await click(".activation-controls .edit-cancel"); @@ -76,16 +77,16 @@ acceptance("Account Created", function () { await click(".activation-controls .edit-email"); - assert.ok(find(".activation-controls .btn-primary:disabled").length); + assert.ok(queryAll(".activation-controls .btn-primary:disabled").length); await fillIn(".activate-new-email", "newemail@example.com"); - assert.notOk(find(".activation-controls .btn-primary:disabled").length); + assert.notOk(queryAll(".activation-controls .btn-primary:disabled").length); await click(".activation-controls .btn-primary"); assert.equal(currentPath(), "account-created.resent"); - const email = find(".account-created .ac-message b").text(); + const email = queryAll(".account-created .ac-message b").text(); assert.equal(email, "newemail@example.com"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js index 9f5423203e..871a229dd6 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { fillIn, click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -32,9 +33,9 @@ acceptance("Admin - Emails", function (needs) { await fillIn("textarea.email-body", EMAIL.trim()); await click(".email-advanced-test button"); - assert.equal(find(".text pre").text(), "Hello, this is a test!"); + assert.equal(queryAll(".text pre").text(), "Hello, this is a test!"); assert.equal( - find(".elided pre").text(), + queryAll(".elided pre").text(), "---\n\nThis part should be elided." ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js index e4a53346f1..cf9d843dbc 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { fillIn, click, visit, currentURL } from "@ember/test-helpers"; import { test } from "qunit"; @@ -30,7 +31,7 @@ acceptance("Admin - Site Texts", function (needs) { test("edit and revert a site text by key", async (assert) => { await visit("/admin/customize/site_texts/site.test"); - assert.equal(find(".title h3").text(), "site.test"); + assert.equal(queryAll(".title h3").text(), "site.test"); assert.ok(!exists(".saved")); assert.ok(!exists(".revert-site-text")); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js index 1ba5f9a764..244af8af9a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit, click, fillIn } from "@ember/test-helpers"; import { test } from "qunit"; @@ -28,38 +29,38 @@ acceptance("Admin - Suspend User", function (needs) { await visit("/admin/users/1234/regular"); await click(".suspend-user"); - assert.equal(find(".suspend-user-modal:visible").length, 1); + assert.equal(queryAll(".suspend-user-modal:visible").length, 1); await click(".d-modal-cancel"); - assert.equal(find(".suspend-user-modal:visible").length, 0); + assert.equal(queryAll(".suspend-user-modal:visible").length, 0); }); test("suspend a user - cancel with input", async (assert) => { await visit("/admin/users/1234/regular"); await click(".suspend-user"); - assert.equal(find(".suspend-user-modal:visible").length, 1); + assert.equal(queryAll(".suspend-user-modal:visible").length, 1); await fillIn(".suspend-reason", "for breaking the rules"); await fillIn(".suspend-message", "this is an email reason why"); await click(".d-modal-cancel"); - assert.equal(find(".bootbox.modal:visible").length, 1); + assert.equal(queryAll(".bootbox.modal:visible").length, 1); await click(".modal-footer .btn-default"); - assert.equal(find(".suspend-user-modal:visible").length, 1); + assert.equal(queryAll(".suspend-user-modal:visible").length, 1); assert.equal( - find(".suspend-message")[0].value, + queryAll(".suspend-message")[0].value, "this is an email reason why" ); await click(".d-modal-cancel"); - assert.equal(find(".bootbox.modal:visible").length, 1); - assert.equal(find(".suspend-user-modal:visible").length, 0); + assert.equal(queryAll(".bootbox.modal:visible").length, 1); + assert.equal(queryAll(".suspend-user-modal:visible").length, 0); await click(".modal-footer .btn-primary"); - assert.equal(find(".bootbox.modal:visible").length, 0); + assert.equal(queryAll(".bootbox.modal:visible").length, 0); }); test("suspend, then unsuspend a user", async (assert) => { @@ -74,7 +75,7 @@ acceptance("Admin - Suspend User", function (needs) { await click(".suspend-user"); assert.equal( - find(".perform-suspend[disabled]").length, + queryAll(".perform-suspend[disabled]").length, 1, "disabled by default" ); @@ -86,14 +87,14 @@ acceptance("Admin - Suspend User", function (needs) { await fillIn(".suspend-message", "this is an email reason why"); assert.equal( - find(".perform-suspend[disabled]").length, + queryAll(".perform-suspend[disabled]").length, 0, "no longer disabled" ); await click(".perform-suspend"); - assert.equal(find(".suspend-user-modal:visible").length, 0); + assert.equal(queryAll(".suspend-user-modal:visible").length, 0); assert.ok(exists(".suspension-info")); await click(".unsuspend-user"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js index 8e95cb1365..3a9e081ec7 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import I18n from "I18n"; @@ -5,13 +6,13 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers"; function assertNoSecondary(assert) { assert.equal( - find(".display-row.email .value a").text(), + queryAll(".display-row.email .value a").text(), "eviltrout@example.com", "it should display the primary email" ); assert.equal( - find(".display-row.secondary-emails .value").text().trim(), + queryAll(".display-row.secondary-emails .value").text().trim(), I18n.t("user.email.no_secondary"), "it should not display secondary emails" ); @@ -19,13 +20,13 @@ function assertNoSecondary(assert) { function assertMultipleSecondary(assert, firstEmail, secondEmail) { assert.equal( - find(".display-row.secondary-emails .value li:first-of-type a").text(), + queryAll(".display-row.secondary-emails .value li:first-of-type a").text(), firstEmail, "it should display the first secondary email" ); assert.equal( - find(".display-row.secondary-emails .value li:last-of-type a").text(), + queryAll(".display-row.secondary-emails .value li:last-of-type a").text(), secondEmail, "it should display the second secondary email" ); @@ -44,7 +45,7 @@ acceptance("Admin - User Emails", function (needs) { await visit("/admin/users/3/markvanlan"); assert.equal( - find(".display-row.email .value a").text(), + queryAll(".display-row.email .value a").text(), "markvanlan@example.com", "it should display the user's primary email" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js index 246cdff90c..dad654e177 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; import selectKit from "discourse/tests/helpers/select-kit-helper"; @@ -41,26 +42,29 @@ acceptance("Admin - User Index", function (needs) { test("can edit username", async (assert) => { await visit("/admin/users/2/sam"); - assert.equal(find(".display-row.username .value").text().trim(), "sam"); + assert.equal(queryAll(".display-row.username .value").text().trim(), "sam"); // Trying cancel. await click(".display-row.username button"); await fillIn(".display-row.username .value input", "new-sam"); await click(".display-row.username a"); - assert.equal(find(".display-row.username .value").text().trim(), "sam"); + assert.equal(queryAll(".display-row.username .value").text().trim(), "sam"); // Doing edit. await click(".display-row.username button"); await fillIn(".display-row.username .value input", "new-sam"); await click(".display-row.username button"); - assert.equal(find(".display-row.username .value").text().trim(), "new-sam"); + assert.equal( + queryAll(".display-row.username .value").text().trim(), + "new-sam" + ); }); test("will clear unsaved groups when switching user", async (assert) => { await visit("/admin/users/2/sam"); assert.equal( - find(".display-row.username .value").text().trim(), + queryAll(".display-row.username .value").text().trim(), "sam", "the name should be correct" ); @@ -73,13 +77,13 @@ acceptance("Admin - User Index", function (needs) { await visit("/admin/users/1/eviltrout"); assert.equal( - find(".display-row.username .value").text().trim(), + queryAll(".display-row.username .value").text().trim(), "eviltrout", "the name should be correct" ); assert.equal( - find('.group-chooser span[title="Macdonald"]').length, + queryAll('.group-chooser span[title="Macdonald"]').length, 0, "group should not be set" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js index 754d0dcb36..8efbf5192a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -22,7 +23,7 @@ acceptance("Admin - Users List", function (needs) { await click(".users-list .sortable:nth-child(1)"); assert.ok( - find(".users-list .user:nth-child(1) .username") + queryAll(".users-list .user:nth-child(1) .username") .text() .includes("eviltrout"), "list should be sorted by username" @@ -31,7 +32,7 @@ acceptance("Admin - Users List", function (needs) { await click(".users-list .sortable:nth-child(1)"); assert.ok( - find(".users-list .user:nth-child(1) .username") + queryAll(".users-list .user:nth-child(1) .username") .text() .includes("discobot"), "list should be sorted ascending by username" @@ -46,7 +47,7 @@ acceptance("Admin - Users List", function (needs) { await click(".show-emails"); assert.equal( - find(".users-list .user:nth-child(1) .email").text(), + queryAll(".users-list .user:nth-child(1) .email").text(), "eviltrout@example.com", "shows the emails" ); @@ -54,7 +55,7 @@ acceptance("Admin - Users List", function (needs) { await click(".hide-emails"); assert.equal( - find(".users-list .user:nth-child(1) .email").text(), + queryAll(".users-list .user:nth-child(1) .email").text(), "", "hides the emails" ); @@ -68,36 +69,36 @@ acceptance("Admin - Users List", function (needs) { await visit("/admin/users/list/active"); - assert.equal(find(".admin-title h2").text(), activeTitle); + assert.equal(queryAll(".admin-title h2").text(), activeTitle); assert.ok( - find(".users-list .user:nth-child(1) .username") + queryAll(".users-list .user:nth-child(1) .username") .text() .includes(activeUser) ); await click('a[href="/admin/users/list/new"]'); - assert.equal(find(".admin-title h2").text(), suspectTitle); + assert.equal(queryAll(".admin-title h2").text(), suspectTitle); assert.ok( - find(".users-list .user:nth-child(1) .username") + queryAll(".users-list .user:nth-child(1) .username") .text() .includes(suspectUser) ); await click(".users-list .sortable:nth-child(4)"); - assert.equal(find(".admin-title h2").text(), suspectTitle); + assert.equal(queryAll(".admin-title h2").text(), suspectTitle); assert.ok( - find(".users-list .user:nth-child(1) .username") + queryAll(".users-list .user:nth-child(1) .username") .text() .includes(suspectUser) ); await click('a[href="/admin/users/list/active"]'); - assert.equal(find(".admin-title h2").text(), activeTitle); + assert.equal(queryAll(".admin-title h2").text(), activeTitle); assert.ok( - find(".users-list .user:nth-child(1) .username") + queryAll(".users-list .user:nth-child(1) .username") .text() .includes(activeUser) ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js index 0ae92108fa..ce2b6a258d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { fillIn, click, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -18,7 +19,7 @@ acceptance("Admin - Watched Words", function (needs) { await fillIn(".admin-controls .controls input[type=text]", "li"); assert.equal( - find(".watched-words-list .watched-word").length, + queryAll(".watched-words-list .watched-word").length, 1, "When filtering, show words even if checkbox is unchecked." ); @@ -52,7 +53,7 @@ acceptance("Admin - Watched Words", function (needs) { await click(".watched-word-form button"); let found = []; - $.each(find(".watched-words-list .watched-word"), (index, elem) => { + $.each(queryAll(".watched-words-list .watched-word"), (index, elem) => { if ($(elem).text().trim() === "poutine") { found.push(true); } @@ -66,7 +67,7 @@ acceptance("Admin - Watched Words", function (needs) { let word = null; - $.each(find(".watched-words-list .watched-word"), (index, elem) => { + $.each(queryAll(".watched-words-list .watched-word"), (index, elem) => { if ($(elem).text().trim() === "anise") { word = elem; } @@ -74,6 +75,6 @@ acceptance("Admin - Watched Words", function (needs) { await click("#" + $(word).attr("id")); - assert.equal(find(".watched-words-list .watched-word").length, 2); + assert.equal(queryAll(".watched-words-list .watched-word").length, 2); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js index b2a8f178bd..b4226be962 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -154,7 +155,7 @@ acceptance("Bookmarking", function (needs) { assert.ok(exists(".bootbox.modal"), "it asks for delete confirmation"); assert.ok( - find(".bootbox.modal") + queryAll(".bootbox.modal") .text() .includes(I18n.t("bookmarks.confirm_delete")), "it shows delete confirmation message" @@ -188,17 +189,17 @@ acceptance("Bookmarking", function (needs) { await openEditBookmarkModal(); assert.equal( - find("#bookmark-name").val(), + queryAll("#bookmark-name").val(), "Test name", "it should prefill the bookmark name" ); assert.equal( - find("#bookmark-custom-date > input").val(), + queryAll("#bookmark-custom-date > input").val(), tomorrow, "it should prefill the bookmark date" ); assert.equal( - find("#bookmark-custom-time").val(), + queryAll("#bookmark-custom-time").val(), "08:00", "it should prefill the bookmark time" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js index f15ae2c142..a4b8ab0196 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance, visible } from "discourse/tests/helpers/qunit-helpers"; @@ -57,7 +58,7 @@ acceptance("Category Banners", function (needs) { assert.ok(!visible(".bootbox.modal"), "it closes the modal"); assert.ok(visible(".category-read-only-banner"), "it shows a banner"); assert.ok( - find(".category-read-only-banner .inner").length === 1, + queryAll(".category-read-only-banner .inner").length === 1, "it allows staff to embed html in the message" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js index ebb580fc6b..cdefbb2d33 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import selectKit from "discourse/tests/helpers/select-kit-helper"; @@ -9,12 +10,12 @@ acceptance("Category Edit - security", function (needs) { test("default", async (assert) => { await visit("/c/bug/edit/security"); - const $permissionListItems = find(".permission-list li"); + const $firstItem = queryAll(".permission-list li:eq(0)"); - const badgeName = $permissionListItems.eq(0).find(".badge-group").text(); + const badgeName = $firstItem.find(".badge-group").text(); assert.equal(badgeName, "everyone"); - const permission = $permissionListItems.eq(0).find(".permission").text(); + const permission = $firstItem.find(".permission").text(); assert.equal(permission, "Create / Reply / See"); }); @@ -55,7 +56,7 @@ acceptance("Category Edit - security", function (needs) { await permissionSelector.selectRowByValue("2"); await click(".edit-category-tab-security .add-permission"); - const $addedPermissionItem = find( + const $addedPermissionItem = queryAll( ".edit-category-tab-security .permission-list li:nth-child(2)" ); @@ -77,7 +78,7 @@ acceptance("Category Edit - security", function (needs) { ); assert.equal( - find(".edit-category-tab-security .permission-list li").length, + queryAll(".edit-category-tab-security .permission-list li").length, 0, "it removes the permission from the list" ); @@ -87,17 +88,17 @@ acceptance("Category Edit - security", function (needs) { await click(".edit-category-tab-security .add-permission"); assert.equal( - find(".edit-category-tab-security .permission-list li").length, + queryAll(".edit-category-tab-security .permission-list li").length, 1, "it adds the permission to the list" ); - const $permissionListItems = find(".permission-list li"); + const $firstItem = queryAll(".permission-list li:eq(0)"); - const badgeName = $permissionListItems.eq(0).find(".badge-group").text(); + const badgeName = $firstItem.find(".badge-group").text(); assert.equal(badgeName, "everyone"); - const permission = $permissionListItems.eq(0).find(".permission").text(); + const permission = $firstItem.find(".permission").text(); assert.equal(permission, "Create / Reply / See"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js index 4ff87048f7..eb751c85a4 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit, currentURL } from "@ember/test-helpers"; import { test } from "qunit"; import selectKit from "discourse/tests/helpers/select-kit-helper"; @@ -19,9 +20,9 @@ acceptance("Category Edit", function (needs) { "it jumps to the correct screen" ); - assert.equal(find(".badge-category").text(), "bug"); + assert.equal(queryAll(".badge-category").text(), "bug"); await fillIn("input.category-name", "testing"); - assert.equal(find(".badge-category").text(), "testing"); + assert.equal(queryAll(".badge-category").text(), "testing"); await fillIn("#edit-text-color", "#ff0000"); @@ -72,7 +73,7 @@ acceptance("Category Edit", function (needs) { "/c/1-category/edit/general", "it goes to the general tab" ); - assert.equal(find("input.category-name").val(), "bug"); + assert.equal(queryAll("input.category-name").val(), "bug"); }); test("Error Saving", async (assert) => { @@ -81,7 +82,7 @@ acceptance("Category Edit", function (needs) { await click("#save-category"); assert.ok(visible(".bootbox")); - assert.equal(find(".bootbox .modal-body").html(), "duplicate email"); + assert.equal(queryAll(".bootbox .modal-body").html(), "duplicate email"); await click(".bootbox .btn-primary"); assert.ok(!visible(".bootbox")); diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js index 22bd1c7404..21a85d6533 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { fillIn, click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -10,15 +11,15 @@ acceptance("Category New", function (needs) { test("Creating a new category", async (assert) => { await visit("/new-category"); - assert.ok(find(".badge-category")); + assert.ok(queryAll(".badge-category")); await fillIn("input.category-name", "testing"); - assert.equal(find(".badge-category").text(), "testing"); + assert.equal(queryAll(".badge-category").text(), "testing"); await click("#save-category"); assert.equal( - find(".edit-category-title h2").text(), + queryAll(".edit-category-title h2").text(), I18n.t("category.edit_dialog_title", { categoryName: "testing", }) @@ -26,13 +27,13 @@ acceptance("Category New", function (needs) { await click(".edit-category-security a"); assert.ok( - find("button.edit-permission"), + queryAll("button.edit-permission"), "it can switch to the security tab" ); await click(".edit-category-settings a"); assert.ok( - find("#category-search-priority"), + queryAll("#category-search-priority"), "it can switch to the settings tab" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js b/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js index b42ded51b5..5b7b918c07 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, visit, currentURL } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -13,10 +14,13 @@ acceptance("Click Track", function (needs) { test("Do not track mentions", async (assert) => { await visit("/t/internationalization-localization/280"); - assert.ok(find(".user-card.show").length === 0, "card should not appear"); + assert.ok( + queryAll(".user-card.show").length === 0, + "card should not appear" + ); await click("article[data-post-id=3651] a.mention"); - assert.ok(find(".user-card.show").length === 1, "card appear"); + assert.ok(queryAll(".user-card.show").length === 1, "card appear"); assert.equal(currentURL(), "/t/internationalization-localization/280"); assert.ok(!tracked); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js index 14bba57b5d..3721f16858 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -29,8 +30,8 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("reply_as_private_message"); - assert.ok(find("#reply-title").val(), "this is the title"); - assert.ok(find(".d-editor-input").val(), "this is the reply"); + assert.ok(queryAll("#reply-title").val(), "this is the title"); + assert.ok(queryAll(".d-editor-input").val(), "this is the reply"); }); test("replying to post", async (assert) => { @@ -60,9 +61,10 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("reply_as_private_message"); - assert.equal(find(".users-input .item:eq(0)").text(), "codinghorror"); + assert.equal(queryAll(".users-input .item:eq(0)").text(), "codinghorror"); assert.ok( - find(".d-editor-input").val().indexOf("Continuing the discussion") >= 0 + queryAll(".d-editor-input").val().indexOf("Continuing the discussion") >= + 0 ); }); @@ -80,15 +82,15 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("reply_to_topic"); assert.equal( - find(".action-title .topic-link").text().trim(), + queryAll(".action-title .topic-link").text().trim(), "Internationalization / localization" ); assert.equal( - find(".action-title .topic-link").attr("href"), + queryAll(".action-title .topic-link").attr("href"), "/t/internationalization-localization/280" ); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "test replying to topic when initially replied to post" ); }); @@ -107,7 +109,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("toggle_whisper"); assert.ok( - find(".composer-fields .whisper .d-icon-far-eye-slash").length === 1 + queryAll(".composer-fields .whisper .d-icon-far-eye-slash").length === 1 ); }); @@ -135,10 +137,10 @@ acceptance("Composer Actions", function (needs) { assert.equal(categoryChooserReplyArea.header().name(), "faq"); assert.equal( - find(".action-title").text().trim(), + queryAll(".action-title").text().trim(), I18n.t("topic.create_long") ); - assert.ok(find(".d-editor-input").val().includes(quote)); + assert.ok(queryAll(".d-editor-input").val().includes(quote)); sinon.restore(); }); @@ -148,7 +150,7 @@ acceptance("Composer Actions", function (needs) { const composerActions = selectKit(".composer-actions"); await composerActions.expand(); await composerActions.selectRowByValue("reply_as_new_topic"); - assert.equal(exists(find(".bootbox")), false); + assert.equal(exists(queryAll(".bootbox")), false); }); test("reply_as_new_group_message", async (assert) => { @@ -159,7 +161,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("reply_as_new_group_message"); const items = []; - find(".users-input .item").each((_, item) => + queryAll(".users-input .item").each((_, item) => items.push(item.textContent.trim()) ); @@ -193,10 +195,10 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("reply_to_topic"); assert.equal( - find(".action-title").text().trim(), + queryAll(".action-title").text().trim(), "Internationalization / localization" ); - assert.equal(find(".d-editor-input").val(), quote); + assert.equal(queryAll(".d-editor-input").val(), quote); await composerActions.expand(); @@ -213,12 +215,12 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("reply_to_post"); await composerActions.expand(); - assert.ok(exists(find(".action-title img.avatar"))); + assert.ok(exists(queryAll(".action-title img.avatar"))); assert.equal( - find(".action-title .user-link").text().trim(), + queryAll(".action-title .user-link").text().trim(), "codinghorror" ); - assert.equal(find(".d-editor-input").val(), quote); + assert.equal(queryAll(".d-editor-input").val(), quote); assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic"); assert.equal( composerActions.rowByIndex(1).value(), @@ -233,10 +235,10 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); assert.equal( - find(".action-title").text().trim(), + queryAll(".action-title").text().trim(), I18n.t("topic.create_long") ); - assert.ok(find(".d-editor-input").val().includes(quote)); + assert.ok(queryAll(".d-editor-input").val().includes(quote)); assert.equal(composerActions.rowByIndex(0).value(), "reply_to_post"); assert.equal( composerActions.rowByIndex(1).value(), @@ -250,11 +252,12 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); assert.equal( - find(".action-title").text().trim(), + queryAll(".action-title").text().trim(), I18n.t("topic.private_message") ); assert.ok( - find(".d-editor-input").val().indexOf("Continuing the discussion") === 0 + queryAll(".d-editor-input").val().indexOf("Continuing the discussion") === + 0 ); assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic"); assert.equal(composerActions.rowByIndex(1).value(), "reply_to_post"); @@ -269,7 +272,7 @@ acceptance("Composer Actions", function (needs) { await click("article#post_3 button.reply"); assert.ok( - find(".composer-fields .no-bump").length === 0, + queryAll(".composer-fields .no-bump").length === 0, "no-bump text is not visible" ); @@ -277,7 +280,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("toggle_topic_bump"); assert.ok( - find(".composer-fields .no-bump").length === 1, + queryAll(".composer-fields .no-bump").length === 1, "no-bump icon is visible" ); @@ -285,7 +288,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("toggle_topic_bump"); assert.ok( - find(".composer-fields .no-bump").length === 0, + queryAll(".composer-fields .no-bump").length === 0, "no-bump icon is not visible" ); }); @@ -341,9 +344,10 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("reply_as_private_message"); - assert.equal(find(".users-input .item:eq(0)").text(), "uwe_keim"); + assert.equal(queryAll(".users-input .item:eq(0)").text(), "uwe_keim"); assert.ok( - find(".d-editor-input").val().indexOf("Continuing the discussion") >= 0 + queryAll(".d-editor-input").val().indexOf("Continuing the discussion") >= + 0 ); }); @@ -406,16 +410,16 @@ acceptance("Composer Actions With New Topic Draft", function (needs) { assert.equal(tags.header().value(), "monkey", "tags are not reset"); assert.equal( - find("#reply-title").val(), + queryAll("#reply-title").val(), "This is the new text for the title using 'quotes'" ); assert.equal( - find("#reply-control .btn-primary.create .d-button-label").text(), + queryAll("#reply-control .btn-primary.create .d-button-label").text(), I18n.t("composer.create_shared_draft") ); - assert.ok(find("#reply-control.composing-shared-draft").length === 1); + assert.ok(queryAll("#reply-control.composing-shared-draft").length === 1); await click(".modal-footer .btn.btn-default"); } finally { toggleCheckDraftPopup(false); @@ -431,7 +435,7 @@ acceptance("Composer Actions With New Topic Draft", function (needs) { stubDraftResponse(); await composerActions.selectRowByValue("reply_as_new_topic"); assert.equal( - find(".bootbox .modal-body").text(), + queryAll(".bootbox .modal-body").text(), I18n.t("composer.composer_actions.reply_as_new_topic.confirm") ); await click(".modal-footer .btn.btn-default"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js index 861526800c..519e68b9d2 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -21,7 +22,7 @@ async function writeInComposer(assert) { await fillIn(".d-editor-input", "[test](upload://abcdefg.png)"); assert.equal( - find(".d-editor-preview:visible").html().trim(), + queryAll(".d-editor-preview:visible").html().trim(), '
' ); @@ -35,7 +36,7 @@ acceptance("Composer Attachment", function (needs) { test("attachments are cooked properly", async (assert) => { await writeInComposer(assert); assert.equal( - find(".d-editor-preview:visible").html().trim(), + queryAll(".d-editor-preview:visible").html().trim(), '' ); }); @@ -49,7 +50,7 @@ acceptance("Composer Attachment - Secure Media Enabled", function (needs) { test("attachments are cooked properly when secure media is enabled", async (assert) => { await writeInComposer(assert); assert.equal( - find(".d-editor-preview:visible").html().trim(), + queryAll(".d-editor-preview:visible").html().trim(), '' ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js index ddc27e1114..83f637ccf3 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; import I18n from "I18n"; @@ -21,12 +22,12 @@ acceptance("Composer - Edit conflict", function (needs) { await fillIn(".d-editor-input", "this will 409"); await click("#reply-control button.create"); assert.equal( - find("#reply-control button.create").text().trim(), + queryAll("#reply-control button.create").text().trim(), I18n.t("composer.overwrite_edit"), "it shows the overwrite button" ); assert.ok( - find("#draft-status .d-icon-user-edit"), + queryAll("#draft-status .d-icon-user-edit"), "error icon should be there" ); await click(".modal .btn-primary"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js index 8510c73783..425285ac38 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -24,7 +25,7 @@ acceptance("Composer - Hyperlink", function (needs) { await click(".modal-footer button.btn-primary"); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "This is a link to [Google](https://google.com)", "adds link with url and text, prepends 'https://'" ); @@ -42,7 +43,7 @@ acceptance("Composer - Hyperlink", function (needs) { await click(".modal-footer button.btn-danger"); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "Reset textarea contents.", "doesn’t insert anything after cancelling" ); @@ -52,7 +53,7 @@ acceptance("Composer - Hyperlink", function (needs) { "modal dismissed after cancelling" ); - const textarea = find("#reply-control .d-editor-input")[0]; + const textarea = queryAll("#reply-control .d-editor-input")[0]; textarea.selectionStart = 0; textarea.selectionEnd = 6; await click(".d-editor button.link"); @@ -61,7 +62,7 @@ acceptance("Composer - Hyperlink", function (needs) { await click(".modal-footer button.btn-primary"); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "[Reset](https://somelink.com) textarea contents.", "adds link to a selected text" ); @@ -92,7 +93,7 @@ acceptance("Composer - Hyperlink", function (needs) { ); assert.ok( - find(".link-url").val().includes("http"), + queryAll(".link-url").val().includes("http"), "replaces link url field with internal link" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js index 7734325cb6..ee0c0d7df1 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -29,7 +30,7 @@ http://www.example.com/has-title.html ); assert.equal( - find(".d-editor-preview:visible").html().trim(), + queryAll(".d-editor-preview:visible").html().trim(), `
This is another test This is a great title
this is the content of a post
", "it previews content" ); @@ -74,7 +75,7 @@ acceptance("Composer", function (needs) { "the body is now good" ); - const textarea = find("#reply-control .d-editor-input")[0]; + const textarea = queryAll("#reply-control .d-editor-input")[0]; textarea.selectionStart = textarea.value.length; textarea.selectionEnd = textarea.value.length; @@ -89,7 +90,7 @@ acceptance("Composer", function (needs) { const example = I18n.t(`composer.bold_text`); assert.equal( - find("#reply-control .d-editor-input").val().trim(), + queryAll("#reply-control .d-editor-input").val().trim(), `this is the *content* of a post**${example}**`, "it supports keyboard shortcuts" ); @@ -153,43 +154,46 @@ acceptance("Composer", function (needs) { }, }; - await find(".wmd-controls").trigger("fileuploadsend", data1); - assert.equal(find(".d-editor-input").val(), "[Uploading: test.png...]() "); - - await find(".wmd-controls").trigger("fileuploadsend", data2); + await queryAll(".wmd-controls").trigger("fileuploadsend", data1); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), + "[Uploading: test.png...]() " + ); + + await queryAll(".wmd-controls").trigger("fileuploadsend", data2); + assert.equal( + queryAll(".d-editor-input").val(), "[Uploading: test.png...]() [Uploading: test.png(1)...]() " ); - await find(".wmd-controls").trigger("fileuploadsend", data4); + await queryAll(".wmd-controls").trigger("fileuploadsend", data4); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "[Uploading: test.png...]() [Uploading: test.png(1)...]() [Uploading: ima++ge.png...]() ", "should accept files with unescaped characters" ); - await find(".wmd-controls").trigger("fileuploadsend", data3); + await queryAll(".wmd-controls").trigger("fileuploadsend", data3); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "[Uploading: test.png...]() [Uploading: test.png(1)...]() [Uploading: ima++ge.png...]() [Uploading: image.png...]() " ); - await find(".wmd-controls").trigger("fileuploaddone", data2); + await queryAll(".wmd-controls").trigger("fileuploaddone", data2); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "[Uploading: test.png...]()  [Uploading: ima++ge.png...]() [Uploading: image.png...]() " ); - await find(".wmd-controls").trigger("fileuploaddone", data3); + await queryAll(".wmd-controls").trigger("fileuploaddone", data3); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "[Uploading: test.png...]()  [Uploading: ima++ge.png...]()  " ); - await find(".wmd-controls").trigger("fileuploaddone", data1); + await queryAll(".wmd-controls").trigger("fileuploaddone", data1); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "  [Uploading: ima++ge.png...]()  " ); }); @@ -242,7 +246,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", "custom message"); await click("#reply-control button.create"); assert.equal( - find(".bootbox .modal-body").text(), + queryAll(".bootbox .modal-body").text(), "This is a custom response" ); assert.equal(currentURL(), "/", "it doesn't change routes"); @@ -273,7 +277,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", "this is the content of my reply"); await click("#reply-control button.create"); assert.equal( - find(".cooked:last p").text(), + queryAll(".cooked:last p").text(), "If you use gettext format you could leverage Launchpad 13 translations and the community behind it." ); }); @@ -291,7 +295,7 @@ acceptance("Composer", function (needs) { assert.ok(!visible(".bootbox.modal")); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "this is the content of my reply" ); }); @@ -311,7 +315,7 @@ acceptance("Composer", function (needs) { await click(".btn-reply-here"); assert.equal( - find(".cooked:last p").text(), + queryAll(".cooked:last p").text(), "If you use gettext format you could leverage Launchpad 13 translations and the community behind it." ); }); @@ -319,7 +323,7 @@ acceptance("Composer", function (needs) { test("Create an enqueued Reply", async (assert) => { await visit("/t/internationalization-localization/280"); - assert.notOk(find(".pending-posts .reviewable-item").length); + assert.notOk(queryAll(".pending-posts .reviewable-item").length); await click("#topic-footer-buttons .btn.create"); assert.ok(exists(".d-editor-input"), "the composer input is visible"); @@ -331,7 +335,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", "enqueue this content please"); await click("#reply-control button.create"); assert.ok( - find(".cooked:last p").text() !== "enqueue this content please", + queryAll(".cooked:last p").text() !== "enqueue this content please", "it doesn't insert the post" ); @@ -340,7 +344,7 @@ acceptance("Composer", function (needs) { await click(".modal-footer button"); assert.ok(invisible(".d-modal"), "the modal can be dismissed"); - assert.ok(find(".pending-posts .reviewable-item").length); + assert.ok(queryAll(".pending-posts .reviewable-item").length); }); test("Edit the first post", async (assert) => { @@ -354,7 +358,7 @@ acceptance("Composer", function (needs) { await click(".topic-post:eq(0) button.show-more-actions"); await click(".topic-post:eq(0) button.edit"); assert.equal( - find(".d-editor-input").val().indexOf("Any plans to support"), + queryAll(".d-editor-input").val().indexOf("Any plans to support"), 0, "it populates the input with the post text" ); @@ -368,13 +372,13 @@ acceptance("Composer", function (needs) { "it has the edits icon" ); assert.ok( - find("#topic-title h1") + queryAll("#topic-title h1") .text() .indexOf("This is the new text for the title") !== -1, "it shows the new title" ); assert.ok( - find(".topic-post:eq(0) .cooked") + queryAll(".topic-post:eq(0) .cooked") .text() .indexOf("This is the new text for the post") !== -1, "it updates the post" @@ -386,13 +390,13 @@ acceptance("Composer", function (needs) { await click(".topic-post:eq(0) button.edit"); assert.equal( - find(".d-editor-input").val().indexOf("This is the first post."), + queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" ); await click(".topic-post:eq(1) button.edit"); assert.equal( - find(".d-editor-input").val().indexOf("This is the second post."), + queryAll(".d-editor-input").val().indexOf("This is the second post."), 0, "it populates the input with the post text" ); @@ -408,7 +412,7 @@ acceptance("Composer", function (needs) { await click(".modal-footer a:eq(0)"); assert.equal( - find(".d-editor-input").val().indexOf("This is the second post."), + queryAll(".d-editor-input").val().indexOf("This is the second post."), 0, "it populates the input with the post text" ); @@ -419,15 +423,15 @@ acceptance("Composer", function (needs) { await click(".topic-post:eq(0) button.edit"); assert.equal( - find(".d-editor-input").val().indexOf("This is the first post."), + queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" ); await click(".topic-post:eq(0) button.reply"); - assert.equal(find(".d-editor-input").val(), "", "it clears the input"); + assert.equal(queryAll(".d-editor-input").val(), "", "it clears the input"); await click(".topic-post:eq(0) button.edit"); assert.equal( - find(".d-editor-input").val().indexOf("This is the first post."), + queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" ); @@ -443,7 +447,7 @@ acceptance("Composer", function (needs) { await menu.selectRowByValue("toggleWhisper"); assert.ok( - find(".composer-fields .whisper .d-icon-far-eye-slash").length === 1, + queryAll(".composer-fields .whisper .d-icon-far-eye-slash").length === 1, "it sets the post type to whisper" ); @@ -451,7 +455,7 @@ acceptance("Composer", function (needs) { await menu.selectRowByValue("toggleWhisper"); assert.ok( - find(".composer-fields .whisper .d-icon-far-eye-slash").length === 0, + queryAll(".composer-fields .whisper .d-icon-far-eye-slash").length === 0, "it removes the whisper mode" ); @@ -473,21 +477,21 @@ acceptance("Composer", function (needs) { await click(".topic-post:eq(0) button.reply"); assert.ok( - find("#reply-control.open").length === 1, + queryAll("#reply-control.open").length === 1, "it starts in open state by default" ); await click(".toggle-fullscreen"); assert.ok( - find("#reply-control.fullscreen").length === 1, + queryAll("#reply-control.fullscreen").length === 1, "it expands composer to full screen" ); await click(".toggle-fullscreen"); assert.ok( - find("#reply-control.open").length === 1, + queryAll("#reply-control.open").length === 1, "it collapses composer to regular size" ); @@ -495,14 +499,14 @@ acceptance("Composer", function (needs) { await click(".toggler"); assert.ok( - find("#reply-control.draft").length === 1, + queryAll("#reply-control.draft").length === 1, "it collapses composer to draft bar" ); await click(".toggle-fullscreen"); assert.ok( - find("#reply-control.open").length === 1, + queryAll("#reply-control.open").length === 1, "from draft, it expands composer back to open state" ); }); @@ -517,7 +521,7 @@ acceptance("Composer", function (needs) { ); assert.ok( - find(".composer-fields .whisper .d-icon-far-eye-slash").length === 1, + queryAll(".composer-fields .whisper .d-icon-far-eye-slash").length === 1, "it sets the post type to whisper" ); @@ -526,7 +530,7 @@ acceptance("Composer", function (needs) { await click("#create-topic"); assert.ok( - find(".composer-fields .whisper .d-icon-far-eye-slash").length === 0, + queryAll(".composer-fields .whisper .d-icon-far-eye-slash").length === 0, "it should reset the state of the composer's model" ); @@ -536,7 +540,7 @@ acceptance("Composer", function (needs) { ); assert.ok( - find(".composer-fields .unlist") + queryAll(".composer-fields .unlist") .text() .indexOf(I18n.t("composer.unlist")) > 0, "it sets the topic to unlisted" @@ -546,7 +550,7 @@ acceptance("Composer", function (needs) { await click(".topic-post:eq(0) button.reply"); assert.ok( - find(".composer-fields .whisper") + queryAll(".composer-fields .whisper") .text() .indexOf(I18n.t("composer.unlist")) === -1, "it should reset the state of the composer's model" @@ -562,7 +566,7 @@ acceptance("Composer", function (needs) { assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog"); await click(".modal-footer a:eq(0)"); assert.equal( - find(".d-editor-input").val().indexOf("This is the first post."), + queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" ); @@ -577,12 +581,12 @@ acceptance("Composer", function (needs) { await click(".topic-post:eq(1) button.edit"); assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog"); assert.equal( - find(".modal-footer a:eq(1)").text(), + queryAll(".modal-footer a:eq(1)").text(), I18n.t("post.abandon.no_value") ); await click(".modal-footer a:eq(0)"); assert.equal( - find(".d-editor-input").val().indexOf("This is the second post."), + queryAll(".d-editor-input").val().indexOf("This is the second post."), 0, "it populates the input with the post text" ); @@ -599,12 +603,12 @@ acceptance("Composer", function (needs) { assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog"); assert.equal( - find(".modal-footer a:eq(1)").text(), + queryAll(".modal-footer a:eq(1)").text(), I18n.t("post.abandon.no_save_draft") ); await click(".modal-footer a:eq(1)"); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "", "it populates the input with the post text" ); @@ -620,7 +624,7 @@ acceptance("Composer", function (needs) { await click(".topic-post:eq(0) button.edit"); assert.equal( - find(".modal-body").text(), + queryAll(".modal-body").text(), I18n.t("drafts.abandon.confirm") ); @@ -656,24 +660,24 @@ acceptance("Composer", function (needs) { await composerActions.selectRowByValue("reply_as_private_message"); assert.equal( - find(".modal-body").text(), + queryAll(".modal-body").text(), "", "abandon popup shouldn't come" ); assert.ok( - find(".d-editor-input").val().includes(longText), + queryAll(".d-editor-input").val().includes(longText), "entered text should still be there" ); assert.ok( - find( + queryAll( '.action-title a[href="/t/internationalization-localization/280"]' ), "mode should have changed" ); - assert.ok(find(".save-animation"), "save animation should show"); + assert.ok(queryAll(".save-animation"), "save animation should show"); } finally { toggleCheckDraftPopup(false); } @@ -696,7 +700,7 @@ acceptance("Composer", function (needs) { await click("button.compose-pm"); await click(".modal .btn-default"); - assert.equal(find(".users-input .item:eq(0)").text(), "codinghorror"); + assert.equal(queryAll(".users-input .item:eq(0)").text(), "codinghorror"); } finally { toggleCheckDraftPopup(false); } @@ -712,7 +716,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", ""); assert.equal( - find(".d-editor-container textarea").attr("placeholder"), + queryAll(".d-editor-container textarea").attr("placeholder"), I18n.t("composer.reply_placeholder"), "it should not block because of missing category" ); @@ -720,7 +724,7 @@ acceptance("Composer", function (needs) { const assertImageResized = (assert, uploads) => { assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), uploads.join("\n"), "it resizes uploaded image" ); @@ -761,7 +765,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", uploads.join("\n")); assert.ok( - find(".button-wrapper").length === 10, + queryAll(".button-wrapper").length === 10, "it adds correct amount of scaling button groups" ); @@ -769,7 +773,9 @@ acceptance("Composer", function (needs) { uploads[0] = ""; await click( - find(".button-wrapper[data-image-index='0'] .scale-btn[data-scale='50']") + queryAll( + ".button-wrapper[data-image-index='0'] .scale-btn[data-scale='50']" + ) ); assertImageResized(assert, uploads); @@ -777,7 +783,9 @@ acceptance("Composer", function (needs) { uploads[6] = " "; await click( - find(".button-wrapper[data-image-index='3'] .scale-btn[data-scale='50']") + queryAll( + ".button-wrapper[data-image-index='3'] .scale-btn[data-scale='50']" + ) ); assertImageResized(assert, uploads); @@ -785,35 +793,45 @@ acceptance("Composer", function (needs) { uploads[6] = " "; await click( - find(".button-wrapper[data-image-index='4'] .scale-btn[data-scale='75']") + queryAll( + ".button-wrapper[data-image-index='4'] .scale-btn[data-scale='75']" + ) ); assertImageResized(assert, uploads); // Make sure we target the correct image if there are duplicates uploads[7] = ""; await click( - find(".button-wrapper[data-image-index='5'] .scale-btn[data-scale='50']") + queryAll( + ".button-wrapper[data-image-index='5'] .scale-btn[data-scale='50']" + ) ); assertImageResized(assert, uploads); // Try the other dupe uploads[8] = ""; await click( - find(".button-wrapper[data-image-index='6'] .scale-btn[data-scale='75']") + queryAll( + ".button-wrapper[data-image-index='6'] .scale-btn[data-scale='75']" + ) ); assertImageResized(assert, uploads); // Don't mess with image titles uploads[10] = ``; await click( - find(".button-wrapper[data-image-index='8'] .scale-btn[data-scale='75']") + queryAll( + ".button-wrapper[data-image-index='8'] .scale-btn[data-scale='75']" + ) ); assertImageResized(assert, uploads); // Keep data attributes uploads[12] = ``; await click( - find(".button-wrapper[data-image-index='9'] .scale-btn[data-scale='75']") + queryAll( + ".button-wrapper[data-image-index='9'] .scale-btn[data-scale='75']" + ) ); assertImageResized(assert, uploads); @@ -827,7 +845,7 @@ acceptance("Composer", function (needs) { ); assert.ok( - find("script").length === 0, + queryAll("script").length === 0, "it does not unescapes script tags in code blocks" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js index 1a90c0ae87..a918ebdc33 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -16,7 +17,7 @@ acceptance("Composer topic featured links", function (needs) { await click("#create-topic"); await fillIn("#reply-title", "http://www.example.com/has-title.html"); assert.ok( - find(".d-editor-preview").html().trim().indexOf("onebox") > 0, + queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0, "it pastes the link into the body and previews it" ); assert.ok( @@ -24,7 +25,7 @@ acceptance("Composer topic featured links", function (needs) { "the body is now good" ); assert.equal( - find(".title-input input").val(), + queryAll(".title-input input").val(), "An interesting article", "title is from the oneboxed article" ); @@ -35,7 +36,7 @@ acceptance("Composer topic featured links", function (needs) { await click("#create-topic"); await fillIn("#reply-title", "http://www.example.com/no-title.html"); assert.ok( - find(".d-editor-preview").html().trim().indexOf("onebox") > 0, + queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0, "it pastes the link into the body and previews it" ); assert.ok( @@ -43,7 +44,7 @@ acceptance("Composer topic featured links", function (needs) { "the body is now good" ); assert.equal( - find(".title-input input").val(), + queryAll(".title-input input").val(), "http://www.example.com/no-title.html", "title is unchanged" ); @@ -54,7 +55,7 @@ acceptance("Composer topic featured links", function (needs) { await click("#create-topic"); await fillIn("#reply-title", "http://www.example.com/nope-onebox.html"); assert.ok( - find(".d-editor-preview").html().trim().indexOf("onebox") > 0, + queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0, "it pastes the link into the body and previews it" ); assert.ok( @@ -62,7 +63,7 @@ acceptance("Composer topic featured links", function (needs) { "link is pasted into body" ); assert.equal( - find(".title-input input").val(), + queryAll(".title-input input").val(), "http://www.example.com/nope-onebox.html", "title is unchanged" ); @@ -74,16 +75,20 @@ acceptance("Composer topic featured links", function (needs) { const title = "http://" + window.location.hostname + "/internal-page.html"; await fillIn("#reply-title", title); assert.equal( - find(".d-editor-preview").html().trim().indexOf("onebox"), + queryAll(".d-editor-preview").html().trim().indexOf("onebox"), -1, "onebox preview doesn't show" ); assert.equal( - find(".d-editor-input").val().length, + queryAll(".d-editor-input").val().length, 0, "link isn't put into the post" ); - assert.equal(find(".title-input input").val(), title, "title is unchanged"); + assert.equal( + queryAll(".title-input input").val(), + title, + "title is unchanged" + ); }); test("link is longer than max title length", async (assert) => { @@ -94,7 +99,7 @@ acceptance("Composer topic featured links", function (needs) { "http://www.example.com/has-title-and-a-url-that-is-more-than-80-characters-because-thats-good-for-seo-i-guess.html" ); assert.ok( - find(".d-editor-preview").html().trim().indexOf("onebox") > 0, + queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0, "it pastes the link into the body and previews it" ); assert.ok( @@ -102,7 +107,7 @@ acceptance("Composer topic featured links", function (needs) { "the body is now good" ); assert.equal( - find(".title-input input").val(), + queryAll(".title-input input").val(), "An interesting article", "title is from the oneboxed article" ); @@ -113,17 +118,17 @@ acceptance("Composer topic featured links", function (needs) { await click("#create-topic"); await fillIn("#reply-title", "http://www.example.com/has-title.html test"); assert.equal( - find(".d-editor-preview").html().trim().indexOf("onebox"), + queryAll(".d-editor-preview").html().trim().indexOf("onebox"), -1, "onebox preview doesn't show" ); assert.equal( - find(".d-editor-input").val().length, + queryAll(".d-editor-input").val().length, 0, "link isn't put into the post" ); assert.equal( - find(".title-input input").val(), + queryAll(".title-input input").val(), "http://www.example.com/has-title.html test", "title is unchanged" ); @@ -145,12 +150,12 @@ acceptance( await visit("/"); await click("#create-topic"); assert.ok( - find(".d-editor-textarea-wrapper.disabled").length, + queryAll(".d-editor-textarea-wrapper.disabled").length, "textarea is disabled" ); await fillIn("#reply-title", "http://www.example.com/has-title.html"); assert.ok( - find(".d-editor-preview").html().trim().indexOf("onebox") > 0, + queryAll(".d-editor-preview").html().trim().indexOf("onebox") > 0, "it pastes the link into the body and previews it" ); assert.ok( @@ -158,12 +163,12 @@ acceptance( "the body is now good" ); assert.equal( - find(".title-input input").val(), + queryAll(".title-input input").val(), "An interesting article", "title is from the oneboxed article" ); assert.ok( - find(".d-editor-textarea-wrapper.disabled").length === 0, + queryAll(".d-editor-textarea-wrapper.disabled").length === 0, "textarea is enabled" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-uncategorized-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-uncategorized-test.js index 81b306a2a6..94663d2df0 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-uncategorized-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-uncategorized-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -36,7 +37,7 @@ acceptance( await categoryChooser.selectRowByValue(2); assert.ok( - find(".d-editor-textarea-wrapper.disabled").length === 0, + queryAll(".d-editor-textarea-wrapper.disabled").length === 0, "textarea is enabled" ); @@ -45,7 +46,7 @@ acceptance( await categoryChooser.selectRowByIndex(0); assert.ok( - find(".d-editor-textarea-wrapper.disabled").length === 0, + queryAll(".d-editor-textarea-wrapper.disabled").length === 0, "textarea is still enabled" ); }); @@ -88,7 +89,7 @@ acceptance( "category errors are hidden by default" ); assert.ok( - find(".d-editor-textarea-wrapper.disabled").length === 0, + queryAll(".d-editor-textarea-wrapper.disabled").length === 0, "textarea is enabled" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js b/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js index 36d6ed5b73..1d5e5f2848 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -36,7 +37,10 @@ acceptance("Create Account - User Fields", function (needs) { await click(".modal-footer .btn-primary"); assert.ok(exists("#modal-alert"), "it shows the required field alert"); - assert.equal(find("#modal-alert").text(), "Please enter an email address"); + assert.equal( + queryAll("#modal-alert").text(), + "Please enter an email address" + ); await fillIn("#new-account-name", "Dr. Good Tuna"); await fillIn("#new-account-password", "cool password bro"); @@ -56,12 +60,12 @@ acceptance("Create Account - User Fields", function (needs) { ); await click(".modal-footer .btn-primary"); - assert.equal(find("#modal-alert")[0].style.display, ""); + assert.equal(queryAll("#modal-alert")[0].style.display, ""); await fillIn(".user-field input[type=text]:first", "Barky"); await click(".user-field input[type=checkbox]"); await click(".modal-footer .btn-primary"); - assert.equal(find("#modal-alert")[0].style.display, "none"); + assert.equal(queryAll("#modal-alert")[0].style.display, "none"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js b/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js index 4a660c9c93..afde1c0ff6 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -16,7 +17,7 @@ acceptance("CustomHTML set", function () { await visit("/static/faq"); assert.equal( - find("span.custom-html-test").text(), + queryAll("span.custom-html-test").text(), "HTML", "it inserted the markup" ); @@ -29,7 +30,7 @@ acceptance("CustomHTML set", function () { await visit("/static/faq"); assert.equal( - find("span.cookie").text(), + queryAll("span.cookie").text(), "monster", "it inserted the markup" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js index c4b0d19e5a..e8f58c12da 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -16,7 +17,7 @@ acceptance("CustomHTML template", function (needs) { test("renders custom template", async (assert) => { await visit("/static/faq"); assert.equal( - find("span.top-span").text(), + queryAll("span.top-span").text(), "TOP", "it inserted the template" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js index 8b2b23579b..bf4269d963 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -78,14 +79,16 @@ acceptance("Dashboard", function (needs) { await click(".dashboard .navigation-item.reports .navigation-link"); assert.equal( - find(".dashboard .reports-index.section .reports-list .report").length, + queryAll(".dashboard .reports-index.section .reports-list .report") + .length, 1 ); await fillIn(".dashboard .filter-reports-input", "flags"); assert.equal( - find(".dashboard .reports-index.section .reports-list .report").length, + queryAll(".dashboard .reports-index.section .reports-list .report") + .length, 0 ); @@ -93,7 +96,8 @@ acceptance("Dashboard", function (needs) { await click(".dashboard .navigation-item.reports .navigation-link"); assert.equal( - find(".dashboard .reports-index.section .reports-list .report").length, + queryAll(".dashboard .reports-index.section .reports-list .report") + .length, 1, "navigating back and forth resets filter" ); @@ -101,7 +105,8 @@ acceptance("Dashboard", function (needs) { await fillIn(".dashboard .filter-reports-input", "activities"); assert.equal( - find(".dashboard .reports-index.section .reports-list .report").length, + queryAll(".dashboard .reports-index.section .reports-list .report") + .length, 1, "filter is case insensitive" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js index aee1daa7a3..5fc9ba7146 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -32,7 +33,7 @@ acceptance("EmojiPicker", function (needs) { await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), ":grinning:", "it adds the emoji code in the editor when selected" ); @@ -47,7 +48,7 @@ acceptance("EmojiPicker", function (needs) { await click("button.emoji.btn"); await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "This is a test input :grinning:", "it adds the emoji code and a leading whitespace when there is text" ); @@ -57,7 +58,7 @@ acceptance("EmojiPicker", function (needs) { await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); assert.equal( - find(".d-editor-input").val(), + queryAll(".d-editor-input").val(), "This is a test input :grinning:", "it adds the emoji code and no leading whitespace when user already entered whitespace" ); @@ -109,14 +110,15 @@ acceptance("EmojiPicker", function (needs) { await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); assert.equal( - find('.section[data-section="recent"] .section-group img.emoji').length, + queryAll('.section[data-section="recent"] .section-group img.emoji') + .length, 2, "it has multiple recent emojis" ); assert.equal( /grinning/.test( - find(".section.recent .section-group img.emoji").first().attr("src") + queryAll(".section.recent .section-group img.emoji").first().attr("src") ), true, "it puts the last used emoji in first" diff --git a/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js b/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js index 31930ff7a9..660db5a718 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { IMAGE_VERSION as v } from "pretty-text/emoji/version"; @@ -12,7 +13,7 @@ acceptance("Emoji", function (needs) { await fillIn(".d-editor-input", "this is an emoji :blonde_woman:"); assert.equal( - find(".d-editor-preview:visible").html().trim(), + queryAll(".d-editor-preview:visible").html().trim(), `this is an emoji 
this is an emoji 
this is a category hashtag #bug
this is a tag hashtag #monkey
` diff --git a/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js b/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js index a2f3ee342d..89a7a7bc72 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -25,7 +26,7 @@ acceptance("Invite Accept", function (needs) { assert.ok(exists("#new-account-email"), "shows the email input"); assert.ok(exists("#new-account-username"), "shows the username input"); assert.equal( - find("#new-account-username").val(), + queryAll("#new-account-username").val(), "invited", "username is prefilled" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js index bc9be72c81..320911e7c6 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; import I18n from "I18n"; @@ -22,7 +23,7 @@ acceptance("Login with email - hide email address taken", function (needs) { await click(".login-with-email-button"); assert.equal( - find(".alert-success").html().trim(), + queryAll(".alert-success").html().trim(), I18n.t("email_login.complete_email_found", { email: "someuser@example.com", }), diff --git a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-no-social-logins-test.js b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-no-social-logins-test.js index e83f82fef0..7567cd2ec4 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-no-social-logins-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-no-social-logins-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -19,6 +20,6 @@ acceptance("Login with email - no social logins", function (needs) { await visit("/"); await click("header .login-button"); - assert.notOk(find(".login-buttons").is(":visible")); + assert.notOk(queryAll(".login-buttons").is(":visible")); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js index 651b5adb56..b59938e5fc 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { fillIn, click, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -35,7 +36,7 @@ acceptance("Login with email", function (needs) { await click(".login-with-email-button"); assert.equal( - find(".alert-error").html(), + queryAll(".alert-error").html(), I18n.t("email_login.complete_username_not_found", { username: "someuser", }), @@ -46,7 +47,7 @@ acceptance("Login with email", function (needs) { await click(".login-with-email-button"); assert.equal( - find(".alert-error").html(), + queryAll(".alert-error").html(), I18n.t("email_login.complete_email_not_found", { email: "someuser@gmail.com", }), @@ -60,7 +61,7 @@ acceptance("Login with email", function (needs) { await click(".login-with-email-button"); assert.equal( - find(".alert-success").html().trim(), + queryAll(".alert-success").html().trim(), I18n.t("email_login.complete_username_found", { username: "someuser" }), "it should display a success message for a valid username" ); @@ -71,7 +72,7 @@ acceptance("Login with email", function (needs) { await click(".login-with-email-button"); assert.equal( - find(".alert-success").html().trim(), + queryAll(".alert-success").html().trim(), I18n.t("email_login.complete_email_found", { email: "someuser@gmail.com", }), diff --git a/app/assets/javascripts/discourse/tests/acceptance/modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/modal-test.js index 71c4b55231..0f802b01c3 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/modal-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/modal-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import I18n from "I18n"; @@ -30,29 +31,32 @@ acceptance("Modal", function (needs) { await visit("/"); assert.ok( - find(".d-modal:visible").length === 0, + queryAll(".d-modal:visible").length === 0, "there is no modal at first" ); await click(".login-button"); - assert.ok(find(".d-modal:visible").length === 1, "modal should appear"); + assert.ok(queryAll(".d-modal:visible").length === 1, "modal should appear"); let controller = controllerFor("modal"); assert.equal(controller.name, "login"); await click(".modal-outer-container"); assert.ok( - find(".d-modal:visible").length === 0, + queryAll(".d-modal:visible").length === 0, "modal should disappear when you click outside" ); assert.equal(controller.name, null); await click(".login-button"); - assert.ok(find(".d-modal:visible").length === 1, "modal should reappear"); + assert.ok( + queryAll(".d-modal:visible").length === 1, + "modal should reappear" + ); await keyEvent("#main-outlet", "keyup", 27); assert.ok( - find(".d-modal:visible").length === 0, + queryAll(".d-modal:visible").length === 0, "ESC should close the modal" ); @@ -62,16 +66,16 @@ acceptance("Modal", function (needs) { run(() => showModal("not-dismissable", {})); - assert.ok(find(".d-modal:visible").length === 1, "modal should appear"); + assert.ok(queryAll(".d-modal:visible").length === 1, "modal should appear"); await click(".modal-outer-container"); assert.ok( - find(".d-modal:visible").length === 1, + queryAll(".d-modal:visible").length === 1, "modal should not disappear when you click outside" ); await keyEvent("#main-outlet", "keyup", 27); assert.ok( - find(".d-modal:visible").length === 1, + queryAll(".d-modal:visible").length === 1, "ESC should not close the modal" ); }); @@ -87,7 +91,7 @@ acceptance("Modal", function (needs) { run(() => showModal("test-raw-title-panels", { panels })); assert.equal( - find(".d-modal .modal-tab:first-child").text().trim(), + queryAll(".d-modal .modal-tab:first-child").text().trim(), "Test 1", "it should display the raw title" ); @@ -103,7 +107,7 @@ acceptance("Modal", function (needs) { run(() => showModal("test-title", { title: "test_title" })); assert.equal( - find(".d-modal .title").text().trim(), + queryAll(".d-modal .title").text().trim(), "Test title", "it should display the title" ); @@ -112,7 +116,7 @@ acceptance("Modal", function (needs) { run(() => showModal("test-title-with-body", { title: "test_title" })); assert.equal( - find(".d-modal .title").text().trim(), + queryAll(".d-modal .title").text().trim(), "Test title", "it should display the title when used with d-modal-body" ); @@ -121,7 +125,7 @@ acceptance("Modal", function (needs) { run(() => showModal("test-title")); assert.ok( - find(".d-modal .title").length === 0, + queryAll(".d-modal .title").length === 0, "it should not re-use the previous title" ); }); @@ -138,17 +142,17 @@ acceptance("Modal Keyboard Events", function (needs) { await keyEvent(".d-modal", "keyup", 13); assert.ok( - find("#modal-alert:visible").length === 1, + queryAll("#modal-alert:visible").length === 1, "hitting Enter triggers modal action" ); assert.ok( - find(".d-modal:visible").length === 1, + queryAll(".d-modal:visible").length === 1, "hitting Enter does not dismiss modal due to alert error" ); await keyEvent("#main-outlet", "keyup", 27); assert.ok( - find(".d-modal:visible").length === 0, + queryAll(".d-modal:visible").length === 0, "ESC should close the modal" ); @@ -158,7 +162,7 @@ acceptance("Modal Keyboard Events", function (needs) { await keyEvent(".d-modal", "keyup", 13); assert.ok( - find(".d-modal:visible").length === 0, + queryAll(".d-modal:visible").length === 0, "modal should disappear on hitting Enter" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js b/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js index d566787f6c..9fc2484c9d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -23,17 +24,17 @@ acceptance("New Message - Authenticated", function (needs) { assert.ok(exists(".composer-fields"), "it opens composer"); assert.equal( - find("#reply-title").val().trim(), + queryAll("#reply-title").val().trim(), "message title", "it pre-fills message title" ); assert.equal( - find(".d-editor-input").val().trim(), + queryAll(".d-editor-input").val().trim(), "message body", "it pre-fills message body" ); assert.equal( - find(".users-input .item:eq(0)").text().trim(), + queryAll(".users-input .item:eq(0)").text().trim(), "charlie", "it selects correct username" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js index ceb22ec7f9..cd211b6167 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -21,12 +22,12 @@ acceptance("New Topic - Authenticated", function (needs) { assert.ok(exists(".composer-fields"), "it opens composer"); assert.equal( - find("#reply-title").val().trim(), + queryAll("#reply-title").val().trim(), "topic title", "it pre-fills topic title" ); assert.equal( - find(".d-editor-input").val().trim(), + queryAll(".d-editor-input").val().trim(), "topic body", "it pre-fills topic body" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/notifications-filter-test.js b/app/assets/javascripts/discourse/tests/acceptance/notifications-filter-test.js index 9b5013bd48..a4ec9a19e9 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/notifications-filter-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/notifications-filter-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -9,7 +10,7 @@ acceptance("Notifications filter", function (needs) { test("Notifications filter true", async (assert) => { await visit("/u/eviltrout/notifications"); - assert.ok(find(".large-notification").length >= 0); + assert.ok(queryAll(".large-notification").length >= 0); }); test("Notifications filter read", async (assert) => { @@ -19,7 +20,7 @@ acceptance("Notifications filter", function (needs) { await dropdown.expand(); await dropdown.selectRowByValue("read"); - assert.ok(find(".large-notification").length >= 0); + assert.ok(queryAll(".large-notification").length >= 0); }); test("Notifications filter unread", async (assert) => { @@ -29,6 +30,6 @@ acceptance("Notifications filter", function (needs) { await dropdown.expand(); await dropdown.selectRowByValue("unread"); - assert.ok(find(".large-notification").length >= 0); + assert.ok(queryAll(".large-notification").length >= 0); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js b/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js index 56a9e0b6ad..ec79b84b74 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/password-reset-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit, click, fillIn } from "@ember/test-helpers"; import { test } from "qunit"; @@ -70,7 +71,7 @@ acceptance("Password Reset", function (needs) { await fillIn(".password-reset input", "123"); assert.ok(exists(".password-reset .tip.bad"), "input is not valid"); assert.ok( - find(".password-reset .tip.bad") + queryAll(".password-reset .tip.bad") .html() .indexOf(I18n.t("user.password.too_short")) > -1, "password too short" @@ -80,7 +81,7 @@ acceptance("Password Reset", function (needs) { await click(".password-reset form button"); assert.ok(exists(".password-reset .tip.bad"), "input is not valid"); assert.ok( - find(".password-reset .tip.bad") + queryAll(".password-reset .tip.bad") .html() .indexOf("is the name of your cat") > -1, "server validation error message shows" @@ -109,7 +110,7 @@ acceptance("Password Reset", function (needs) { assert.ok(exists(".alert-error"), "shows 2 factor error"); assert.ok( - find(".alert-error").html().indexOf("invalid token") > -1, + queryAll(".alert-error").html().indexOf("invalid token") > -1, "shows server validation error message" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js b/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js index 6411d53345..d27b79d315 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -20,7 +21,7 @@ acceptance("Personal Message", function (needs) { await visit("/t/pm-for-testing/12"); assert.equal( - find("#suggested-topics .suggested-topics-title").text().trim(), + queryAll("#suggested-topics .suggested-topics-title").text().trim(), I18n.t("suggested_topics.pm_title") ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js index ccf520dec3..b7897f3d56 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { visit, click } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -69,22 +70,26 @@ acceptance("Plugin Outlet - Connector Class", function (needs) { test("Renders a template into the outlet", async (assert) => { await visit("/u/eviltrout"); assert.ok( - find(".user-profile-primary-outlet.hello").length === 1, + queryAll(".user-profile-primary-outlet.hello").length === 1, "it has class names" ); assert.ok( - !find(".user-profile-primary-outlet.dont-render").length, + !queryAll(".user-profile-primary-outlet.dont-render").length, "doesn't render" ); await click(".say-hello"); assert.equal( - find(".hello-result").text(), + queryAll(".hello-result").text(), "hello!", "actions delegate properly" ); await click(".say-hi"); - assert.equal(find(".hi-result").text(), "hi!", "actions delegate properly"); + assert.equal( + queryAll(".hi-result").text(), + "hi!", + "actions delegate properly" + ); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js index fcfa69f2e2..721f555eca 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -44,8 +45,12 @@ acceptance("Plugin Outlet - Decorator", function (needs) { test("Calls the plugin callback with the rendered outlet", async (assert) => { await visit("/"); - const fooConnector = find(".discovery-list-container-top-outlet.foo ")[0]; - const barConnector = find(".discovery-list-container-top-outlet.bar ")[0]; + const fooConnector = queryAll( + ".discovery-list-container-top-outlet.foo " + )[0]; + const barConnector = queryAll( + ".discovery-list-container-top-outlet.bar " + )[0]; assert.ok(exists(fooConnector)); assert.equal(fooConnector.style.backgroundColor, "yellow"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js index 30163072f2..be36be14fe 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -27,20 +28,20 @@ acceptance("Plugin Outlet - Multi Template", function (needs) { test("Renders a template into the outlet", async (assert) => { await visit("/u/eviltrout"); assert.ok( - find(".user-profile-primary-outlet.hello").length === 1, + queryAll(".user-profile-primary-outlet.hello").length === 1, "it has class names" ); assert.ok( - find(".user-profile-primary-outlet.goodbye").length === 1, + queryAll(".user-profile-primary-outlet.goodbye").length === 1, "it has class names" ); assert.equal( - find(".hello-span").text(), + queryAll(".hello-span").text(), "Hello", "it renders into the outlet" ); assert.equal( - find(".bye-span").text(), + queryAll(".bye-span").text(), "Goodbye", "it renders into the outlet" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js index 2296e870d9..75eedd4403 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -19,11 +20,11 @@ acceptance("Plugin Outlet - Single Template", function (needs) { test("Renders a template into the outlet", async (assert) => { await visit("/u/eviltrout"); assert.ok( - find(".user-profile-primary-outlet.hello").length === 1, + queryAll(".user-profile-primary-outlet.hello").length === 1, "it has class names" ); assert.equal( - find(".hello-username").text(), + queryAll(".hello-username").text(), "eviltrout", "it renders into the outlet" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js b/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js index 3a5a7a759e..55b8fa9f24 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit, currentURL, click, fillIn } from "@ember/test-helpers"; import { test } from "qunit"; @@ -85,7 +86,7 @@ acceptance("User Preferences", function (needs) { assert.ok(!exists(".saved"), "it hasn't been saved yet"); await click(".save-changes"); assert.ok(exists(".saved"), "it displays the saved message"); - find(".saved").remove(); + queryAll(".saved").remove(); }; fillIn(".pref-name input[type=text]", "Jon Snow"); @@ -140,7 +141,7 @@ acceptance("User Preferences", function (needs) { await fillIn("#change-email", "invalidemail"); assert.equal( - find(".tip.bad").text().trim(), + queryAll(".tip.bad").text().trim(), I18n.t("user.email.invalid"), "it should display invalid email tip" ); @@ -168,7 +169,7 @@ acceptance("User Preferences", function (needs) { "it has the connected accounts section" ); assert.ok( - find(".pref-associated-accounts table tr:first td:first") + queryAll(".pref-associated-accounts table tr:first td:first") .html() .indexOf("Facebook") > -1, "it lists facebook" @@ -176,7 +177,7 @@ acceptance("User Preferences", function (needs) { await click(".pref-associated-accounts table tr:first td:last button"); - find(".pref-associated-accounts table tr:first td:last button") + queryAll(".pref-associated-accounts table tr:first td:last button") .html() .indexOf("Connect") > -1; }); @@ -196,7 +197,8 @@ acceptance("User Preferences", function (needs) { await click(".add-totp"); assert.ok( - find(".alert-error").html().indexOf("provide a name and the code") > -1, + queryAll(".alert-error").html().indexOf("provide a name and the code") > + -1, "shows name/token missing error message" ); }); @@ -221,7 +223,7 @@ acceptance("User Preferences", function (needs) { await click(".add-security-key"); assert.ok( - find(".alert-error").html().indexOf("provide a name") > -1, + queryAll(".alert-error").html().indexOf("provide a name") > -1, "shows name missing error message" ); } @@ -321,37 +323,39 @@ acceptance("User Preferences when badges are disabled", function (needs) { await visit("/u/eviltrout/preferences"); assert.equal( - find(".auth-tokens > .auth-token:first .auth-token-device").text().trim(), + queryAll(".auth-tokens > .auth-token:first .auth-token-device") + .text() + .trim(), "Linux Computer", "it should display active token first" ); assert.equal( - find(".pref-auth-tokens > a:first").text().trim(), + queryAll(".pref-auth-tokens > a:first").text().trim(), I18n.t("user.auth_tokens.show_all", { count: 3 }), "it should display two tokens" ); assert.ok( - find(".pref-auth-tokens .auth-token").length === 2, + queryAll(".pref-auth-tokens .auth-token").length === 2, "it should display two tokens" ); await click(".pref-auth-tokens > a:first"); assert.ok( - find(".pref-auth-tokens .auth-token").length === 3, + queryAll(".pref-auth-tokens .auth-token").length === 3, "it should display three tokens" ); await click(".auth-token-dropdown:first button"); await click("li[data-value='notYou']"); - assert.ok(find(".d-modal:visible").length === 1, "modal should appear"); + assert.ok(queryAll(".d-modal:visible").length === 1, "modal should appear"); await click(".modal-footer .btn-primary"); assert.ok( - find(".pref-password.highlighted").length === 1, + queryAll(".pref-password.highlighted").length === 1, "it should highlight password preferences" ); }); @@ -382,7 +386,7 @@ acceptance( "clear button not present" ); - const selectTopicBtn = find(".feature-topic-on-profile-btn:first"); + const selectTopicBtn = queryAll(".feature-topic-on-profile-btn:first"); assert.ok(exists(selectTopicBtn), "feature topic button is present"); await click(selectTopicBtn); @@ -392,7 +396,7 @@ acceptance( "topic picker modal is open" ); - const topicRadioBtn = find('input[name="choose_topic_id"]:first'); + const topicRadioBtn = queryAll('input[name="choose_topic_id"]:first'); assert.ok(exists(topicRadioBtn), "Topic options are prefilled"); await click(topicRadioBtn); diff --git a/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js b/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js index 4e661e746b..0787e20e22 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; import { acceptance } from "discourse/tests/helpers/qunit-helpers"; @@ -23,9 +24,9 @@ acceptance("Raw Plugin Outlet", function (needs) { }); test("Renders the raw plugin outlet", async (assert) => { await visit("/"); - assert.ok(find(".topic-lala").length > 0, "it renders the outlet"); + assert.ok(queryAll(".topic-lala").length > 0, "it renders the outlet"); assert.equal( - find(".topic-lala:eq(0)").text(), + queryAll(".topic-lala:eq(0)").text(), "11557", "it has the topic id" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/review-test.js b/app/assets/javascripts/discourse/tests/acceptance/review-test.js index e3af538809..b668751afe 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/review-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/review-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { visit, click, fillIn } from "@ember/test-helpers"; import { test } from "qunit"; import selectKit from "discourse/tests/helpers/select-kit-helper"; @@ -11,18 +12,18 @@ acceptance("Review", function (needs) { test("It returns a list of reviewable items", async (assert) => { await visit("/review"); - assert.ok(find(".reviewable-item").length, "has a list of items"); - assert.ok(find(user).length); + assert.ok(queryAll(".reviewable-item").length, "has a list of items"); + assert.ok(queryAll(user).length); assert.ok( - find(`${user}.reviewable-user`).length, + queryAll(`${user}.reviewable-user`).length, "applies a class for the type" ); assert.ok( - find(`${user} .reviewable-action.approve`).length, + queryAll(`${user} .reviewable-action.approve`).length, "creates a button for approve" ); assert.ok( - find(`${user} .reviewable-action.reject`).length, + queryAll(`${user} .reviewable-action.reject`).length, "creates a button for reject" ); }); @@ -30,7 +31,7 @@ acceptance("Review", function (needs) { test("Grouped by topic", async (assert) => { await visit("/review/topics"); assert.ok( - find(".reviewable-topic").length, + queryAll(".reviewable-topic").length, "it has a list of reviewable topics" ); }); @@ -38,37 +39,44 @@ acceptance("Review", function (needs) { test("Settings", async (assert) => { await visit("/review/settings"); - assert.ok(find(".reviewable-score-type").length, "has a list of bonuses"); + assert.ok( + queryAll(".reviewable-score-type").length, + "has a list of bonuses" + ); const field = selectKit(".reviewable-score-type:eq(0) .field .combo-box"); await field.expand(); await field.selectRowByValue("5"); await click(".save-settings"); - assert.ok(find(".reviewable-settings .saved").length, "it saved"); + assert.ok(queryAll(".reviewable-settings .saved").length, "it saved"); }); test("Flag related", async (assert) => { await visit("/review"); assert.ok( - find(".reviewable-flagged-post .post-contents .username a[href]").length, + queryAll(".reviewable-flagged-post .post-contents .username a[href]") + .length, "it has a link to the user" ); assert.equal( - find(".reviewable-flagged-post .post-body").html().trim(), + queryAll(".reviewable-flagged-post .post-body").html().trim(), "cooked content" ); - assert.equal(find(".reviewable-flagged-post .reviewable-score").length, 2); + assert.equal( + queryAll(".reviewable-flagged-post .reviewable-score").length, + 2 + ); }); test("Flag related", async (assert) => { await visit("/review/1"); assert.ok( - find(".reviewable-flagged-post").length, + queryAll(".reviewable-flagged-post").length, "it shows the flagged post" ); }); @@ -76,29 +84,36 @@ acceptance("Review", function (needs) { test("Clicking the buttons triggers actions", async (assert) => { await visit("/review"); await click(`${user} .reviewable-action.approve`); - assert.equal(find(user).length, 0, "it removes the reviewable on success"); + assert.equal( + queryAll(user).length, + 0, + "it removes the reviewable on success" + ); }); test("Editing a reviewable", async (assert) => { const topic = ".reviewable-item[data-reviewable-id=4321]"; await visit("/review"); - assert.ok(find(`${topic} .reviewable-action.approve`).length); - assert.ok(!find(`${topic} .category-name`).length); - assert.equal(find(`${topic} .discourse-tag:eq(0)`).text(), "hello"); - assert.equal(find(`${topic} .discourse-tag:eq(1)`).text(), "world"); + assert.ok(queryAll(`${topic} .reviewable-action.approve`).length); + assert.ok(!queryAll(`${topic} .category-name`).length); + assert.equal(queryAll(`${topic} .discourse-tag:eq(0)`).text(), "hello"); + assert.equal(queryAll(`${topic} .discourse-tag:eq(1)`).text(), "world"); - assert.equal(find(`${topic} .post-body`).text().trim(), "existing body"); + assert.equal( + queryAll(`${topic} .post-body`).text().trim(), + "existing body" + ); await click(`${topic} .reviewable-action.edit`); await click(`${topic} .reviewable-action.save-edit`); assert.ok( - find(`${topic} .reviewable-action.approve`).length, + queryAll(`${topic} .reviewable-action.approve`).length, "saving without changes is a cancel" ); await click(`${topic} .reviewable-action.edit`); assert.equal( - find(`${topic} .reviewable-action.approve`).length, + queryAll(`${topic} .reviewable-action.approve`).length, 0, "when editing actions are disabled" ); @@ -106,7 +121,7 @@ acceptance("Review", function (needs) { await fillIn(".editable-field.payload-raw textarea", "new raw contents"); await click(`${topic} .reviewable-action.cancel-edit`); assert.equal( - find(`${topic} .post-body`).text().trim(), + queryAll(`${topic} .post-body`).text().trim(), "existing body", "cancelling does not update the value" ); @@ -124,11 +139,14 @@ acceptance("Review", function (needs) { await fillIn(".editable-field.payload-raw textarea", "new raw contents"); await click(`${topic} .reviewable-action.save-edit`); - assert.equal(find(`${topic} .discourse-tag:eq(0)`).text(), "hello"); - assert.equal(find(`${topic} .discourse-tag:eq(1)`).text(), "world"); - assert.equal(find(`${topic} .discourse-tag:eq(2)`).text(), "monkey"); + assert.equal(queryAll(`${topic} .discourse-tag:eq(0)`).text(), "hello"); + assert.equal(queryAll(`${topic} .discourse-tag:eq(1)`).text(), "world"); + assert.equal(queryAll(`${topic} .discourse-tag:eq(2)`).text(), "monkey"); - assert.equal(find(`${topic} .post-body`).text().trim(), "new raw contents"); - assert.equal(find(`${topic} .category-name`).text().trim(), "support"); + assert.equal( + queryAll(`${topic} .post-body`).text().trim(), + "new raw contents" + ); + assert.equal(queryAll(`${topic} .category-name`).text().trim(), "support"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js index 2cd5c60584..3700265d7a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit, fillIn, click } from "@ember/test-helpers"; import { skip, test } from "qunit"; @@ -95,19 +96,19 @@ acceptance("Search - Full Page", function (needs) { assert.ok($("body.search-page").length, "has body class"); assert.ok(exists(".search-container"), "has container class"); - assert.ok(find(".search-query").length > 0); - assert.ok(find(".fps-topic").length === 0); + assert.ok(queryAll(".search-query").length > 0); + assert.ok(queryAll(".fps-topic").length === 0); await fillIn(".search-query", "none"); await click(".search-cta"); - assert.ok(find(".fps-topic").length === 0, "has no results"); - assert.ok(find(".no-results-suggestion .google-search-form")); + assert.ok(queryAll(".fps-topic").length === 0, "has no results"); + assert.ok(queryAll(".no-results-suggestion .google-search-form")); await fillIn(".search-query", "posts"); await click(".search-cta"); - assert.ok(find(".fps-topic").length === 1, "has one post"); + assert.ok(queryAll(".fps-topic").length === 1, "has one post"); }); test("escape search term", async (assert) => { @@ -148,7 +149,7 @@ acceptance("Search - Full Page", function (needs) { 'has "admin" pre-populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none @admin", 'has updated search term to "none user:admin"' ); @@ -173,7 +174,7 @@ acceptance("Search - Full Page", function (needs) { 'has "faq" populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none #faq", 'has updated search term to "none #faq"' ); @@ -189,7 +190,7 @@ acceptance("Search - Full Page", function (needs) { 'has "in title" populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none in:title", 'has updated search term to "none in:title"' ); @@ -212,7 +213,7 @@ acceptance("Search - Full Page", function (needs) { 'has "I liked" populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none in:likes", 'has updated search term to "none in:likes"' ); @@ -229,7 +230,7 @@ acceptance("Search - Full Page", function (needs) { ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none in:personal", 'has updated search term to "none in:personal"' ); @@ -253,7 +254,7 @@ acceptance("Search - Full Page", function (needs) { ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none in:seen", "it should update the search term" ); @@ -281,7 +282,7 @@ acceptance("Search - Full Page", function (needs) { 'has "I bookmarked" populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none in:bookmarks", 'has updated search term to "none in:bookmarks"' ); @@ -304,7 +305,7 @@ acceptance("Search - Full Page", function (needs) { 'has "are closed" populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none status:closed", 'has updated search term to "none status:closed"' ); @@ -336,7 +337,7 @@ acceptance("Search - Full Page", function (needs) { await visit("/search?expanded=true&q=after:2018-08-22"); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "after:2018-08-22", "it should update the search term correctly" ); @@ -359,7 +360,7 @@ acceptance("Search - Full Page", function (needs) { ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none after:2016-10-05", 'has updated search term to "none after:2016-10-05"' ); @@ -371,12 +372,12 @@ acceptance("Search - Full Page", function (needs) { await fillIn("#search-min-post-count", "5"); assert.equal( - find(".search-advanced-options #search-min-post-count").val(), + queryAll(".search-advanced-options #search-min-post-count").val(), "5", 'has "5" populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none min_posts:5", 'has updated search term to "none min_posts:5"' ); @@ -388,12 +389,12 @@ acceptance("Search - Full Page", function (needs) { await fillIn("#search-max-post-count", "5"); assert.equal( - find(".search-advanced-options #search-max-post-count").val(), + queryAll(".search-advanced-options #search-max-post-count").val(), "5", 'has "5" populated' ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "none max_posts:5", 'has updated search term to "none max_posts:5"' ); @@ -409,7 +410,7 @@ acceptance("Search - Full Page", function (needs) { ); assert.equal( - find(".search-query").val(), + queryAll(".search-query").val(), "in:likes", 'has updated search term to "in:likes"' ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js index 36bee9a89c..0e6d297fe2 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -21,24 +22,24 @@ acceptance("Search - Mobile", function (needs) { await click(".search-advanced-title"); assert.ok( - find(".search-advanced-filters").length === 1, + queryAll(".search-advanced-filters").length === 1, "it should expand advanced search filters" ); await fillIn(".search-query", "posts"); await click(".search-cta"); - assert.ok(find(".fps-topic").length === 1, "has one post"); + assert.ok(queryAll(".fps-topic").length === 1, "has one post"); assert.ok( - find(".search-advanced-filters").length === 0, + queryAll(".search-advanced-filters").length === 0, "it should collapse advanced search filters" ); await click("#search-button"); assert.equal( - find("input.full-page-search").val(), + queryAll("input.full-page-search").val(), "posts", "it does not reset input when hitting search icon again" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-test.js index 81184fb87f..d081613bb4 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -37,7 +38,7 @@ acceptance("Search - Anonymous", function (needs) { await click(".show-help"); assert.equal( - find(".full-page-search").val(), + queryAll(".full-page-search").val(), "dev", "it shows the search term" ); @@ -102,7 +103,7 @@ acceptance("Search - Anonymous", function (needs) { const highlighted = []; - find("#post_7 span.highlighted").map((_, span) => { + queryAll("#post_7 span.highlighted").map((_, span) => { highlighted.push(span.innerText); }); @@ -188,7 +189,7 @@ acceptance("Search - with tagging enabled", function (needs) { await fillIn("#search-term", "dev"); await keyEvent("#search-term", "keyup", 16); - const tags = find(".search-menu .results ul li:eq(0) .discourse-tags") + const tags = queryAll(".search-menu .results ul li:eq(0) .discourse-tags") .text() .trim(); diff --git a/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-desktop-test.js b/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-desktop-test.js index 7a815bf881..de2bda0fe2 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-desktop-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-desktop-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -34,20 +35,20 @@ acceptance("Share and Invite modal - desktop", function (needs) { ); assert.equal( - find(".share-and-invite.modal .modal-panel.share .title").text(), + queryAll(".share-and-invite.modal .modal-panel.share .title").text(), "Topic: Internationalization / localization", "it shows the topic title" ); assert.ok( - find(".share-and-invite.modal .modal-panel.share .topic-share-url") + queryAll(".share-and-invite.modal .modal-panel.share .topic-share-url") .val() .includes("/t/internationalization-localization/280?u=eviltrout"), "it shows the topic sharing url" ); assert.ok( - find(".share-and-invite.modal .social-link").length > 1, + queryAll(".share-and-invite.modal .social-link").length > 1, "it shows social sources" ); @@ -84,7 +85,7 @@ acceptance("Share url with badges disabled - desktop", function (needs) { await click("#topic-footer-button-share-and-invite"); assert.notOk( - find(".share-and-invite.modal .modal-panel.share .topic-share-url") + queryAll(".share-and-invite.modal .modal-panel.share .topic-share-url") .val() .includes("?u=eviltrout"), "it doesn't add the username param when badges are disabled" diff --git a/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-mobile-test.js b/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-mobile-test.js index ed649519d8..1846134abe 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-mobile-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/share-and-invite-mobile-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -38,20 +39,20 @@ acceptance("Share and Invite modal - mobile", function (needs) { ); assert.equal( - find(".share-and-invite.modal .modal-panel.share .title").text(), + queryAll(".share-and-invite.modal .modal-panel.share .title").text(), "Topic: Internationalization / localization", "it shows the topic title" ); assert.ok( - find(".share-and-invite.modal .modal-panel.share .topic-share-url") + queryAll(".share-and-invite.modal .modal-panel.share .topic-share-url") .val() .includes("/t/internationalization-localization/280?u=eviltrout"), "it shows the topic sharing url" ); assert.ok( - find(".share-and-invite.modal .social-link").length > 1, + queryAll(".share-and-invite.modal .social-link").length > 1, "it shows social sources" ); }); @@ -78,7 +79,7 @@ acceptance("Share url with badges disabled - mobile", function (needs) { await subject.selectRowByValue("share-and-invite"); assert.notOk( - find(".share-and-invite.modal .modal-panel.share .topic-share-url") + queryAll(".share-and-invite.modal .modal-panel.share .topic-share-url") .val() .includes("?u=eviltrout"), "it doesn't add the username param when badges are disabled" diff --git a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js index 1bdf765ef4..982eae4012 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import selectKit from "discourse/tests/helpers/select-kit-helper"; @@ -6,13 +7,13 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers"; acceptance("Shared Drafts", function () { test("Viewing", async (assert) => { await visit("/t/some-topic/9"); - assert.ok(find(".shared-draft-controls").length === 1); + assert.ok(queryAll(".shared-draft-controls").length === 1); let categoryChooser = selectKit(".shared-draft-controls .category-chooser"); assert.equal(categoryChooser.header().value(), "3"); await click(".publish-shared-draft"); await click(".bootbox .btn-primary"); - assert.ok(find(".shared-draft-controls").length === 0); + assert.ok(queryAll(".shared-draft-controls").length === 0); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js index 09cefddf8f..3d074a4994 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -37,14 +38,14 @@ acceptance("Signing In", function () { await fillIn("#login-account-password", "not-activated"); await click(".modal-footer .btn-primary"); assert.equal( - find(".modal-body b").text(), + queryAll(".modal-body b").text(), "eviltrout@example.com" ); assert.ok(!exists(".modal-body small"), "it escapes the email address"); await click(".modal-footer button.resend"); assert.equal( - find(".modal-body b").text(), + queryAll(".modal-body b").text(), "current@example.com" ); assert.ok(!exists(".modal-body small"), "it escapes the email address"); @@ -59,16 +60,16 @@ acceptance("Signing In", function () { await fillIn("#login-account-password", "not-activated-edit"); await click(".modal-footer .btn-primary"); await click(".modal-footer button.edit-email"); - assert.equal(find(".activate-new-email").val(), "current@example.com"); + assert.equal(queryAll(".activate-new-email").val(), "current@example.com"); assert.equal( - find(".modal-footer .btn-primary:disabled").length, + queryAll(".modal-footer .btn-primary:disabled").length, 1, "must change email" ); await fillIn(".activate-new-email", "different@example.com"); - assert.equal(find(".modal-footer .btn-primary:disabled").length, 0); + assert.equal(queryAll(".modal-footer .btn-primary:disabled").length, 0); await click(".modal-footer .btn-primary"); - assert.equal(find(".modal-body b").text(), "different@example.com"); + assert.equal(queryAll(".modal-body b").text(), "different@example.com"); }); test("second factor", async (assert) => { diff --git a/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js b/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js index e9edf397af..ffab0fe849 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/tag-groups-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; import selectKit from "discourse/tests/helpers/select-kit-helper"; @@ -47,7 +48,7 @@ acceptance("Tag Groups", function (needs) { await click(".tag-group-content .btn.btn-default"); await click(".tag-chooser .choice:first"); - assert.ok(!find(".tag-group-content .btn.btn-danger")[0].disabled); + assert.ok(!queryAll(".tag-group-content .btn.btn-danger")[0].disabled); }); test("tag groups can have multiple groups added to them", async (assert) => { @@ -62,11 +63,11 @@ acceptance("Tag Groups", function (needs) { await tags.selectRowByValue("monkey"); await click("#private-permission"); - assert.ok(find(".tag-group-content .btn.btn-default:disabled").length); + assert.ok(queryAll(".tag-group-content .btn.btn-default:disabled").length); await groups.expand(); await groups.selectRowByIndex(1); await groups.selectRowByIndex(0); - assert.ok(!find(".tag-group-content .btn.btn-default")[0].disabled); + assert.ok(!queryAll(".tag-group-content .btn.btn-default")[0].disabled); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js index 37532cc7c4..5fa41d4207 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -129,18 +130,18 @@ acceptance("Tags listed by group", function (needs) { updateCurrentUser({ moderator: false, admin: false }); await visit("/tag/regular-tag"); - assert.ok(find("#create-topic:disabled").length === 0); + assert.ok(queryAll("#create-topic:disabled").length === 0); await visit("/tag/staff-only-tag"); - assert.ok(find("#create-topic:disabled").length === 1); + assert.ok(queryAll("#create-topic:disabled").length === 1); updateCurrentUser({ moderator: true }); await visit("/tag/regular-tag"); - assert.ok(find("#create-topic:disabled").length === 0); + assert.ok(queryAll("#create-topic:disabled").length === 0); await visit("/tag/staff-only-tag"); - assert.ok(find("#create-topic:disabled").length === 0); + assert.ok(queryAll("#create-topic:disabled").length === 0); }); }); @@ -228,20 +229,20 @@ acceptance("Tag info", function (needs) { updateCurrentUser({ moderator: false, admin: false }); await visit("/tag/planters"); - assert.ok(find("#show-tag-info").length === 1); + assert.ok(queryAll("#show-tag-info").length === 1); await click("#show-tag-info"); assert.ok(exists(".tag-info .tag-name"), "show tag"); assert.ok( - find(".tag-info .tag-associations").text().indexOf("Gardening") >= 0, + queryAll(".tag-info .tag-associations").text().indexOf("Gardening") >= 0, "show tag group names" ); assert.ok( - find(".tag-info .synonyms-list .tag-box").length === 2, + queryAll(".tag-info .synonyms-list .tag-box").length === 2, "shows the synonyms" ); assert.ok( - find(".tag-info .badge-category").length === 1, + queryAll(".tag-info .badge-category").length === 1, "show the category" ); assert.ok(!exists("#rename-tag"), "can't rename tag"); @@ -253,7 +254,7 @@ acceptance("Tag info", function (needs) { updateCurrentUser({ moderator: false, admin: true }); await visit("/tag/planters"); - assert.ok(find("#show-tag-info").length === 1); + assert.ok(queryAll("#show-tag-info").length === 1); await click("#show-tag-info"); assert.ok(exists("#rename-tag"), "can rename tag"); @@ -262,17 +263,17 @@ acceptance("Tag info", function (needs) { await click("#edit-synonyms"); assert.ok( - find(".unlink-synonym:visible").length === 2, + queryAll(".unlink-synonym:visible").length === 2, "unlink UI is visible" ); assert.ok( - find(".delete-synonym:visible").length === 2, + queryAll(".delete-synonym:visible").length === 2, "delete UI is visible" ); await click(".unlink-synonym:first"); assert.ok( - find(".tag-info .synonyms-list .tag-box").length === 1, + queryAll(".tag-info .synonyms-list .tag-box").length === 1, "removed a synonym" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-anonymous-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-anonymous-test.js index b1f00a7a27..0e56339e87 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-anonymous-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-anonymous-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -9,7 +10,7 @@ acceptance("Topic - Anonymous", function () { assert.ok(exists("#topic"), "The topic was rendered"); assert.ok(exists("#topic .cooked"), "The topic has cooked posts"); assert.ok( - find(".shared-draft-notice").length === 0, + queryAll(".shared-draft-notice").length === 0, "no shared draft unless there's a dest category id" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js index f19421b7a2..755b017adf 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -19,7 +20,7 @@ acceptance("Topic Discovery", function (needs) { assert.ok(exists(".topic-list .topic-list-item"), "has topics"); assert.equal( - find("a[data-user-card=eviltrout]:first img.avatar").attr("title"), + queryAll("a[data-user-card=eviltrout]:first img.avatar").attr("title"), "Evil Trout - Most Posts", "it shows user's full name in avatar title" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js index 13e5c5a200..da35fd8e6e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { skip } from "qunit"; import { test } from "qunit"; @@ -54,7 +55,9 @@ acceptance("Topic - Edit timer", function (needs) { assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex = /will automatically close in/g; - const html = find(".future-date-input .topic-status-info").html().trim(); + const html = queryAll(".future-date-input .topic-status-info") + .html() + .trim(); assert.ok(regex.test(html)); }); @@ -73,7 +76,9 @@ acceptance("Topic - Edit timer", function (needs) { assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex1 = /will automatically close in/g; - const html1 = find(".future-date-input .topic-status-info").html().trim(); + const html1 = queryAll(".future-date-input .topic-status-info") + .html() + .trim(); assert.ok(regex1.test(html1)); await futureDateInputSelector.expand(); @@ -90,7 +95,9 @@ acceptance("Topic - Edit timer", function (needs) { ); const regex2 = /will automatically close in/g; - const html2 = find(".future-date-input .topic-status-info").html().trim(); + const html2 = queryAll(".future-date-input .topic-status-info") + .html() + .trim(); assert.ok(regex2.test(html2)); await futureDateInputSelector.expand(); @@ -110,7 +117,9 @@ acceptance("Topic - Edit timer", function (needs) { ); const regex3 = /This topic will close.*after the last reply/g; - const html3 = find(".future-date-input .topic-status-info").html().trim(); + const html3 = queryAll(".future-date-input .topic-status-info") + .html() + .trim(); assert.ok(regex3.test(html3)); }); @@ -139,7 +148,9 @@ acceptance("Topic - Edit timer", function (needs) { assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex1 = /will automatically open in/g; - const html1 = find(".future-date-input .topic-status-info").html().trim(); + const html1 = queryAll(".future-date-input .topic-status-info") + .html() + .trim(); assert.ok(regex1.test(html1)); await futureDateInputSelector.expand(); @@ -157,7 +168,9 @@ acceptance("Topic - Edit timer", function (needs) { ); const regex2 = /will automatically open in/g; - const html2 = find(".future-date-input .topic-status-info").html().trim(); + const html2 = queryAll(".future-date-input .topic-status-info") + .html() + .trim(); assert.ok(regex2.test(html2)); }); @@ -193,7 +206,9 @@ acceptance("Topic - Edit timer", function (needs) { assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex = /will be published to #dev/g; - const text = find(".future-date-input .topic-status-info").text().trim(); + const text = queryAll(".future-date-input .topic-status-info") + .text() + .trim(); assert.ok(regex.test(text)); }); @@ -236,7 +251,9 @@ acceptance("Topic - Edit timer", function (needs) { assert.equal(futureDateInputSelector.header().value(), "two_weeks"); const regex = /will be automatically deleted/g; - const html = find(".future-date-input .topic-status-info").html().trim(); + const html = queryAll(".future-date-input .topic-status-info") + .html() + .trim(); assert.ok(regex.test(html)); }); @@ -251,11 +268,13 @@ acceptance("Topic - Edit timer", function (needs) { await futureDateInputSelector.selectRowByValue("next_week"); await click(".modal-footer button.btn-primary"); - const removeTimerButton = find(".topic-status-info .topic-timer-remove"); + const removeTimerButton = queryAll( + ".topic-status-info .topic-timer-remove" + ); assert.equal(removeTimerButton.attr("title"), "remove timer"); await click(".topic-status-info .topic-timer-remove"); - const topicStatusInfo = find(".topic-status-info .topic-timer-remove"); + const topicStatusInfo = queryAll(".topic-status-info .topic-timer-remove"); assert.equal(topicStatusInfo.length, 0); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js index a7fb6f89f8..d0f15e24ef 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import I18n from "I18n"; @@ -13,7 +14,7 @@ acceptance("Topic move posts", function (needs) { await click("#post_11 .select-below"); assert.equal( - find(".selected-posts .move-to-topic").text().trim(), + queryAll(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" ); @@ -21,28 +22,28 @@ acceptance("Topic move posts", function (needs) { await click(".selected-posts .move-to-topic"); assert.ok( - find(".choose-topic-modal .title") + queryAll(".choose-topic-modal .title") .html() .includes(I18n.t("topic.move_to.title")), "it opens move to modal" ); assert.ok( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.split_topic.radio_label")), "it shows an option to move to new topic" ); assert.ok( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.merge_topic.radio_label")), "it shows an option to move to existing topic" ); assert.ok( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.move_to_new_message.radio_label")), "it shows an option to move to new message" @@ -57,28 +58,28 @@ acceptance("Topic move posts", function (needs) { await click(".selected-posts .move-to-topic"); assert.ok( - find(".choose-topic-modal .title") + queryAll(".choose-topic-modal .title") .html() .includes(I18n.t("topic.move_to.title")), "it opens move to modal" ); assert.not( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.split_topic.radio_label")), "it does not show an option to move to new topic" ); assert.ok( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.merge_topic.radio_label")), "it shows an option to move to existing topic" ); assert.not( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.move_to_new_message.radio_label")), "it does not show an option to move to new message" @@ -92,7 +93,7 @@ acceptance("Topic move posts", function (needs) { await click("#post_1 .select-post"); assert.equal( - find(".selected-posts .move-to-topic").text().trim(), + queryAll(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" ); @@ -100,21 +101,21 @@ acceptance("Topic move posts", function (needs) { await click(".selected-posts .move-to-topic"); assert.ok( - find(".choose-topic-modal .title") + queryAll(".choose-topic-modal .title") .html() .includes(I18n.t("topic.move_to.title")), "it opens move to modal" ); assert.ok( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.move_to_new_message.radio_label")), "it shows an option to move to new message" ); assert.ok( - find(".choose-topic-modal .radios") + queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.move_to_existing_message.radio_label")), "it shows an option to move to existing message" @@ -128,7 +129,7 @@ acceptance("Topic move posts", function (needs) { await click("#post_2 .select-below"); assert.equal( - find(".selected-posts .move-to-topic").text().trim(), + queryAll(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" ); @@ -136,7 +137,7 @@ acceptance("Topic move posts", function (needs) { await click(".selected-posts .move-to-topic"); assert.ok( - find(".choose-topic-modal .title") + queryAll(".choose-topic-modal .title") .html() .includes(I18n.t("topic.move_to.title")), "it opens move to modal" diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js index e3e29517a9..bb4e6ffc2a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -26,7 +27,7 @@ acceptance("Topic - Quote button - logged in", function (needs) { selectText("#post_5 blockquote"); assert.ok(exists(".insert-quote"), "it shows the quote button"); assert.equal( - find(".quote-sharing").length, + queryAll(".quote-sharing").length, 0, "it does not show quote sharing" ); @@ -60,7 +61,7 @@ acceptance("Topic - Quote button - anonymous", function (needs) { await visit("/t/internationalization-localization/280"); selectText("#post_5 blockquote"); - assert.ok(find(".quote-sharing"), "it shows the quote sharing options"); + assert.ok(queryAll(".quote-sharing"), "it shows the quote sharing options"); assert.ok( exists(`.quote-sharing .btn[title='${I18n.t("share.twitter")}']`), "it includes the twitter share button" @@ -70,7 +71,7 @@ acceptance("Topic - Quote button - anonymous", function (needs) { "it includes the email share button" ); assert.equal( - find(".insert-quote").length, + queryAll(".insert-quote").length, 0, "it does not show the quote button" ); @@ -88,7 +89,7 @@ acceptance("Topic - Quote button - anonymous", function (needs) { "it includes the twitter share button" ); assert.equal( - find(".quote-share-label").length, + queryAll(".quote-share-label").length, 0, "it does not show the Share label" ); @@ -101,13 +102,13 @@ acceptance("Topic - Quote button - anonymous", function (needs) { selectText("#post_5 blockquote"); assert.equal( - find(".quote-sharing").length, + queryAll(".quote-sharing").length, 0, "it does not show quote sharing" ); assert.equal( - find(".insert-quote").length, + queryAll(".insert-quote").length, 0, "it does not show the quote button" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js index 4b98805a81..34182e32eb 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { click, fillIn, visit } from "@ember/test-helpers"; import { test } from "qunit"; @@ -33,7 +34,7 @@ acceptance("Topic", function (needs) { assert.ok(exists(".d-editor-input"), "the composer input is visible"); assert.equal( - find(".d-editor-input").val().trim(), + queryAll(".d-editor-input").val().trim(), `Continuing the discussion from [Internationalization / localization](${window.location.origin}/t/internationalization-localization/280):`, "it fills composer with the ring string" ); @@ -52,12 +53,12 @@ acceptance("Topic", function (needs) { assert.ok(exists(".d-editor-input"), "the composer input is visible"); assert.equal( - find(".d-editor-input").val().trim(), + queryAll(".d-editor-input").val().trim(), `Continuing the discussion from [PM for testing](${window.location.origin}/t/pm-for-testing/12):`, "it fills composer with the ring string" ); - const targets = find(".item span", ".composer-fields"); + const targets = queryAll(".item span", ".composer-fields"); assert.equal( $(targets[0]).text(), @@ -113,12 +114,12 @@ acceptance("Topic", function (needs) { await click("#topic-title .submit-edit"); assert.equal( - find("#topic-title .badge-category").text(), + queryAll("#topic-title .badge-category").text(), "faq", "it displays the new category" ); assert.equal( - find(".fancy-title").text().trim(), + queryAll(".fancy-title").text().trim(), "this is the new title", "it displays the new title" ); @@ -127,20 +128,23 @@ acceptance("Topic", function (needs) { test("Marking a topic as wiki", async (assert) => { await visit("/t/internationalization-localization/280"); - assert.ok(find("a.wiki").length === 0, "it does not show the wiki icon"); + assert.ok( + queryAll("a.wiki").length === 0, + "it does not show the wiki icon" + ); await click(".topic-post:eq(0) button.show-more-actions"); await click(".topic-post:eq(0) button.show-post-admin-menu"); await click(".btn.wiki"); - assert.ok(find("a.wiki").length === 1, "it shows the wiki icon"); + assert.ok(queryAll("a.wiki").length === 1, "it shows the wiki icon"); }); test("Visit topic routes", async (assert) => { await visit("/t/12"); assert.equal( - find(".fancy-title").text().trim(), + queryAll(".fancy-title").text().trim(), "PM for testing", "it routes to the right topic" ); @@ -148,7 +152,7 @@ acceptance("Topic", function (needs) { await visit("/t/280/20"); assert.equal( - find(".fancy-title").text().trim(), + queryAll(".fancy-title").text().trim(), "Internationalization / localization", "it routes to the right topic" ); @@ -163,7 +167,7 @@ acceptance("Topic", function (needs) { await click("#topic-title .submit-edit"); assert.equal( - find(".fancy-title").html().trim(), + queryAll(".fancy-title").html().trim(), `emojis title
`,
"it displays the new title with emojis"
);
@@ -178,7 +182,7 @@ acceptance("Topic", function (needs) {
await click("#topic-title .submit-edit");
assert.equal(
- find(".fancy-title").html().trim(),
+ queryAll(".fancy-title").html().trim(),
`emojis title 
`,
"it displays the new title with escaped unicode emojis"
);
@@ -194,7 +198,7 @@ acceptance("Topic", function (needs) {
await click("#topic-title .submit-edit");
assert.equal(
- find(".fancy-title").html().trim(),
+ queryAll(".fancy-title").html().trim(),
`Test
Title`,
"it displays the new title with escaped unicode emojis"
);
@@ -204,7 +208,7 @@ acceptance("Topic", function (needs) {
await visit("/t/internationalization-localization/280");
assert.equal(
- find("#suggested-topics .suggested-topics-title").text().trim(),
+ queryAll("#suggested-topics .suggested-topics-title").text().trim(),
I18n.t("suggested_topics.title")
);
});
@@ -326,7 +330,7 @@ acceptance("Topic featured links", function (needs) {
await click("#post_3 .select-below");
assert.ok(
- find(".selected-posts")
+ queryAll(".selected-posts")
.html()
.includes(I18n.t("topic.multi_select.description", { count: 18 })),
"it should select the right number of posts"
@@ -335,7 +339,7 @@ acceptance("Topic featured links", function (needs) {
await click("#post_2 .select-below");
assert.ok(
- find(".selected-posts")
+ queryAll(".selected-posts")
.html()
.includes(I18n.t("topic.multi_select.description", { count: 19 })),
"it should select the right number of posts"
@@ -346,7 +350,7 @@ acceptance("Topic featured links", function (needs) {
await visit("/t/internationalization-localization/280");
await click(".gap");
- assert.equal(find(".gap").length, 0, "it hides gap");
+ assert.equal(queryAll(".gap").length, 0, "it hides gap");
});
test("Quoting a quote keeps the original poster name", async (assert) => {
@@ -355,7 +359,7 @@ acceptance("Topic featured links", function (needs) {
await click(".quote-button .insert-quote");
assert.ok(
- find(".d-editor-input")
+ queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
@@ -367,7 +371,7 @@ acceptance("Topic featured links", function (needs) {
await click(".quote-button .insert-quote");
assert.ok(
- find(".d-editor-input")
+ queryAll(".d-editor-input")
.val()
.indexOf(
'quote="A new topic with a link to another topic, post:3, topic:62"'
@@ -381,7 +385,7 @@ acceptance("Topic featured links", function (needs) {
await click(".reply");
assert.ok(
- find(".d-editor-input")
+ queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
@@ -394,7 +398,7 @@ acceptance("Topic featured links", function (needs) {
await keyEvent(document, "keypress", "t".charCodeAt(0));
assert.ok(
- find(".d-editor-input")
+ queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
@@ -406,7 +410,7 @@ acceptance("Topic featured links", function (needs) {
await click(".quote-button .insert-quote");
assert.ok(
- find(".d-editor-input")
+ queryAll(".d-editor-input")
.val()
.indexOf('quote="pekka, post:5, topic:280, full:true"') !== -1
);
@@ -426,12 +430,12 @@ acceptance("Topic with title decorated", function (needs) {
await visit("/t/internationalization-localization/280");
assert.ok(
- find(".fancy-title")[0].innerText.endsWith("-280-topic-title"),
+ queryAll(".fancy-title")[0].innerText.endsWith("-280-topic-title"),
"it decorates topic title"
);
assert.ok(
- find(".raw-topic-link:nth-child(1)")[0].innerText.endsWith(
+ queryAll(".raw-topic-link:nth-child(1)")[0].innerText.endsWith(
"-27331-topic-list-item-title"
),
"it decorates topic list item title"
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js
index bce007ed41..ef54c4dd27 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js
@@ -1,3 +1,4 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
@@ -11,7 +12,7 @@ acceptance("User's bookmarks", function (needs) {
test("removing a bookmark with no reminder does not show a confirmation", async (assert) => {
await visit("/u/eviltrout/activity/bookmarks");
- assert.ok(find(".bookmark-list-item").length > 0);
+ assert.ok(queryAll(".bookmark-list-item").length > 0);
const dropdown = selectKit(".bookmark-actions-dropdown:eq(0)");
await dropdown.expand();
@@ -59,6 +60,6 @@ acceptance("User's bookmarks - no bookmarks", function (needs) {
test("listing users bookmarks - no bookmarks", async (assert) => {
await visit("/u/eviltrout/activity/bookmarks");
- assert.equal(find(".alert.alert-info").text(), "no bookmarks");
+ assert.equal(queryAll(".alert.alert-info").text(), "no bookmarks");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js
index 5c01d4f4dd..dd88a1826d 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js
@@ -1,3 +1,4 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
@@ -8,22 +9,22 @@ acceptance("User Drafts", function (needs) {
test("Stream", async (assert) => {
await visit("/u/eviltrout/activity/drafts");
- assert.ok(find(".user-stream-item").length === 3, "has drafts");
+ assert.ok(queryAll(".user-stream-item").length === 3, "has drafts");
await click(".user-stream-item:last-child .remove-draft");
assert.ok(
- find(".user-stream-item").length === 2,
+ queryAll(".user-stream-item").length === 2,
"draft removed, list length diminished by one"
);
});
test("Stream - resume draft", async (assert) => {
await visit("/u/eviltrout/activity/drafts");
- assert.ok(find(".user-stream-item").length > 0, "has drafts");
+ assert.ok(queryAll(".user-stream-item").length > 0, "has drafts");
await click(".user-stream-item .resume-draft");
assert.equal(
- find(".d-editor-input").val().trim(),
+ queryAll(".d-editor-input").val().trim(),
"A fun new topic for testing drafts."
);
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js
index fc112a8455..75585eb55e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js
@@ -1,3 +1,4 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
@@ -18,7 +19,7 @@ acceptance("User Preferences - Interface", function (needs) {
assert.ok(!exists(".saved"), "it hasn't been saved yet");
await click(".save-changes");
assert.ok(exists(".saved"), "it displays the saved message");
- find(".saved").remove();
+ queryAll(".saved").remove();
};
await visit("/u/eviltrout/preferences/interface");
@@ -132,7 +133,7 @@ acceptance(
assert.ok(!exists(".saved"), "it hasn't been saved yet");
await click(".save-changes");
assert.ok(exists(".saved"), "it displays the saved message");
- find(".saved").remove();
+ queryAll(".saved").remove();
};
await visit("/u/eviltrout/preferences/interface");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-test.js
index e639569da7..be6c806ea7 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-test.js
@@ -1,3 +1,4 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
@@ -38,7 +39,7 @@ acceptance("User Routes", function (needs) {
await visit("/u/eviltrout/notifications");
assert.ok($("body.user-notifications-page").length, "has the body class");
- const $links = find(".item.notification a");
+ const $links = queryAll(".item.notification a");
assert.ok(
$links[1].href.includes(
diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
index 1427336c7e..11a9d5f7f2 100644
--- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
+++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
@@ -375,8 +375,12 @@ export async function selectDate(selector, date) {
});
}
+export function queryAll() {
+ return window.find(...arguments);
+}
+
export function invisible(selector) {
- const $items = find(selector + ":visible");
+ const $items = queryAll(selector + ":visible");
return (
$items.length === 0 ||
$items.css("opacity") !== "1" ||
@@ -385,11 +389,11 @@ export function invisible(selector) {
}
export function visible(selector) {
- return find(selector + ":visible").length > 0;
+ return queryAll(selector + ":visible").length > 0;
}
export function count(selector) {
- return find(selector).length;
+ return queryAll(selector).length;
}
export function exists(selector) {
diff --git a/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js b/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js
index d2351c04cf..33dfe42161 100644
--- a/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js
+++ b/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js
@@ -1,17 +1,18 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import { isEmpty } from "@ember/utils";
import { click, fillIn } from "@ember/test-helpers";
import { exists } from "discourse/tests/helpers/qunit-helpers";
function checkSelectKitIsNotExpanded(selector) {
- if (find(selector).hasClass("is-expanded")) {
+ if (queryAll(selector).hasClass("is-expanded")) {
// eslint-disable-next-line no-console
console.warn("You expected select-kit to be collapsed but it is expanded.");
}
}
function checkSelectKitIsNotCollapsed(selector) {
- if (!find(selector).hasClass("is-expanded")) {
+ if (!queryAll(selector).hasClass("is-expanded")) {
// eslint-disable-next-line no-console
console.warn("You expected select-kit to be expanded but it is collapsed.");
}
@@ -31,7 +32,7 @@ async function selectKitFillInFilter(filter, selector) {
checkSelectKitIsNotCollapsed(selector);
await fillIn(
`${selector} .filter-input`,
- find(`${selector} .filter-input`).val() + filter
+ queryAll(`${selector} .filter-input`).val() + filter
);
}
@@ -57,11 +58,11 @@ async function selectKitSelectNoneRow(selector) {
async function selectKitSelectRowByIndex(index, selector) {
checkSelectKitIsNotCollapsed(selector);
- await click(find(`${selector} .select-kit-row`).eq(index));
+ await click(queryAll(`${selector} .select-kit-row`).eq(index));
}
async function keyboardHelper(value, target, selector) {
- target = find(selector).find(target || ".filter-input");
+ target = queryAll(selector).find(target || ".filter-input");
if (value === "selectAll") {
// special casing the only one not working with triggerEvent
@@ -200,27 +201,27 @@ export default function selectKit(selector) {
},
isExpanded() {
- return find(selector).hasClass("is-expanded");
+ return queryAll(selector).hasClass("is-expanded");
},
isFocused() {
- return find(selector).hasClass("is-focused");
+ return queryAll(selector).hasClass("is-focused");
},
isHidden() {
- return find(selector).hasClass("is-hidden");
+ return queryAll(selector).hasClass("is-hidden");
},
header() {
- return headerHelper(find(selector).find(".select-kit-header"));
+ return headerHelper(queryAll(selector).find(".select-kit-header"));
},
filter() {
- return filterHelper(find(selector).find(".select-kit-filter"));
+ return filterHelper(queryAll(selector).find(".select-kit-filter"));
},
rows() {
- return find(selector).find(".select-kit-row");
+ return queryAll(selector).find(".select-kit-row");
},
displayedContent() {
@@ -236,32 +237,32 @@ export default function selectKit(selector) {
rowByValue(value) {
return rowHelper(
- find(selector).find('.select-kit-row[data-value="' + value + '"]')
+ queryAll(selector).find('.select-kit-row[data-value="' + value + '"]')
);
},
rowByName(name) {
return rowHelper(
- find(selector).find('.select-kit-row[data-name="' + name + '"]')
+ queryAll(selector).find('.select-kit-row[data-name="' + name + '"]')
);
},
rowByIndex(index) {
return rowHelper(
- find(selector).find(".select-kit-row:eq(" + index + ")")
+ queryAll(selector).find(".select-kit-row:eq(" + index + ")")
);
},
el() {
- return find(selector);
+ return queryAll(selector);
},
noneRow() {
- return rowHelper(find(selector).find(".select-kit-row.none"));
+ return rowHelper(queryAll(selector).find(".select-kit-row.none"));
},
validationMessage() {
- const validationMessage = find(selector).find(".validation-message");
+ const validationMessage = queryAll(selector).find(".validation-message");
if (validationMessage.length) {
return validationMessage.html().trim();
@@ -271,16 +272,20 @@ export default function selectKit(selector) {
},
selectedRow() {
- return rowHelper(find(selector).find(".select-kit-row.is-selected"));
+ return rowHelper(queryAll(selector).find(".select-kit-row.is-selected"));
},
highlightedRow() {
- return rowHelper(find(selector).find(".select-kit-row.is-highlighted"));
+ return rowHelper(
+ queryAll(selector).find(".select-kit-row.is-highlighted")
+ );
},
async deselectItem(value) {
await click(
- find(selector).find(".select-kit-header").find(`[data-value=${value}]`)
+ queryAll(selector)
+ .find(".select-kit-header")
+ .find(`[data-value=${value}]`)
);
},
diff --git a/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js b/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js
index 44792a75e9..0896344d47 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js
@@ -1,3 +1,4 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import componentTest from "discourse/tests/helpers/component-test";
import { moduleForComponent } from "ember-qunit";
@@ -8,7 +9,7 @@ componentTest("css editor", {
template: '{{ace-editor mode="css"}}',
test(assert) {
assert.expect(1);
- assert.ok(find(".ace_editor").length, "it renders the ace editor");
+ assert.ok(queryAll(".ace_editor").length, "it renders the ace editor");
},
});
@@ -17,7 +18,7 @@ componentTest("html editor", {
template: '{{ace-editor mode="html" content="wat"}}',
test(assert) {
assert.expect(1);
- assert.ok(find(".ace_editor").length, "it renders the ace editor");
+ assert.ok(queryAll(".ace_editor").length, "it renders the ace editor");
},
});
@@ -26,7 +27,7 @@ componentTest("sql editor", {
template: '{{ace-editor mode="sql" content="SELECT * FROM users"}}',
test(assert) {
assert.expect(1);
- assert.ok(find(".ace_editor").length, "it renders the ace editor");
+ assert.ok(queryAll(".ace_editor").length, "it renders the ace editor");
},
});
@@ -35,7 +36,7 @@ componentTest("disabled editor", {
template:
'{{ace-editor mode="sql" content="SELECT * FROM users" disabled=true}}',
test(assert) {
- const $ace = find(".ace_editor");
+ const $ace = queryAll(".ace_editor");
assert.expect(3);
assert.ok($ace.length, "it renders the ace editor");
assert.equal(
diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js
index 0f5e01896c..7951b66fdd 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js
@@ -1,3 +1,4 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import componentTest from "discourse/tests/helpers/component-test";
@@ -17,31 +18,35 @@ componentTest("default", {
assert.ok(exists(".admin-report.signups", "it defaults to table mode"));
assert.equal(
- find(".header .item.report").text().trim(),
+ queryAll(".header .item.report").text().trim(),
"Signups",
"it has a title"
);
assert.equal(
- find(".header .info").attr("data-tooltip"),
+ queryAll(".header .info").attr("data-tooltip"),
"New account registrations for this period",
"it has a description"
);
assert.equal(
- find(".admin-report-table thead tr th:first-child .title").text().trim(),
+ queryAll(".admin-report-table thead tr th:first-child .title")
+ .text()
+ .trim(),
"Day",
"it has col headers"
);
assert.equal(
- find(".admin-report-table thead tr th:nth-child(2) .title").text().trim(),
+ queryAll(".admin-report-table thead tr th:nth-child(2) .title")
+ .text()
+ .trim(),
"Count",
"it has col headers"
);
assert.equal(
- find(".admin-report-table tbody tr:nth-child(1) td:nth-child(1)")
+ queryAll(".admin-report-table tbody tr:nth-child(1) td:nth-child(1)")
.text()
.trim(),
"June 16, 2018",
@@ -49,7 +54,7 @@ componentTest("default", {
);
assert.equal(
- find(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)")
+ queryAll(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)")
.text()
.trim(),
"12",
@@ -61,7 +66,7 @@ componentTest("default", {
await click(".admin-report-table-header.y .sort-btn");
assert.equal(
- find(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)")
+ queryAll(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)")
.text()
.trim(),
"7",
@@ -85,7 +90,7 @@ componentTest("options", {
test(assert) {
assert.ok(exists(".pagination"), "it paginates the results");
assert.equal(
- find(".pagination button").length,
+ queryAll(".pagination button").length,
3,
"it creates the correct number of pages"
);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js
index b0e10f4b1f..5573570de5 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js
@@ -1,3 +1,4 @@
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { moduleForComponent } from "ember-qunit";
import componentTest from "discourse/tests/helpers/component-test";
import pretender from "discourse/tests/helpers/create-pretender";
@@ -9,7 +10,7 @@ componentTest("renders markdown", {
template: '{{cook-text "_foo_" class="post-body"}}',
test(assert) {
- const html = find(".post-body")[0].innerHTML.trim();
+ const html = queryAll(".post-body")[0].innerHTML.trim();
assert.equal(html, "foo
"); }, }); @@ -38,7 +39,7 @@ componentTest("resolves short URLs", { }, test(assert) { - const html = find(".post-body")[0].innerHTML.trim(); + const html = queryAll(".post-body")[0].innerHTML.trim(); assert.equal(html, '![]()
hello world
" ); }, @@ -33,7 +34,7 @@ componentTest("preview sanitizes HTML", { async test(assert) { await fillIn(".d-editor-input", `">`); - assert.equal(find(".d-editor-preview").html().trim(), '">
'); + assert.equal(queryAll(".d-editor-preview").html().trim(), '">
'); }, }); @@ -45,10 +46,16 @@ componentTest("updating the value refreshes the preview", { }, async test(assert) { - assert.equal(find(".d-editor-preview").html().trim(), "evil trout
"); + assert.equal( + queryAll(".d-editor-preview").html().trim(), + "evil trout
" + ); await this.set("value", "zogstrip"); - assert.equal(find(".d-editor-preview").html().trim(), "zogstrip
"); + assert.equal( + queryAll(".d-editor-preview").html().trim(), + "zogstrip
" + ); }, }); @@ -65,7 +72,7 @@ function testCase(title, testFunc) { this.set("value", "hello world."); }, test(assert) { - const textarea = jumpEnd(find("textarea.d-editor-input")[0]); + const textarea = jumpEnd(queryAll("textarea.d-editor-input")[0]); testFunc.call(this, assert, textarea); }, }); @@ -78,7 +85,7 @@ function composerTestCase(title, testFunc) { this.set("value", "hello world."); }, test(assert) { - const textarea = jumpEnd(find("textarea.d-editor-input")[0]); + const textarea = jumpEnd(queryAll("textarea.d-editor-input")[0]); testFunc.call(this, assert, textarea); }, }); @@ -211,7 +218,7 @@ function xyz(x, y, z) { }, async test(assert) { - const textarea = find("textarea.d-editor-input")[0]; + const textarea = queryAll("textarea.d-editor-input")[0]; textarea.selectionStart = 0; textarea.selectionEnd = textarea.value.length; @@ -236,7 +243,7 @@ componentTest("code button", { }, async test(assert) { - const textarea = jumpEnd(find("textarea.d-editor-input")[0]); + const textarea = jumpEnd(queryAll("textarea.d-editor-input")[0]); await click("button.code"); assert.equal(this.value, ` ${I18n.t("composer.code_text")}`); @@ -318,7 +325,7 @@ componentTest("code fences", { }, async test(assert) { - const textarea = jumpEnd(find("textarea.d-editor-input")[0]); + const textarea = jumpEnd(queryAll("textarea.d-editor-input")[0]); await click("button.code"); assert.equal( @@ -430,7 +437,7 @@ componentTest("quote button - empty lines", { this.set("value", "one\n\ntwo\n\nthree"); }, async test(assert) { - const textarea = jumpEnd(find("textarea.d-editor-input")[0]); + const textarea = jumpEnd(queryAll("textarea.d-editor-input")[0]); textarea.selectionStart = 0; @@ -451,7 +458,7 @@ componentTest("quote button - selecting empty lines", { this.set("value", "one\n\n\n\ntwo"); }, async test(assert) { - const textarea = jumpEnd(find("textarea.d-editor-input")[0]); + const textarea = jumpEnd(queryAll("textarea.d-editor-input")[0]); textarea.selectionStart = 6; textarea.selectionEnd = 10; @@ -584,7 +591,7 @@ componentTest("clicking the toggle-direction changes dir from ltr to rtl", { }, async test(assert) { - const textarea = find("textarea.d-editor-input"); + const textarea = queryAll("textarea.d-editor-input"); await click("button.toggle-direction"); assert.equal(textarea.attr("dir"), "rtl"); }, @@ -598,7 +605,7 @@ componentTest("clicking the toggle-direction changes dir from ltr to rtl", { }, async test(assert) { - const textarea = find("textarea.d-editor-input"); + const textarea = queryAll("textarea.d-editor-input"); textarea.attr("dir", "ltr"); await click("button.toggle-direction"); assert.equal(textarea.attr("dir"), "rtl"); @@ -645,7 +652,7 @@ componentTest("emoji", { }, async test(assert) { - jumpEnd(find("textarea.d-editor-input")[0]); + jumpEnd(queryAll("textarea.d-editor-input")[0]); await click("button.emoji"); await click( diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js index 60db5afac9..14091f972a 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js @@ -1,3 +1,4 @@ +import { queryAll } from "discourse/tests/helpers/qunit-helpers"; import { moduleForComponent } from "ember-qunit"; import componentTest from "discourse/tests/helpers/component-test"; @@ -7,7 +8,7 @@ componentTest("default", { template: '