A platform for community discussion. Free, open, simple.
DEV: Replace `count` with qunit-dom (#29674)
Jarek Radoszd67a6002ebaa
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.jsindex 77aac7ef562..43ec7af4877 100644--- a/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { AUTO_GROUPS } from "discourse/lib/constants";import { withPluginApi } from "discourse/lib/plugin-api";import PreloadStore from "discourse/lib/preload-store";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";acceptance("Admin Sidebar - Sections", function (needs) {@@ -96,30 +96,26 @@ acceptance("Admin Sidebar - Sections", function (needs) {await click(".sidebar-toggle-all-sections");await click(".sidebar-section-link[data-link-name='admin_all_reports']");- assert.strictEqual(count(".admin-reports-list__report"), 1);+ assert.dom(".admin-reports-list__report").exists({ count: 1 });await fillIn(".admin-reports-header__filter", "flags");- assert.strictEqual(count(".admin-reports-list__report"), 0);+ assert.dom(".admin-reports-list__report").doesNotExist();await click(".sidebar-section-link[data-link-name='admin_login_and_authentication']");await click(".sidebar-section-link[data-link-name='admin_all_reports']");- assert.strictEqual(- count(".admin-reports-list__report"),- 1,- "navigating back and forth resets filter"- );+ assert+ .dom(".admin-reports-list__report")+ .exists({ count: 1 }, "navigating back and forth resets filter");await fillIn(".admin-reports-header__filter", "activities");- assert.strictEqual(- count(".admin-reports-list__report"),- 1,- "filter is case insensitive"- );+ assert+ .dom(".admin-reports-list__report")+ .exists({ count: 1 }, "filter is case insensitive");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.jsindex e069f02218f..4f371cae1c4 100644--- a/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.js@@ -8,11 +8,7 @@ import {import { test } from "qunit";import siteSettingFixture from "discourse/tests/fixtures/site-settings";import pretender from "discourse/tests/helpers/create-pretender";-import {- acceptance,- count,- queryAll,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";acceptance("Admin - Site Settings", function (needs) {let updatedTitle;@@ -65,11 +61,9 @@ acceptance("Admin - Site Settings", function (needs) {test("changing value updates dirty state", async function (assert) {await visit("/admin/site_settings");await fillIn("#setting-filter", " title ");- assert.strictEqual(- count(".row.setting"),- 1,- "filter returns 1 site setting"- );+ assert+ .dom(".row.setting")+ .exists({ count: 1 }, "filter returns 1 site setting");assert.dom(".row.setting.overridden").doesNotExist("setting isn't overridden");@@ -112,15 +106,15 @@ acceptance("Admin - Site Settings", function (needs) {test("always shows filtered site settings if a filter is set", async function (assert) {await visit("/admin/site_settings");await fillIn("#setting-filter", "title");- assert.strictEqual(count(".row.setting"), 1);+ assert.dom(".row.setting").exists({ count: 1 });// navigate away to the "Dashboard" pageawait click(".nav.nav-pills li:nth-child(1) a");- assert.strictEqual(count(".row.setting"), 0);+ assert.dom(".row.setting").exists({ count: 0 });// navigate back to the "Settings" pageawait click(".nav.nav-pills li:nth-child(2) a");- assert.strictEqual(count(".row.setting"), 1);+ assert.dom(".row.setting").exists({ count: 1 });});test("filtering overridden settings", async function (assert) {@@ -135,11 +129,11 @@ acceptance("Admin - Site Settings", function (needs) {await visit("/admin/site_settings");await fillIn("#setting-filter", "plugin:discourse-logo");- assert.strictEqual(count(".row.setting"), 1);+ assert.dom(".row.setting").exists({ count: 1 });// inexistent pluginawait fillIn("#setting-filter", "plugin:discourse-plugin");- assert.strictEqual(count(".row.setting"), 0);+ assert.dom(".row.setting").exists({ count: 0 });});test("category name is preserved", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.jsindex 27e670f6a45..df8cfaf4c7c 100644--- a/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js@@ -1,7 +1,7 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import DiscoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";acceptance("Category Banners", function (needs) {needs.user();@@ -55,11 +55,9 @@ acceptance("Category Banners", function (needs) {await click(".dialog-footer .btn-primary");assert.dom(".dialog-body").doesNotExist("closes the modal");assert.dom(".category-read-only-banner").exists("shows a banner");- assert.strictEqual(- count(".category-read-only-banner .inner"),- 1,- "it allows staff to embed html in the message"- );+ assert+ .dom(".category-read-only-banner .inner")+ .exists({ count: 1 }, "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.jsindex 29aa6b16a40..0ce78999d29 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@@ -2,7 +2,6 @@ import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,query,queryAll,} from "discourse/tests/helpers/qunit-helpers";@@ -19,7 +18,7 @@ acceptance("Category Edit - Security", function (needs) {const badgeName = firstRow.querySelector(".group-name-label").innerText;assert.strictEqual(badgeName, "everyone");- assert.strictEqual(count(".d-icon-square-check"), 3);+ assert.dom(".d-icon-square-check").exists({ count: 3 });});test("removing a permission", async function (assert) {@@ -82,11 +81,7 @@ acceptance("Category Edit - Security", function (needs) {await availableGroups.expand();await availableGroups.selectRowByValue("everyone");- assert.strictEqual(- count(".row-body"),- 1,- "adds back the permission tp the list"- );+ assert.dom(".row-body").exists("adds back the permission tp the list");const firstRow = query(".row-body");diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.jsindex c78085c1f4c..895ae5bf49a 100644--- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js@@ -3,11 +3,7 @@ import { test } from "qunit";import sinon from "sinon";import DiscourseURL from "discourse/lib/url";import pretender from "discourse/tests/helpers/create-pretender";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import I18n from "discourse-i18n";@@ -69,16 +65,16 @@ acceptance("Category Edit", function (needs) {assert.dom(".minimum-required-tags").exists();assert.dom(".required-tag-groups").exists();- assert.strictEqual(count(".required-tag-group-row"), 0);+ assert.dom(".required-tag-group-row").doesNotExist();await click(".add-required-tag-group");- assert.strictEqual(count(".required-tag-group-row"), 1);+ assert.dom(".required-tag-group-row").exists({ count: 1 });await click(".add-required-tag-group");- assert.strictEqual(count(".required-tag-group-row"), 2);+ assert.dom(".required-tag-group-row").exists({ count: 2 });await click(".delete-required-tag-group");- assert.strictEqual(count(".required-tag-group-row"), 1);+ assert.dom(".required-tag-group-row").exists({ count: 1 });const tagGroupChooser = selectKit(".required-tag-group-row .tag-group-chooser"@@ -87,13 +83,13 @@ acceptance("Category Edit", function (needs) {await tagGroupChooser.selectRowByValue("TagGroup1");await click("#save-category");- assert.strictEqual(count(".required-tag-group-row"), 1);+ assert.dom(".required-tag-group-row").exists({ count: 1 });await click(".delete-required-tag-group");- assert.strictEqual(count(".required-tag-group-row"), 0);+ assert.dom(".required-tag-group-row").doesNotExist();await click("#save-category");- assert.strictEqual(count(".required-tag-group-row"), 0);+ assert.dom(".required-tag-group-row").doesNotExist();});test("Editing allowed tags and tag groups", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.jsindex 1bce09ee1bb..c59edbab430 100644--- a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js@@ -6,7 +6,6 @@ import { toggleCheckDraftPopup } from "discourse/services/composer";import userFixtures from "discourse/tests/fixtures/user-fixtures";import {acceptance,- count,query,selectText,updateCurrentUser,@@ -91,20 +90,16 @@ acceptance("Composer Actions", function (needs) {assert.dom(".composer-actions svg.d-icon-far-eye-slash").doesNotExist("whisper icon is not visible");- assert.strictEqual(- count(".composer-actions svg.d-icon-share"),- 1,- "reply icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-share")+ .exists("reply icon is visible");await composerActions.expand();await composerActions.selectRowByValue("toggle_whisper");- assert.strictEqual(- count(".composer-actions svg.d-icon-far-eye-slash"),- 1,- "whisper icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-far-eye-slash")+ .exists("whisper icon is visible");assert.dom(".composer-actions svg.d-icon-share").doesNotExist("reply icon is not visible");@@ -245,20 +240,16 @@ acceptance("Composer Actions", function (needs) {assert.dom(".composer-actions svg.d-icon-anchor").doesNotExist("no-bump icon is not visible");- assert.strictEqual(- count(".composer-actions svg.d-icon-share"),- 1,- "reply icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-share")+ .exists("reply icon is visible");await composerActions.expand();await composerActions.selectRowByValue("toggle_topic_bump");- assert.strictEqual(- count(".composer-actions svg.d-icon-anchor"),- 1,- "no-bump icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-anchor")+ .exists("no-bump icon is visible");assert.dom(".composer-actions svg.d-icon-share").doesNotExist("reply icon is not visible");@@ -269,11 +260,9 @@ acceptance("Composer Actions", function (needs) {assert.dom(".composer-actions svg.d-icon-anchor").doesNotExist("no-bump icon is not visible");- assert.strictEqual(- count(".composer-actions svg.d-icon-share"),- 1,- "reply icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-share")+ .exists("reply icon is visible");});test("replying to post - whisper and no bump", async function (assert) {@@ -288,27 +277,21 @@ acceptance("Composer Actions", function (needs) {assert.dom(".reply-details .whisper .d-icon-anchor").doesNotExist("no-bump icon is not visible");- assert.strictEqual(- count(".composer-actions svg.d-icon-share"),- 1,- "reply icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-share")+ .exists("reply icon is visible");await composerActions.expand();await composerActions.selectRowByValue("toggle_topic_bump");await composerActions.expand();await composerActions.selectRowByValue("toggle_whisper");- assert.strictEqual(- count(".composer-actions svg.d-icon-far-eye-slash"),- 1,- "whisper icon is visible"- );- assert.strictEqual(- count(".reply-details .no-bump .d-icon-anchor"),- 1,- "no-bump icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-far-eye-slash")+ .exists("whisper icon is visible");+ assert+ .dom(".reply-details .no-bump .d-icon-anchor")+ .exists("no-bump icon is visible");assert.dom(".composer-actions svg.d-icon-share").doesNotExist("reply icon is not visible");@@ -434,11 +417,9 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {assert.dom("#reply-control .btn-primary.create .d-button-label").hasText(I18n.t("composer.create_shared_draft"));- assert.strictEqual(- count(".composer-actions svg.d-icon-far-clipboard"),- 1,- "shared draft icon is visible"- );+ assert+ .dom(".composer-actions svg.d-icon-far-clipboard")+ .exists("shared draft icon is visible");});test("reply_as_new_topic with new_topic draft", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-image-preview-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-image-preview-test.jsindex 8c6c0957f8b..9e26e3aaa9e 100644--- a/app/assets/javascripts/discourse/tests/acceptance/composer-image-preview-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-image-preview-test.js@@ -1,11 +1,7 @@import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";import { test } from "qunit";import { withPluginApi } from "discourse/lib/plugin-api";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";acceptance("Composer - Image Preview", function (needs) {needs.user({});@@ -71,11 +67,9 @@ acceptance("Composer - Image Preview", function (needs) {await fillIn(".d-editor-input", uploads.join("\n"));- assert.strictEqual(- count(".button-wrapper"),- 10,- "it adds correct amount of scaling button groups"- );+ assert+ .dom(".button-wrapper")+ .exists({ count: 10 }, "adds correct number of scaling button groups");// Defaultuploads[0] =diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-test.jsindex 8f4b7915558..bbf5b9babfc 100644--- a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js@@ -24,7 +24,6 @@ import TopicFixtures from "discourse/tests/fixtures/topic";import pretender, { response } from "discourse/tests/helpers/create-pretender";import {acceptance,- count,metaModifier,query,updateCurrentUser,@@ -523,7 +522,7 @@ acceptance("Composer", function (needs) {pretender.put("/posts/:post_id", async () => {// at this point, request is in flight, so post is staged- assert.strictEqual(count(".topic-post.staged"), 1);+ assert.dom(".topic-post.staged").exists();assert.ok(query(".topic-post").classList.contains("staged"));assert.strictEqual(query(".topic-post.staged .cooked").innerText.trim(),@@ -536,7 +535,7 @@ acceptance("Composer", function (needs) {await click("#reply-control button.create");await visit("/t/internationalization-localization/280");- assert.strictEqual(count(".topic-post.staged"), 0);+ assert.dom(".topic-post.staged").doesNotExist();});test("Composer can switch between edits", async function (assert) {@@ -601,11 +600,9 @@ acceptance("Composer", function (needs) {await menu.expand();await menu.selectRowByName("toggle-whisper");- assert.strictEqual(- count(".composer-actions svg.d-icon-far-eye-slash"),- 1,- "it sets the post type to whisper"- );+ assert+ .dom(".composer-actions svg.d-icon-far-eye-slash")+ .exists("sets the post type to whisper");await menu.expand();await menu.selectRowByName("toggle-whisper");@@ -631,78 +628,56 @@ acceptance("Composer", function (needs) {await visit("/t/this-is-a-test-topic/9");await click(".topic-post:nth-of-type(1) button.reply");- assert.strictEqual(- count("#reply-control.open"),- 1,- "it starts in open state by default"- );+ assert.dom("#reply-control.open").exists("starts in open state by default");await click(".toggle-fullscreen");- assert.strictEqual(- count("#reply-control.fullscreen"),- 1,- "it expands composer to full screen"- );+ assert+ .dom("#reply-control.fullscreen")+ .exists("expands composer to full screen");- assert.strictEqual(- count(".composer-fullscreen-prompt"),- 1,- "the exit fullscreen prompt is visible"- );+ assert+ .dom(".composer-fullscreen-prompt")+ .exists("the exit fullscreen prompt is visible");await click(".toggle-fullscreen");- assert.strictEqual(- count("#reply-control.open"),- 1,- "it collapses composer to regular size"- );+ assert+ .dom("#reply-control.open")+ .exists("collapses composer to regular size");await fillIn(".d-editor-input", "This is a dirty reply");await click(".toggler");- assert.strictEqual(- count("#reply-control.draft"),- 1,- "it collapses composer to draft bar"- );+ assert+ .dom("#reply-control.draft")+ .exists("collapses composer to draft bar");await click(".toggle-fullscreen");- assert.strictEqual(- count("#reply-control.open"),- 1,- "from draft, it expands composer back to open state"- );+ assert+ .dom("#reply-control.open")+ .exists("from draft, it expands composer back to open state");});test("Composer fullscreen submit button", async function (assert) {await visit("/t/this-is-a-test-topic/9");await click(".topic-post:nth-of-type(1) button.reply");- assert.strictEqual(- count("#reply-control.open"),- 1,- "it starts in open state by default"- );+ assert.dom("#reply-control.open").exists("starts in open state by default");await click(".toggle-fullscreen");- assert.strictEqual(- count("#reply-control button.create"),- 1,- "it shows composer submit button in fullscreen"- );+ assert+ .dom("#reply-control button.create")+ .exists("shows composer submit button in fullscreen");await fillIn(".d-editor-input", "too short");await click("#reply-control button.create");- assert.strictEqual(- count("#reply-control.open"),- 1,- "it goes back to open state if there's errors"- );+ assert+ .dom("#reply-control.open")+ .exists("goes back to open state if there's errors");});test("Composer can toggle between reply and createTopic", async function (assert) {@@ -715,11 +690,9 @@ acceptance("Composer", function (needs) {"toggle-whisper");- assert.strictEqual(- count(".composer-actions svg.d-icon-far-eye-slash"),- 1,- "it sets the post type to whisper"- );+ assert+ .dom(".composer-actions svg.d-icon-far-eye-slash")+ .exists("sets the post type to whisper");await visit("/");assert.dom("#create-topic").exists("the create topic button is visible");@@ -943,11 +916,9 @@ acceptance("Composer", function (needs) {assert.dom(".save-or-cancel button.create").hasText(I18n.t("composer.create_pm"), "reply button says Message");- assert.strictEqual(- count(".save-or-cancel button.create svg.d-icon-envelope"),- 1,- "reply button has envelope icon"- );+ assert+ .dom(".save-or-cancel button.create svg.d-icon-envelope")+ .exists("reply button has envelope icon");});test("edit button when editing a post in a PM", async function (assert) {@@ -958,11 +929,9 @@ acceptance("Composer", function (needs) {assert.dom(".save-or-cancel button.create").hasText(I18n.t("composer.save_edit"), "save button says Save Edit");- assert.strictEqual(- count(".save-or-cancel button.create svg.d-icon-pencil"),- 1,- "save button has pencil icon"- );+ assert+ .dom(".save-or-cancel button.create svg.d-icon-pencil")+ .exists("save button has pencil icon");});test("Shows duplicate_link notice", async function (assert) {@@ -988,7 +957,7 @@ acceptance("Composer", function (needs) {assert.dom(".composer-popup").doesNotExist();await fillIn(".d-editor-input", "[](https://github.com)");- assert.strictEqual(count(".composer-popup"), 1);+ assert.dom(".composer-popup").exists();});test("Shows the 'group_mentioned' notice", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.jsindex 1927bbfb22e..008c911cbdc 100644--- a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js@@ -1,6 +1,6 @@import { click, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";acceptance("Dashboard", function (needs) {@@ -73,28 +73,24 @@ acceptance("Dashboard", function (needs) {await visit("/admin");await click(".dashboard .navigation-item.reports .navigation-link");- assert.strictEqual(count(".dashboard .admin-reports-list__report"), 1);+ assert.dom(".dashboard .admin-reports-list__report").exists({ count: 1 });await fillIn(".dashboard .admin-reports-header__filter", "flags");- assert.strictEqual(count(".dashboard .admin-reports-list__report"), 0);+ assert.dom(".dashboard .admin-reports-list__report").doesNotExist();await click(".dashboard .navigation-item.security .navigation-link");await click(".dashboard .navigation-item.reports .navigation-link");- assert.strictEqual(- count(".dashboard .admin-reports-list__report"),- 1,- "navigating back and forth resets filter"- );+ assert+ .dom(".dashboard .admin-reports-list__report")+ .exists({ count: 1 }, "navigating back and forth resets filter");await fillIn(".dashboard .admin-reports-header__filter", "activities");- assert.strictEqual(- count(".dashboard .admin-reports-list__report"),- 1,- "filter is case insensitive"- );+ assert+ .dom(".dashboard .admin-reports-list__report")+ .exists({ count: 1 }, "filter is case insensitive");});test("reports filters", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js b/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.jsindex 0f1e9203ad2..7dc0ed875be 100644--- a/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js@@ -3,7 +3,6 @@ import { test } from "qunit";import DoNotDisturb from "discourse/lib/do-not-disturb";import {acceptance,- count,query,queryAll,updateCurrentUser,@@ -55,12 +54,9 @@ acceptance("Do not disturb", function (needs) {await click("#quick-access-profile .do-not-disturb .btn");assert.dom(".do-not-disturb-modal").exists("DND modal is displayed");-- assert.strictEqual(- count(".do-not-disturb-tile"),- 4,- "There are 4 duration choices"- );+ assert+ .dom(".do-not-disturb-tile")+ .exists({ count: 4 }, "there are 4 duration choices");await triggerKeyEvent(".do-not-disturb-tile:nth-child(1)",diff --git a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.jsindex ec8e03a2f7f..40ead612d73 100644--- a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js@@ -2,7 +2,6 @@ import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,query,queryAll,} from "discourse/tests/helpers/qunit-helpers";@@ -116,11 +115,9 @@ acceptance("EmojiPicker", function (needs) {await click(".emoji-picker-emoji-area img.emoji[title='sunglasses']");await click(".emoji-picker-emoji-area img.emoji[title='grinning']");- assert.strictEqual(- count('.section[data-section="recent"] .section-group img.emoji'),- 2,- "it has multiple recent emojis"- );+ assert+ .dom('.section[data-section="recent"] .section-group img.emoji')+ .exists({ count: 2 }, "has multiple recent emojis");assert.dom(".section.recent .section-group img.emoji")diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-index-test.jsindex 40002500327..1f6ee0c47d4 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-index-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-index-test.js@@ -2,7 +2,6 @@ import { click, currentURL, settled, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,queryAll,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -13,11 +12,9 @@ acceptance("Group Members - Anonymous", function () {test("Viewing Members as anon user", async function (assert) {await visit("/g/discourse");- assert.strictEqual(- count(".avatar-flair .d-icon-circle-half-stroke"),- 1,- "it displays the group's avatar flair"- );+ assert+ .dom(".avatar-flair .d-icon-circle-half-stroke")+ .exists("displays the group's avatar flair");assert.dom(".group-members .group-member").exists("lists group members");assert@@ -49,11 +46,7 @@ acceptance("Group Members", function (needs) {await visit("/g/discourse");await click(".group-members-add");- assert.strictEqual(- count(".user-chooser"),- 1,- "it should display the add members modal"- );+ assert.dom(".user-chooser").exists("displays the add members modal");});test("Viewing Members as an admin user", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.jsindex 3449eddd36a..4b24f05ea86 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.js@@ -2,7 +2,6 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -21,11 +20,9 @@ acceptance("Managing Group Category Notification Defaults", function (needs) {test("As an admin", async function (assert) {await visit("/g/discourse/manage/categories");- assert.strictEqual(- count(".groups-notifications-form .category-selector"),- 5,- "it should display category inputs"- );+ assert+ .dom(".groups-notifications-form .category-selector")+ .exists({ count: 5 }, "displays category inputs");});test("As a group owner", async function (assert) {@@ -33,10 +30,8 @@ acceptance("Managing Group Category Notification Defaults", function (needs) {await visit("/g/discourse/manage/categories");- assert.strictEqual(- count(".groups-notifications-form .category-selector"),- 5,- "it should display category inputs"- );+ assert+ .dom(".groups-notifications-form .category-selector")+ .exists({ count: 5 }, "displays category inputs");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.jsindex b478e55a10a..095c6353d86 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.js@@ -2,7 +2,6 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";@@ -20,35 +19,25 @@ acceptance("Managing Group Interaction Settings", function (needs) {await visit("/g/alternative-group/manage/interaction");- assert.strictEqual(- count(".groups-form-visibility-level"),- 1,- "it should display visibility level selector"- );-- assert.strictEqual(- count(".groups-form-mentionable-level"),- 1,- "it should display mentionable level selector"- );-- assert.strictEqual(- count(".groups-form-messageable-level"),- 1,- "it should display messageable level selector"- );-- assert.strictEqual(- count(".groups-form-incoming-email"),- 1,- "it should display incoming email input"- );-- assert.strictEqual(- count(".groups-form-default-notification-level"),- 1,- "it should display default notification level input"- );+ assert+ .dom(".groups-form-visibility-level")+ .exists("displays visibility level selector");++ assert+ .dom(".groups-form-mentionable-level")+ .exists("displays mentionable level selector");++ assert+ .dom(".groups-form-messageable-level")+ .exists("displays messageable level selector");++ assert+ .dom(".groups-form-incoming-email")+ .exists("displays incoming email input");++ assert+ .dom(".groups-form-default-notification-level")+ .exists("displays default notification level input");});test("As a group owner", async function (assert) {@@ -60,35 +49,25 @@ acceptance("Managing Group Interaction Settings", function (needs) {await visit("/g/discourse/manage/interaction");- assert.strictEqual(- count(".groups-form-visibility-level"),- 0,- "it should not display visibility level selector"- );-- assert.strictEqual(- count(".groups-form-mentionable-level"),- 1,- "it should display mentionable level selector"- );-- assert.strictEqual(- count(".groups-form-messageable-level"),- 1,- "it should display messageable level selector"- );-- assert.strictEqual(- count(".groups-form-incoming-email"),- 0,- "it should not display incoming email input"- );-- assert.strictEqual(- count(".groups-form-default-notification-level"),- 1,- "it should display default notification level input"- );+ assert+ .dom(".groups-form-visibility-level")+ .doesNotExist("does not display visibility level selector");++ assert+ .dom(".groups-form-mentionable-level")+ .exists("displays mentionable level selector");++ assert+ .dom(".groups-form-messageable-level")+ .exists("displays messageable level selector");++ assert+ .dom(".groups-form-incoming-email")+ .doesNotExist("does not display incoming email input");++ assert+ .dom(".groups-form-default-notification-level")+ .exists("displays default notification level input");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.jsindex 4dd96966a36..30cdfdf8924 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.js@@ -1,10 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";acceptance("Group logs", function (needs) {needs.user();@@ -99,17 +95,13 @@ acceptance("Group logs", function (needs) {test("Browsing group logs", async function (assert) {await visit("/g/snorlax/manage/logs");- assert.strictEqual(- count("tr.group-manage-logs-row"),- 2,- "it should display the right number of logs"- );+ assert+ .dom("tr.group-manage-logs-row")+ .exists({ count: 2 }, "displays the right number of logs");await click(query(".group-manage-logs-row button"));- assert.strictEqual(- count("tr.group-manage-logs-row"),- 1,- "it should display the right number of logs"- );+ assert+ .dom("tr.group-manage-logs-row")+ .exists({ count: 1 }, "displays the right number of logs");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.jsindex fb2c4faed45..f6c9abb88fe 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.js@@ -3,7 +3,6 @@ import { test } from "qunit";import Site from "discourse/models/site";import {acceptance,- count,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";@@ -30,72 +29,50 @@ acceptance("Managing Group Membership", function (needs) {await visit("/g/alternative-group/manage/membership");- assert.strictEqual(- count('label[for="automatic_membership"]'),- 1,- "it should display automatic membership label"- );+ assert+ .dom('label[for="automatic_membership"]')+ .exists("displays automatic membership label");- assert.strictEqual(- count(".groups-form-primary-group"),- 1,- "it should display set as primary group checkbox"- );+ assert+ .dom(".groups-form-primary-group")+ .exists("displays set as primary group checkbox");- assert.strictEqual(- count(".groups-form-grant-trust-level"),- 1,- "it should display grant trust level selector"- );+ assert+ .dom(".groups-form-grant-trust-level")+ .exists("displays grant trust level selector");- assert.strictEqual(- count(".group-form-public-admission"),- 1,- "it should display group public admission input"- );+ assert+ .dom(".group-form-public-admission")+ .exists("displays group public admission input");- assert.strictEqual(- count(".group-form-public-exit"),- 1,- "it should display group public exit input"- );+ assert+ .dom(".group-form-public-exit")+ .exists("displays group public exit input");- assert.strictEqual(- count(".group-form-allow-membership-requests"),- 1,- "it should display group allow_membership_request input"- );+ assert+ .dom(".group-form-allow-membership-requests")+ .exists("displays group allow_membership_request input");- assert.strictEqual(- count(".group-form-allow-membership-requests[disabled]"),- 1,- "it should disable group allow_membership_request input"- );+ assert+ .dom(".group-form-allow-membership-requests")+ .isDisabled("disables group allow_membership_request input");- assert.strictEqual(- count(".group-flair-inputs"),- 1,- "it should display avatar flair inputs"- );+ assert.dom(".group-flair-inputs").exists("displays avatar flair inputs");await click(".group-form-public-admission");await click(".group-form-allow-membership-requests");- assert.strictEqual(- count(".group-form-public-admission[disabled]"),- 1,- "it should disable group public admission input"- );+ assert+ .dom(".group-form-public-admission")+ .isDisabled("disables group public admission input");assert- .dom(".group-form-public-exit[disabled]")- .doesNotExist("it should not disable group public exit input");+ .dom(".group-form-public-exit")+ .isNotDisabled("it should not disable group public exit input");- assert.strictEqual(- count(".group-form-membership-request-template"),- 1,- "it should display the membership request template field"- );+ assert+ .dom(".group-form-membership-request-template")+ .exists("displays the membership request template field");const emailDomains = selectKit(".group-form-automatic-membership-automatic"@@ -170,28 +147,20 @@ acceptance("Managing Group Membership", function (needs) {.dom(".groups-form-grant-trust-level").doesNotExist("it should not display grant trust level selector");- assert.strictEqual(- count(".group-form-public-admission"),- 1,- "it should display group public admission input"- );+ assert+ .dom(".group-form-public-admission")+ .exists("displays group public admission input");- assert.strictEqual(- count(".group-form-public-exit"),- 1,- "it should display group public exit input"- );+ assert+ .dom(".group-form-public-exit")+ .exists("displays group public exit input");- assert.strictEqual(- count(".group-form-allow-membership-requests"),- 1,- "it should display group allow_membership_request input"- );+ assert+ .dom(".group-form-allow-membership-requests")+ .exists("displays group allow_membership_request input");- assert.strictEqual(- count(".group-form-allow-membership-requests[disabled]"),- 1,- "it should disable group allow_membership_request input"- );+ assert+ .dom(".group-form-allow-membership-requests")+ .isDisabled("disables group allow_membership_request input");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.jsindex 015a47034ff..36cadd3033a 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.js@@ -2,7 +2,6 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -22,21 +21,11 @@ acceptance("Managing Group Profile", function (needs) {test("As an admin", async function (assert) {await visit("/g/discourse/manage/profile");- assert.strictEqual(- count(".group-form-bio"),- 1,- "it should display group bio input"- );- assert.strictEqual(- count(".group-form-name"),- 1,- "it should display group name input"- );- assert.strictEqual(- count(".group-form-full-name"),- 1,- "it should display group full name input"- );+ assert.dom(".group-form-bio").exists("displays group bio input");+ assert.dom(".group-form-name").exists("displays group name input");+ assert+ .dom(".group-form-full-name")+ .exists("displays group full name input");});test("As a group owner", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.jsindex 78670508286..bd76f8b96a8 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.js@@ -2,7 +2,6 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -22,11 +21,9 @@ acceptance("Managing Group Tag Notification Defaults", function (needs) {test("As an admin", async function (assert) {await visit("/g/discourse/manage/tags");- assert.strictEqual(- count(".groups-notifications-form .tag-chooser"),- 5,- "it should display tag inputs"- );+ assert+ .dom(".groups-notifications-form .tag-chooser")+ .exists({ count: 5 }, "displays tag inputs");});test("As a group owner", async function (assert) {@@ -34,10 +31,8 @@ acceptance("Managing Group Tag Notification Defaults", function (needs) {await visit("/g/discourse/manage/tags");- assert.strictEqual(- count(".groups-notifications-form .tag-chooser"),- 5,- "it should display tag inputs"- );+ assert+ .dom(".groups-notifications-form .tag-chooser")+ .exists({ count: 5 }, "displays tag inputs");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.jsindex c7f0782f26e..274606ec4d9 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.js@@ -1,10 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";acceptance("Group Requests", function (needs) {let requests;@@ -89,7 +85,7 @@ acceptance("Group Requests", function (needs) {test("Group Requests", async function (assert) {await visit("/g/Macdonald/requests");- assert.strictEqual(count(".group-members .group-member"), 2);+ assert.dom(".group-members .group-member").exists({ count: 2 });assert.strictEqual(query(".group-members .directory-table__row:first-child .user-detail").innerText.trim()diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-test.jsindex b239c09eb95..2ff8878c054 100644--- a/app/assets/javascripts/discourse/tests/acceptance/group-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/group-test.js@@ -1,10 +1,6 @@import { click, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import I18n from "discourse-i18n";@@ -38,7 +34,7 @@ acceptance("Group - Anonymous", function (needs) {await click(".activity-nav li a[href='/g/discourse/activity/topics']");assert.ok(query(".topic-list"), "it shows the topic list");- assert.strictEqual(count(".topic-list-item"), 2, "it lists stream items");+ assert.dom(".topic-list-item").exists({ count: 2 }, "lists stream items");await click(".activity-nav li a[href='/g/discourse/activity/mentions']");@@ -203,7 +199,7 @@ acceptance("Group - Authenticated", function (needs) {await click(".group-message-button");- assert.strictEqual(count("#reply-control"), 1, "it opens the composer");+ assert.dom("#reply-control").exists("opens the composer");const privateMessageUsers = selectKit("#private-message-users");assert.strictEqual(privateMessageUsers.header().value(),@@ -249,17 +245,13 @@ acceptance("Group - Authenticated", function (needs) {test("Admin Viewing Group", async function (assert) {await visit("/g/discourse");- assert.strictEqual(- count(".nav-pills li a[title='Manage']"),- 1,- "it should show manage group tab if user is admin"- );+ assert+ .dom(".nav-pills li a[title='Manage']")+ .exists("shows manage group tab if user is admin");- assert.strictEqual(- count(".group-message-button"),- 1,- "it displays show group message button"- );+ assert+ .dom(".group-message-button")+ .exists("displays show group message button");assert.dom(".group-info-name").hasText("Awesome Team", "it should display the group name");@@ -287,11 +279,9 @@ acceptance("Group - Authenticated", function (needs) {test("Moderator Viewing Group", async function (assert) {await visit("/g/alternative-group");- assert.strictEqual(- count(".nav-pills li a[title='Manage']"),- 1,- "it should show manage group tab if user can_admin_group"- );+ assert+ .dom(".nav-pills li a[title='Manage']")+ .exists("shows manage group tab if user can_admin_group");await click(".group-members-add.btn");diff --git a/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.jsindex 8faf90c48bf..081cae9826d 100644--- a/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js@@ -1,24 +1,18 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";acceptance("Groups", function () {test("Browsing Groups", async function (assert) {await visit("/g?username=eviltrout");- assert.strictEqual(count(".group-box"), 1, "it displays user's groups");+ assert.dom(".group-box").exists({ count: 1 }, "displays user's groups");await visit("/g");- assert.strictEqual(count(".group-box"), 2, "it displays visible groups");- assert.strictEqual(- count(".group-index-join"),- 1,- "it shows button to join group"- );- assert.strictEqual(- count(".group-index-request"),- 1,- "it shows button to request for group membership"- );+ assert.dom(".group-box").exists({ count: 2 }, "displays visible groups");+ assert.dom(".group-index-join").exists("shows button to join group");+ assert+ .dom(".group-index-request")+ .exists("shows button to request for group membership");await click(".group-index-join");assert.dom(".modal.login-modal").exists("shows the login modal");diff --git a/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js b/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.jsindex b269ce9da89..60921d6b436 100644--- a/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js@@ -1,10 +1,6 @@import { click, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";acceptance("New Group - Anonymous", function () {@@ -24,11 +20,7 @@ acceptance("New Group - Authenticated", function (needs) {await visit("/g");await click(".groups-header-new");- assert.strictEqual(- count(".group-form-save[disabled]"),- 1,- "save button should be disabled"- );+ assert.dom(".group-form-save").isDisabled("save button is disabled");await fillIn("input[name='name']", "1");@@ -39,11 +31,7 @@ acceptance("New Group - Authenticated", function (needs) {"it should show the right validation tooltip");- assert.strictEqual(- count(".group-form-save:disabled"),- 1,- "it should disable the save button"- );+ assert.dom(".group-form-save").isDisabled("disables the save button");await fillIn("input[name='name']",diff --git a/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js b/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.jsindex 4c7ff52add7..00558b70109 100644--- a/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js@@ -1,6 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";acceptance("Pending posts - no existing pending posts", function (needs) {needs.user();@@ -19,6 +19,6 @@ acceptance("Pending posts - existing pending posts", function (needs) {test("Navigate to pending posts", async function (assert) {await visit("/u/eviltrout");await click("[href='/u/eviltrout/activity/pending']");- assert.strictEqual(count(".user-stream-item"), 2);+ assert.dom(".user-stream-item").exists({ count: 2 });});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.jsindex 294b96f69bc..1e34ab41d94 100644--- a/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import sinon from "sinon";import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";import { withPluginApi } from "discourse/lib/plugin-api";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";acceptance("Plugin Keyboard Shortcuts - Logged In", function (needs) {needs.user();@@ -62,13 +62,16 @@ acceptance("Plugin Keyboard Shortcuts - Anonymous", function () {await triggerKeyEvent(document, "keypress", "?".charCodeAt(0));assert.dom(".shortcut-category-new_category").exists();- assert.strictEqual(count(".shortcut-category-new_category li"), 1);+ assert.dom(".shortcut-category-new_category li").exists({ count: 1 });});test("a plugin can add a shortcut to and existing category in the shortcut help modal", async function (assert) {await visit("/");await triggerKeyEvent(document, "keypress", "?".charCodeAt(0));- const countBefore = count(".shortcut-category-application li");+ const countBefore = document.querySelectorAll(+ ".shortcut-category-application li"+ ).length;+await click(".modal-close");withPluginApi("0.8.38", (api) => {@@ -84,9 +87,8 @@ acceptance("Plugin Keyboard Shortcuts - Anonymous", function () {});await triggerKeyEvent(document, "keypress", "?".charCodeAt(0));- assert.strictEqual(- count(".shortcut-category-application li"),- countBefore + 1- );+ assert+ .dom(".shortcut-category-application li")+ .exists({ count: countBefore + 1 });});});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.jsindex daddaae2e37..18d840dce83 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,7 +1,7 @@import { visit } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { registerTemporaryModule } from "../helpers/temporary-module-helper";const HELLO =@@ -20,17 +20,12 @@ acceptance("Plugin Outlet - Multi Template", function (needs) {test("Renders a template into the outlet", async function (assert) {await visit("/u/eviltrout");- assert.strictEqual(- count(".user-profile-primary-outlet.hello"),- 1,- "it has class names"- );- assert.strictEqual(- count(".user-profile-primary-outlet.goodbye"),- 1,- "it has class names"- );- assert.dom(".hello-span").hasText("Hello", "it renders into the outlet");- assert.dom(".bye-span").hasText("Goodbye", "it renders into the outlet");+ assert.dom(".user-profile-primary-outlet").exists({ count: 2 });+ assert.dom(".user-profile-primary-outlet.hello").exists("has class names");+ assert+ .dom(".user-profile-primary-outlet.goodbye")+ .exists("has class names");+ assert.dom(".hello-span").hasText("Hello", "renders into the outlet");+ assert.dom(".bye-span").hasText("Goodbye", "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.jsindex 85a21ef9f54..99d9d17e8d5 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,7 +1,7 @@import { visit } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { registerTemporaryModule } from "../helpers/temporary-module-helper";const CONNECTOR_MODULE =@@ -17,11 +17,7 @@ acceptance("Plugin Outlet - Single Template", function (needs) {test("Renders a template into the outlet", async function (assert) {await visit("/u/eviltrout");- assert.strictEqual(- count(".user-profile-primary-outlet.hello"),- 1,- "it has class names"- );+ assert.dom(".user-profile-primary-outlet").hasClass("hello");assert.dom(".hello-username").hasText("eviltrout", "it renders into the outlet");diff --git a/app/assets/javascripts/discourse/tests/acceptance/post-history-test.js b/app/assets/javascripts/discourse/tests/acceptance/post-history-test.jsindex e5bf0f3c174..7091e0e094c 100644--- a/app/assets/javascripts/discourse/tests/acceptance/post-history-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/post-history-test.js@@ -1,10 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";acceptance("Post - History", function (needs) {needs.user();@@ -54,10 +50,10 @@ acceptance("Post - History", function (needs) {test("Shows highlighted tag changes", async function (assert) {await visit("/t/internationalization-localization/280");await click("article[data-post-id='419'] .edits button");- assert.equal(count(".discourse-tag"), 4);- assert.equal(count(".discourse-tag.diff-del"), 1);+ assert.dom(".discourse-tag").exists({ count: 4 });+ assert.dom(".discourse-tag.diff-del").exists({ count: 1 });assert.equal(query(".discourse-tag.diff-del").textContent, "tag1");- assert.equal(count(".discourse-tag.diff-ins"), 1);+ assert.dom(".discourse-tag.diff-ins").exists({ count: 1 });assert.equal(query(".discourse-tag.diff-ins").textContent, "tag3");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/reports-test.js b/app/assets/javascripts/discourse/tests/acceptance/reports-test.jsindex 4277fd6f9f4..b357d5b828b 100644--- a/app/assets/javascripts/discourse/tests/acceptance/reports-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/reports-test.js@@ -1,10 +1,6 @@import { visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";acceptance("Reports", function (needs) {needs.user();@@ -12,7 +8,7 @@ acceptance("Reports", function (needs) {test("Visit reports page", async function (assert) {await visit("/admin/reports");- assert.strictEqual(count(".admin-reports-list__report"), 1);+ assert.dom(".admin-reports-list__report").exists({ count: 1 });const report = query(".admin-reports-list__report:first-child");diff --git a/app/assets/javascripts/discourse/tests/acceptance/review-test.js b/app/assets/javascripts/discourse/tests/acceptance/review-test.jsindex e4d5f963139..b8a82c50b74 100644--- a/app/assets/javascripts/discourse/tests/acceptance/review-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/review-test.js@@ -2,7 +2,6 @@ import { click, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,loggedInUser,publishToMessageBus,query,@@ -110,7 +109,9 @@ acceptance("Review", function (needs) {"<b>cooked content</b>");- assert.strictEqual(count(".reviewable-flagged-post .reviewable-score"), 2);+ assert+ .dom(".reviewable-flagged-post .reviewable-score")+ .exists({ count: 2 });});test("Flag related", async function (assert) {@@ -221,10 +222,7 @@ acceptance("Review", function (needs) {const reviewable = query(`[data-reviewable-id="1234"]`);assert.notOk(reviewable.className.includes("reviewable-stale"));- assert.strictEqual(- count(`[data-reviewable-id="1234"] .status .pending`),- 1- );+ assert.dom("[data-reviewable-id='1234'] .status .pending").exists();assert.dom(".stale-help").doesNotExist();await publishToMessageBus(`/reviewable_counts/${loggedInUser().id}`, {@@ -235,13 +233,13 @@ acceptance("Review", function (needs) {});assert.ok(reviewable.className.includes("reviewable-stale"));- assert.strictEqual(count("[data-reviewable-id=1234] .status .approved"), 1);- assert.strictEqual(count(".stale-help"), 1);+ assert.dom("[data-reviewable-id='1234'] .status .approved").exists();+ assert.dom(".stale-help").exists();assert.ok(query(".stale-help").innerText.includes("foo"));await visit("/");await visit("/review"); // reload review- assert.strictEqual(count(".stale-help"), 0);+ assert.dom(".stale-help").doesNotExist();});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.jsindex d379803269d..694482aed7d 100644--- a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js@@ -1,10 +1,6 @@import { click, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";acceptance("Search - Mobile", function (needs) {needs.mobileView();@@ -31,7 +27,7 @@ acceptance("Search - Mobile", function (needs) {await fillIn(".search-query", "discourse");await click(".search-cta");- assert.strictEqual(count(".fps-topic"), 1, "has one post");+ assert.dom(".fps-topic").exists({ count: 1 }, "has one post");assert.dom(".advanced-filters[open]")diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-test.jsindex e33101aac17..0e72fd4f3cc 100644--- a/app/assets/javascripts/discourse/tests/acceptance/search-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/search-test.js@@ -12,7 +12,6 @@ import { withPluginApi } from "discourse/lib/plugin-api";import searchFixtures from "discourse/tests/fixtures/search-fixtures";import {acceptance,- count,query,queryAll,} from "discourse/tests/helpers/qunit-helpers";@@ -286,7 +285,7 @@ acceptance("Search - Anonymous", function (needs) {await click("#search-button");await fillIn("#search-term", "@admin");- assert.strictEqual(count(".search-menu-assistant-item"), 2);+ assert.dom(".search-menu-assistant-item").exists({ count: 2 });assert.strictEqual(query(".search-menu-assistant-item:first-child .search-item-slug .label-suffix"@@ -513,13 +512,13 @@ acceptance("Search - Authenticated", function (needs) {await triggerKeyEvent("#search-term", "keyup", "ArrowDown");await click(document.activeElement);- assert.notStrictEqual(count(".search-menu .results .item"), 0);+ assert.dom(".search-menu .results .item").exists();await fillIn("#search-term", "plans empty");await triggerKeyEvent("#search-term", "keyup", 13);- assert.strictEqual(count(".search-menu .results .item"), 0);- assert.strictEqual(count(".search-menu .results .no-results"), 1);+ assert.dom(".search-menu .results .item").doesNotExist();+ assert.dom(".search-menu .results .no-results").exists({ count: 1 });assert.dom(".search-menu .results .no-results").hasText(I18n.t("search.no_results"));@@ -1232,11 +1231,9 @@ acceptance("Search - assistant", function (needs) {await query("input#search-term").focus();await triggerKeyEvent("#search-term", "keyup", "Enter");- assert.strictEqual(- count(".search-menu .search-result-topic"),- 1,- "it passes the PM search context to the search query"- );+ assert+ .dom(".search-menu .search-result-topic")+ .exists({ count: 1 }, "passes the PM search context to the search query");});test("topic results - updates search term when selecting a initial category option", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.jsindex a4a28ef2160..47e9bf7b500 100644--- a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js@@ -1,12 +1,12 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";acceptance("Shared Drafts", function () {test("Viewing and publishing", async function (assert) {await visit("/t/some-topic/9");- assert.strictEqual(count(".shared-draft-controls"), 1);+ assert.dom(".shared-draft-controls").exists();let categoryChooser = selectKit(".shared-draft-controls .category-chooser");assert.strictEqual(categoryChooser.header().value(), "3");@@ -18,7 +18,7 @@ acceptance("Shared Drafts", function () {test("Updating category", async function (assert) {await visit("/t/some-topic/9");- assert.strictEqual(count(".shared-draft-controls"), 1);+ assert.dom(".shared-draft-controls").exists();await click(".edit-topic");diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.jsindex 7eaa246351a..ee44b489310 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js@@ -7,7 +7,6 @@ import categoryFixture from "discourse/tests/fixtures/category-fixtures";import discoveryFixture from "discourse/tests/fixtures/discovery-fixtures";import {acceptance,- count,publishToMessageBus,query,queryAll,@@ -40,13 +39,14 @@ acceptance(await visit("/");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link:not(.sidebar-section-link[data-link-name='all-categories'])"- ),- 1,- "there should only be one section link under the section"- );+ )+ .exists(+ { count: 1 },+ "there should only be one section link under the section"+ );assert.dom(@@ -416,13 +416,14 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {await visit("/");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link:not(.sidebar-section-link[data-link-name='all-categories'])"- ),- 4,- "there should only be 4 section link under the section"- );+ )+ .exists(+ { count: 4 },+ "there should only be 4 section link under the section"+ );assert.dom(@@ -450,13 +451,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {"it should transition to the category1 page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -474,13 +473,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {"it should transition to the category2's page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -523,13 +520,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {"it should transition to the category1 default view page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -568,13 +563,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {"it should transition to the category1 new page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -621,13 +614,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {"it should transition to the category1 unread page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -677,13 +668,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {await visit(`/c/${category1.slug}/${category1.id}/l/new`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -699,13 +688,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {await visit(`/c/${category1.slug}/${category1.id}/l/unread`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -721,13 +708,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {await visit(`/c/${category1.slug}/${category1.id}/l/top`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -743,13 +728,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {await visit(`/c/${category1.slug}/${category1.id}/none`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -765,13 +748,11 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {await visit(`/c/${category1.slug}/${category1.id}/all`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='categories'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.jsindex a20c19c87e4..2ba734d0d01 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js@@ -10,7 +10,6 @@ import { withPluginApi } from "discourse/lib/plugin-api";import topicFixtures from "discourse/tests/fixtures/discovery-fixtures";import {acceptance,- count,loggedInUser,publishToMessageBus,query,@@ -111,13 +110,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"should transition to the latest page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -143,13 +140,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"should transition to the latest page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -185,13 +180,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"should transition to the new page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -235,13 +228,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"should transition to the unread page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -275,13 +266,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"should transition to the users url");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -381,13 +370,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"should transition to the groups url");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -525,13 +512,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"should transition to the user's activity url");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -567,13 +552,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {"transitions to the user's activity drafts url");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -674,13 +657,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {test("visiting top route", async function (assert) {await visit("/top");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -692,13 +673,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {test("visiting unread route", async function (assert) {await visit("/unread");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(@@ -710,13 +689,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {test("visiting new route", async function (assert) {await visit("/new");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='community'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.jsindex 33297cc4eca..1f33d3c3560 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js@@ -3,7 +3,6 @@ import { test } from "qunit";import { NotificationLevels } from "discourse/lib/notification-levels";import {acceptance,- count,publishToMessageBus,query,queryAll,@@ -101,13 +100,11 @@ acceptance().exists("displays the personal message inbox link");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link"- ),- 1,- "only displays the personal message inbox link"- );+ )+ .exists({ count: 1 }, "only displays the personal message inbox link");await click(".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-inbox']"@@ -119,13 +116,14 @@ acceptance().exists("personal message inbox link is marked as active");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link"- ),- 5,- "expands and displays the links for personal messages"- );+ )+ .exists(+ { count: 5 },+ "expands and displays the links for personal messages"+ );});["new", "archive", "sent", "unread"].forEach((type) => {@@ -146,13 +144,14 @@ acceptance(`it should transition to user's ${type} personal messages`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.active"- ),- 2,- "only two links are marked as active in the sidebar"- );+ )+ .exists(+ { count: 2 },+ "only two links are marked as active in the sidebar"+ );assert.dom(@@ -210,41 +209,36 @@ acceptance(await visit("/u/eviltrout/messages/group/GrOuP1");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link"- ),- 6,- "expands and displays the links for group1 group messages"- );+ )+ .exists(+ { count: 6 },+ "expands and displays the links for group1 group messages"+ );- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.group1"- ),- 4,- "expands the links for group1 group messages"- );+ )+ .exists({ count: 4 }, "expands the links for group1 group messages");await click(".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='group-messages-inbox'].group3");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.group1"- ),- 1,- "collapses the links for group1 group messages"- );+ )+ .exists({ count: 1 }, "collapses the links for group1 group messages");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.group3"- ),- 4,- "expands the links for group3 group messages"- );+ )+ .exists({ count: 4 }, "expands the links for group3 group messages");});["new", "archive", "unread"].forEach((type) => {@@ -282,13 +276,14 @@ acceptance(`it should transition to user's ${type} personal messages`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.active"- ),- 2,- "only two links are marked as active in the sidebar"- );+ )+ .exists(+ { count: 2 },+ "only two links are marked as active in the sidebar"+ );assert.dom(@@ -316,29 +311,29 @@ acceptance(await visit("/t/130");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link"- ),- 5,- "5 section links are displayed"- );+ )+ .exists({ count: 5 }, "5 section links are displayed");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.personal-messages"- ),- 1,- "personal messages inbox filter links are not shown"- );+ )+ .exists(+ { count: 1 },+ "personal messages inbox filter links are not shown"+ );- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.foo_group"- ),- 4,- "foo_group messages inbox filter links are shown"- );+ )+ .exists(+ { count: 4 },+ "foo_group messages inbox filter links are shown"+ );});test("viewing personal message topic", async function (assert) {@@ -353,29 +348,26 @@ acceptance(await visit("/t/34");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link"- ),- 6,- "6 section links are displayed"- );+ )+ .exists({ count: 6 }, "6 section links are displayed");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.personal-messages"- ),- 5,- "personal messages inbox filter links are shown"- );+ )+ .exists({ count: 5 }, "personal messages inbox filter links are shown");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='messages'] .sidebar-section-link.foo_group"- ),- 1,- "foo_group messages inbox filter links are not shown"- );+ )+ .exists(+ { count: 1 },+ "foo_group messages inbox filter links are not shown"+ );});test("new and unread counts for group messages", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.jsindex 462bd8d41c3..6746dba296e 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js@@ -4,7 +4,6 @@ import { NotificationLevels } from "discourse/lib/notification-levels";import discoveryFixture from "discourse/tests/fixtures/discovery-fixtures";import {acceptance,- count,publishToMessageBus,query,updateCurrentUser,@@ -71,13 +70,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {test("tag section links for user", async function (assert) {await visit("/");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link:not(.sidebar-section-link[data-link-name='all-tags'])"- ),- 4,- "4 section links under the section"- );+ )+ .exists({ count: 4 }, "4 section links under the section");assert.strictEqual(query(@@ -111,13 +108,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {"it should transition to tag1's topics discovery page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)@@ -131,13 +126,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {"it should transition to tag2's topics discovery page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(`.sidebar-section-link-wrapper[data-tag-name=tag2] a.active`)@@ -160,13 +153,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {"it should transition to tag1's topics discovery page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)@@ -203,13 +194,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {"it should transition to tag1's topics new page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)@@ -246,13 +235,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {"it should transition to tag1's topics unread page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(`.sidebar-section-link-wrapper[data-tag-name=tag1] a.active`)@@ -270,13 +257,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {"it should transition to user's private message tag4 tag page");- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(`.sidebar-section-link-wrapper[data-tag-name=tag4] a.active`)@@ -286,13 +271,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {test("visiting tag discovery top route", async function (assert) {await visit(`/tag/tag1/l/top`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active")@@ -302,13 +285,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {test("visiting tag discovery new ", async function (assert) {await visit(`/tag/tag1/l/new`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active")@@ -318,13 +299,11 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {test("visiting tag discovery unread route", async function (assert) {await visit(`/tag/tag1/l/unread`);- assert.strictEqual(- count(+ assert+ .dom(".sidebar-section[data-section-name='tags'] .sidebar-section-link.active"- ),- 1,- "only one link is marked as active"- );+ )+ .exists({ count: 1 }, "only one link is marked as active");assert.dom(".sidebar-section-link-wrapper[data-tag-name=tag1] a.active")diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-test.jsindex cd6c825bf48..0e906c6a09a 100644--- a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js@@ -2,7 +2,6 @@ import { click, currentURL, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,query,queryAll,updateCurrentUser,@@ -193,11 +192,12 @@ acceptance("Tags listed by group", function (needs) {test("list the tags in groups", async function (assert) {await visit("/tags");- assert.strictEqual(- count(".tag-list"),- 4,- "shows separate lists for the 3 groups and the ungrouped tags"- );+ assert+ .dom(".tag-list")+ .exists(+ { count: 4 },+ "shows separate lists for the 3 groups and the ungrouped tags"+ );assert.deepEqual([...queryAll(".tag-list h3")].map((el) => el.innerText),["Ford Cars", "Honda Cars", "Makes", "Other Tags"],@@ -238,7 +238,7 @@ acceptance("Tags listed by group", function (needs) {assert.dom("#create-topic:disabled").doesNotExist();await visit("/tag/staff-only-tag");- assert.strictEqual(count("#create-topic:disabled"), 1);+ assert.dom("#create-topic").isDisabled();updateCurrentUser({ moderator: true });@@ -429,7 +429,7 @@ acceptance("Tag info", function (needs) {updateCurrentUser({ moderator: false, admin: false });await visit("/tag/planters");- assert.strictEqual(count("#show-tag-info"), 1);+ assert.dom("#show-tag-info").exists();await click("#show-tag-info");assert.dom(".tag-info .tag-name").exists("show tag");@@ -437,16 +437,10 @@ acceptance("Tag info", function (needs) {query(".tag-info .tag-associations").innerText.includes("Gardening"),"show tag group names");- assert.strictEqual(- count(".tag-info .synonyms-list .tag-box"),- 2,- "shows the synonyms"- );- assert.strictEqual(- count(".tag-info .badge-category"),- 1,- "show the category"- );+ assert+ .dom(".tag-info .synonyms-list .tag-box")+ .exists({ count: 2 }, "shows the synonyms");+ assert.dom(".tag-info .badge-category").exists("show the category");assert.dom("#rename-tag").doesNotExist("can't rename tag");assert.dom("#edit-synonyms").doesNotExist("can't edit synonyms");assert.dom("#delete-tag").doesNotExist("can't delete tag");@@ -456,7 +450,7 @@ acceptance("Tag info", function (needs) {updateCurrentUser({ moderator: false, admin: true });await visit("/tag/happy-monkey");- assert.strictEqual(count("#show-tag-info"), 1);+ assert.dom("#show-tag-info").exists();await click("#show-tag-info");assert.dom(".tag-info .tag-name").exists("show tag");@@ -478,7 +472,7 @@ acceptance("Tag info", function (needs) {updateCurrentUser({ moderator: false, admin: true });await visit("/tag/happy-monkey");- assert.strictEqual(count("#show-tag-info"), 1);+ assert.dom("#show-tag-info").exists();await click("#show-tag-info");assert.dom(".tag-info .tag-name").exists("show tag");@@ -595,7 +589,7 @@ acceptance("Tag info", function (needs) {updateCurrentUser({ moderator: false, admin: true });await visit("/tag/planters");- assert.strictEqual(count("#show-tag-info"), 1);+ assert.dom("#show-tag-info").exists();await click("#show-tag-info");assert.dom(".edit-tag").exists("can rename tag");@@ -603,23 +597,17 @@ acceptance("Tag info", function (needs) {assert.dom("#delete-tag").exists("can delete tag");await click("#edit-synonyms");- assert.strictEqual(- count(".unlink-synonym:visible"),- 2,- "unlink UI is visible"- );- assert.strictEqual(- count(".delete-synonym:visible"),- 2,- "delete UI is visible"- );+ assert+ .dom(".unlink-synonym")+ .isVisible({ count: 2 }, "unlink UI is visible");+ assert+ .dom(".delete-synonym")+ .isVisible({ count: 2 }, "delete UI is visible");await click(".unlink-synonym:nth-of-type(1)");- assert.strictEqual(- count(".tag-info .synonyms-list .tag-box"),- 1,- "removed a synonym"- );+ assert+ .dom(".tag-info .synonyms-list .tag-box")+ .exists({ count: 1 }, "removed a synonym");});test("composer will not set tags if user cannot create them", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-test.jsindex ec879039cac..cae2d615af0 100644--- a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js@@ -12,7 +12,6 @@ import topicFixtures from "discourse/tests/fixtures/topic";import {acceptance,chromeTest,- count,publishToMessageBus,query,selectText,@@ -141,7 +140,7 @@ acceptance("Topic", function (needs) {await click(".topic-post:nth-of-type(1) button.show-post-admin-menu");await click(".btn.wiki");- assert.strictEqual(count("button.wiki"), 1, "it shows the wiki icon");+ assert.dom("button.wiki").exists("shows the wiki icon");});test("Visit topic routes", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-bookmark-bulk-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-bookmark-bulk-actions-test.jsindex a779fd8952b..1f07cc985c3 100644--- a/app/assets/javascripts/discourse/tests/acceptance/user-bookmark-bulk-actions-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/user-bookmark-bulk-actions-test.js@@ -1,10 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- queryAll,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import I18n from "discourse-i18n";@@ -34,19 +30,15 @@ acceptance("Bookmark - Bulk Actions", function (needs) {await click("button.bulk-clear-all");- assert.strictEqual(- count("input.bulk-select:checked"),- 0,- "Clear all should clear all selection"- );+ assert+ .dom("input.bulk-select:checked")+ .doesNotExist("Clear all should clear all selection");await click("button.bulk-select-all");- assert.strictEqual(- count("input.bulk-select:checked"),- 2,- "Select all should select all topics"- );+ assert+ .dom("input.bulk-select:checked")+ .exists({ count: 2 }, "Select all should select all topics");await dropdown.expand();await dropdown.selectRowByValue("delete-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.jsindex 4da75a363fd..6637286c0ac 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@@ -3,7 +3,6 @@ import { IMAGE_VERSION } from "pretty-text/emoji/version";import { test } from "qunit";import {acceptance,- count,normalizeHtml,query,} from "discourse/tests/helpers/qunit-helpers";@@ -13,17 +12,15 @@ acceptance("User Drafts", function (needs) {test("Stream", async function (assert) {await visit("/u/eviltrout/activity/drafts");- assert.strictEqual(count(".user-stream-item"), 3, "has drafts");+ assert.dom(".user-stream-item").exists({ count: 3 }, "has drafts");await click(".user-stream-item:first-child .remove-draft");assert.dom(".dialog-body").exists();await click(".dialog-footer .btn-primary");- assert.strictEqual(- count(".user-stream-item"),- 2,- "draft removed, list length diminished by one"- );+ assert+ .dom(".user-stream-item")+ .exists({ count: 2 }, "draft removed, list length diminished by one");await visit("/");assert.dom("#create-topic").exists();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.jsindex f784ead50f5..964eec9a984 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@@ -4,11 +4,7 @@ import cookie, { removeCookie } from "discourse/lib/cookie";import Session from "discourse/models/session";import Site from "discourse/models/site";import userFixtures from "discourse/tests/fixtures/user-fixtures";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import I18n from "discourse-i18n";@@ -135,10 +131,9 @@ acceptance("User Preferences - Interface", function (needs) {assert.strictEqual(selectKit(".theme .select-kit").header().value(), "2");await selectKit(".light-color-scheme .select-kit").expand();- assert.strictEqual(- count(".light-color-scheme .select-kit .select-kit-row"),- 2- );+ assert+ .dom(".light-color-scheme .select-kit .select-kit-row")+ .exists({ count: 2 });document.querySelector("meta[name='discourse_theme_id']").remove();});diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.jsindex 211e86bc206..33c28aaab32 100644--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js@@ -2,7 +2,6 @@ import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,fakeTime,loggedInUser,queryAll,@@ -78,11 +77,9 @@ acceptance("User notification schedule", function (needs) {"None","set monday label to none");- assert.strictEqual(- count(".day.Monday .select-kit.single-select"),- 1,- "The end time input is hidden"- );+ assert+ .dom(".day.Monday .select-kit.single-select")+ .exists({ count: 1 }, "the end time input is hidden");});test("If start time is after end time, end time gets bumped 30 minutes past start time", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.jsindex 896d205ba84..dd8a82cf19e 100644--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js@@ -2,7 +2,6 @@ import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,query,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -43,25 +42,21 @@ acceptance("User Preferences - Security", function (needs) {I18n.t("user.auth_tokens.show_all", { count: 3 }),"it should display two tokens");- assert.strictEqual(- count(".pref-auth-tokens .auth-token"),- 2,- "it should display two tokens"- );+ assert+ .dom(".pref-auth-tokens .auth-token")+ .exists({ count: 2 }, "displays two tokens");await click(".pref-auth-tokens > a:nth-of-type(1)");- assert.strictEqual(- count(".pref-auth-tokens .auth-token"),- 3,- "it should display three tokens"- );+ assert+ .dom(".pref-auth-tokens .auth-token")+ .exists({ count: 3 }, "displays three tokens");const authTokenDropdown = selectKit(".auth-token-dropdown");await authTokenDropdown.expand();await authTokenDropdown.selectRowByValue("notYou");- assert.strictEqual(count(".d-modal:visible"), 1, "modal should appear");+ assert.dom(".d-modal").exists("modal appears");});test("Viewing user api keys", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.jsindex f466e443f96..41156d80e84 100644--- a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js@@ -10,7 +10,6 @@ import {import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";import {acceptance,- count,publishToMessageBus,query,updateCurrentUser,@@ -31,11 +30,7 @@ acceptance(test("viewing messages", async function (assert) {await visit("/u/eviltrout/messages");- assert.strictEqual(- count(".topic-list-item"),- 1,- "displays the topic list"- );+ assert.dom(".topic-list-item").exists("displays the topic list");assert.dom(".group-notifications-button")@@ -469,11 +464,9 @@ acceptance(await publishUnreadToMessageBus({ topicId: 2, userId: 5 });await publishUnreadToMessageBus({ topicId: 3, userId: 5 });- assert.strictEqual(- count(".topic-list-item"),- 3,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 3 }, "displays the right topic list");await click(".btn.dismiss-read");await click("#dismiss-read-confirm");@@ -484,49 +477,39 @@ acceptance("displays the right count");- assert.strictEqual(- count(".topic-list-item"),- 0,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .doesNotExist("displays the right topic list");});test("dismissing personal unread messages", async function (assert) {await visit("/u/charlie/messages/unread");- assert.strictEqual(- count(".topic-list-item"),- 3,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 3 }, "displays the right topic list");await click(".btn.dismiss-read");await click("#dismiss-read-confirm");- assert.strictEqual(- count(".topic-list-item"),- 0,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .doesNotExist("displays the right topic list");});test("dismissing group unread messages", async function (assert) {await visit("/u/charlie/messages/group/awesome_group/unread");- assert.strictEqual(- count(".topic-list-item"),- 3,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 3 }, "displays the right topic list");await click(".btn.dismiss-read");await click("#dismiss-read-confirm");- assert.strictEqual(- count(".topic-list-item"),- 0,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .doesNotExist("displays the right topic list");});test("dismissing new messages", async function (assert) {@@ -536,11 +519,9 @@ acceptance(await publishNewToMessageBus({ topicId: 2, userId: 5 });await publishNewToMessageBus({ topicId: 3, userId: 5 });- assert.strictEqual(- count(".topic-list-item"),- 3,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 3 }, "displays the right topic list");await click(".btn.dismiss-read");@@ -550,47 +531,37 @@ acceptance("displays the right count");- assert.strictEqual(- count(".topic-list-item"),- 0,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .doesNotExist("displays the right topic list");});test("dismissing personal new messages", async function (assert) {await visit("/u/charlie/messages/new");- assert.strictEqual(- count(".topic-list-item"),- 3,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 3 }, "displays the right topic list");await click(".btn.dismiss-read");- assert.strictEqual(- count(".topic-list-item"),- 0,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .doesNotExist("displays the right topic list");});test("dismissing new group messages", async function (assert) {await visit("/u/charlie/messages/group/awesome_group/new");- assert.strictEqual(- count(".topic-list-item"),- 3,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 3 }, "displays the right topic list");await click(".btn.dismiss-read");- assert.strictEqual(- count(".topic-list-item"),- 0,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .doesNotExist("displays the right topic list");});test("viewing messages when highest read cache has been set for a topic", async function (assert) {@@ -612,11 +583,9 @@ acceptance(test("viewing messages", async function (assert) {await visit("/u/charlie/messages");- assert.strictEqual(- count(".topic-list-item"),- 3,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 3 }, "displays the right topic list");assert.strictEqual(query(`tr[data-topic-id="1"] .topic-post-badges`).textContent.trim(),@@ -626,11 +595,9 @@ acceptance(await visit("/u/charlie/messages/group/awesome_group");- assert.strictEqual(- count(".topic-list-item"),- 2,- "displays the right topic list"- );+ assert+ .dom(".topic-list-item")+ .exists({ count: 2 }, "displays the right topic list");assert.dom(".group-notifications-button")diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.jsindex 4c468d82833..37b4bd63c6d 100644--- a/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js@@ -2,7 +2,7 @@ import { click, render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | d-navigation", function (hooks) {setupRenderingTest(hooks);@@ -23,11 +23,9 @@ module("Integration | Component | d-navigation", function (hooks) {await render(hbs`<DNavigation @filterMode="categories" />`);await click(".category-drop .select-kit-header-wrapper");- assert.strictEqual(- count(".category-row"),- 1,- "displays only categories that are not muted"- );+ assert+ .dom(".category-row")+ .exists({ count: 1 }, "displays only categories that are not muted");assert.strictEqual(query(".category-row .badge-category span").textContent.trim(),"dev"diff --git a/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.jsindex 41b64884164..e812ad60377 100644--- a/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.js@@ -2,7 +2,6 @@ import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | group-membership-button", function (hooks) {setupRenderingTest(hooks);@@ -40,11 +39,7 @@ module("Integration | Component | group-membership-button", function (hooks) {.doesNotExist("can't leave group if user is not in the group");this.set("model.is_group_user", true);- assert.strictEqual(- count(".group-index-leave"),- 1,- "allowed to leave group"- );+ assert.dom(".group-index-leave").exists("allowed to leave group");});test("canRequestMembership", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/integration/components/light-dark-img-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/light-dark-img-test.gjsindex 707303d780a..b8f9f405aca 100644--- a/app/assets/javascripts/discourse/tests/integration/components/light-dark-img-test.gjs+++ b/app/assets/javascripts/discourse/tests/integration/components/light-dark-img-test.gjs@@ -3,7 +3,7 @@ import { render } from "@ember/test-helpers";import { module, test } from "qunit";import LightDarkImg from "discourse/components/light-dark-img";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";const lightSrc = { url: "/images/light.jpg", width: 376, height: 500 };const darkSrc = { url: "/images/light.jpg", width: 432, height: 298 };@@ -35,7 +35,7 @@ module("Integration | Component | light-dark-img", function (hooks) {await render(<template><LightDarkImg @lightImg={{lightSrc}} /></template>);assert.dom("picture").doesNotExist("there is no picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),lightSrc.url,@@ -53,7 +53,7 @@ module("Integration | Component | light-dark-img", function (hooks) {</template>);assert.dom("picture").doesNotExist("there is no picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),lightSrc.url,@@ -80,7 +80,7 @@ module("Integration | Component | light-dark-img", function (hooks) {await render(<template><LightDarkImg @lightImg={{lightSrc}} /></template>);assert.dom("picture").doesNotExist("there is no picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),lightSrc.url,@@ -97,14 +97,14 @@ module("Integration | Component | light-dark-img", function (hooks) {<LightDarkImg @lightImg={{lightSrc}} @darkImg={{darkSrc}} /></template>);- assert.strictEqual(count("picture"), 1, "there is a picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("picture").exists("there is a picture tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),lightSrc.url,"the img src is the light image");- assert.strictEqual(count("source"), 1, "there is a source tag");+ assert.dom("source").exists("there is a source tag");assert.strictEqual(query("source").getAttribute("srcset"),darkSrc.url,@@ -130,7 +130,7 @@ module("Integration | Component | light-dark-img", function (hooks) {await render(<template><LightDarkImg @lightImg={{lightSrc}} /></template>);assert.dom("picture").doesNotExist("there is no picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),lightSrc.url,@@ -147,14 +147,14 @@ module("Integration | Component | light-dark-img", function (hooks) {<LightDarkImg @lightImg={{lightSrc}} @darkImg={{darkSrc}} /></template>);- assert.strictEqual(count("picture"), 1, "there is a picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("picture").exists("there is a picture tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),darkSrc.url,"the img src is the dark image");- assert.strictEqual(count("source"), 1, "there is a source tag");+ assert.dom("source").exists("there is a source tag");assert.strictEqual(query("source").getAttribute("srcset"),darkSrc.url,@@ -180,7 +180,7 @@ module("Integration | Component | light-dark-img", function (hooks) {await render(<template><LightDarkImg @lightImg={{lightSrc}} /></template>);assert.dom("picture").doesNotExist("there is no picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),lightSrc.url,@@ -197,14 +197,14 @@ module("Integration | Component | light-dark-img", function (hooks) {<LightDarkImg @lightImg={{lightSrc}} @darkImg={{darkSrc}} /></template>);- assert.strictEqual(count("picture"), 1, "there is a picture tag");- assert.strictEqual(count("img"), 1, "there is an img tag");+ assert.dom("picture").exists("there is a picture tag");+ assert.dom("img").exists("there is an img tag");assert.strictEqual(query("img").getAttribute("src"),darkSrc.url,"the img src is the dark image");- assert.strictEqual(count("source"), 1, "there is a source tag");+ assert.dom("source").exists("there is a source tag");assert.strictEqual(query("source").getAttribute("srcset"),darkSrc.url,diff --git a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.jsindex cac0e5a8780..56c37345987 100644--- a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js@@ -2,7 +2,7 @@ import { blur, click, fillIn, render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";module("Integration | Component | secret-value-list", function (hooks) {@@ -23,31 +23,31 @@ module("Integration | Component | secret-value-list", function (hooks) {await fillIn(".new-value-input.key", "thirdKey");await click(".add-value-btn");- assert.strictEqual(- count(".values .value"),- 2,- "it doesn't add the value to the list if secret is missing"- );+ assert+ .dom(".values .value")+ .exists(+ { count: 2 },+ "doesn't add the value to the list if secret is missing"+ );await fillIn(".new-value-input.key", "");await fillIn(".new-value-input.secret", "thirdValue");await click(".add-value-btn");- assert.strictEqual(- count(".values .value"),- 2,- "it doesn't add the value to the list if key is missing"- );+ assert+ .dom(".values .value")+ .exists(+ { count: 2 },+ "doesn't add the value to the list if key is missing"+ );await fillIn(".new-value-input.key", "thirdKey");await fillIn(".new-value-input.secret", "thirdValue");await click(".add-value-btn");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");assert.deepEqual(this.values,@@ -144,11 +144,9 @@ module("Integration | Component | secret-value-list", function (hooks) {await click(".values .value[data-index='0'] .remove-value-btn");- assert.strictEqual(- count(".values .value"),- 1,- "it removes the value from the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 1 }, "removes the value from the list of values");assert.strictEqual(this.values,diff --git a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.jsindex be892d6ba9b..bae17200362 100644--- a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js@@ -8,7 +8,7 @@ import {import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | simple-list", function (hooks) {setupRenderingTest(hooks);@@ -25,11 +25,9 @@ module("Integration | Component | simple-list", function (hooks) {await fillIn(".add-value-input", "penar");await click(".add-value-btn");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");assert.strictEqual(query(".values .value[data-index='2'] .value-input").value,@@ -40,11 +38,9 @@ module("Integration | Component | simple-list", function (hooks) {await fillIn(".add-value-input", "eviltrout");await triggerKeyEvent(".add-value-input", "keydown", "Enter");- assert.strictEqual(- count(".values .value"),- 4,- "it adds the value when keying Enter"- );+ assert+ .dom(".values .value")+ .exists({ count: 4 }, "adds the value when keying Enter");});test("adding a value when list is predefined", async function (assert) {@@ -56,14 +52,12 @@ module("Integration | Component | simple-list", function (hooks) {);await click(".add-value-input summary");- assert.strictEqual(count(".select-kit-row"), 1);+ assert.dom(".select-kit-row").exists({ count: 1 });await click(".select-kit-row");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");});test("changing a value", async function (assert) {@@ -95,11 +89,9 @@ module("Integration | Component | simple-list", function (hooks) {await click(".values .value[data-index='0'] .remove-value-btn");- assert.strictEqual(- count(".values .value"),- 1,- "it removes the value from the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 1 }, "removes the value from the list of values");assert.strictEqual(query(".values .value[data-index='0'] .value-input").value,@@ -118,11 +110,9 @@ module("Integration | Component | simple-list", function (hooks) {await fillIn(".add-value-input", "eviltrout");await click(".add-value-btn");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");assert.strictEqual(query(".values .value[data-index='2'] .value-input").value,diff --git a/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js b/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.jsindex 8f1200f0647..9ebc6aa5794 100644--- a/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js@@ -2,7 +2,6 @@ import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | slow-mode-info", function (hooks) {setupRenderingTest(hooks);@@ -28,7 +27,7 @@ module("Integration | Component | slow-mode-info", function (hooks) {await render(hbs`<SlowModeInfo @topic={{this.topic}} />`);- assert.strictEqual(count(".slow-mode-heading"), 1);+ assert.dom(".slow-mode-heading").exists();});test("staff and TL4 users can disable slow mode", async function (assert) {@@ -41,7 +40,7 @@ module("Integration | Component | slow-mode-info", function (hooks) {hbs`<SlowModeInfo @topic={{this.topic}} @user={{this.user}} />`);- assert.strictEqual(count(".slow-mode-remove"), 1);+ assert.dom(".slow-mode-remove").exists();});test("regular users can't disable slow mode", async function (assert) {@@ -56,6 +55,6 @@ module("Integration | Component | slow-mode-info", function (hooks) {assert.dom(".slow-mode-remove")- .doesNotExist("it doesn't let you disable slow mode");+ .doesNotExist("doesn't let you disable slow mode");});});diff --git a/app/assets/javascripts/discourse/tests/integration/components/software-update-prompt-test.js b/app/assets/javascripts/discourse/tests/integration/components/software-update-prompt-test.jsindex 43f7f4d85c0..11ad9889933 100644--- a/app/assets/javascripts/discourse/tests/integration/components/software-update-prompt-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/software-update-prompt-test.js@@ -2,10 +2,7 @@ import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import {- count,- publishToMessageBus,-} from "discourse/tests/helpers/qunit-helpers";+import { publishToMessageBus } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | software-update-prompt", function (hooks) {setupRenderingTest(hooks);@@ -19,10 +16,8 @@ module("Integration | Component | software-update-prompt", function (hooks) {await publishToMessageBus("/global/asset-version", "somenewversion");- assert.strictEqual(- count("div.software-update-prompt.require-software-refresh"),- 1,- "it does have the class to show the prompt"- );+ assert+ .dom("div.software-update-prompt")+ .hasClass("require-software-refresh", "has the class to show the prompt");});});diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.jsindex d2b87090862..b2c60f6c186 100644--- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js@@ -2,7 +2,7 @@ import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";import Theme from "admin/models/theme";@@ -14,7 +14,7 @@ module("Integration | Component | themes-list-item", function (hooks) {await render(hbs`<ThemesListItem @theme={{this.theme}} />`);- assert.strictEqual(count(".d-icon-check"), 1, "shows default theme icon");+ assert.dom(".d-icon-check").exists("shows default theme icon");});test("pending updates", async function (assert) {@@ -25,11 +25,7 @@ module("Integration | Component | themes-list-item", function (hooks) {await render(hbs`<ThemesListItem @theme={{this.theme}} />`);- assert.strictEqual(- count(".d-icon-arrows-rotate"),- 1,- "shows pending update icon"- );+ assert.dom(".d-icon-arrows-rotate").exists("shows pending update icon");});test("broken theme", async function (assert) {@@ -43,11 +39,7 @@ module("Integration | Component | themes-list-item", function (hooks) {await render(hbs`<ThemesListItem @theme={{this.theme}} />`);- assert.strictEqual(- count(".d-icon-circle-exclamation"),- 1,- "shows broken theme icon"- );+ assert.dom(".d-icon-circle-exclamation").exists("shows broken theme icon");});test("with children", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.jsindex 2e59f1e6a80..51c55ea8618 100644--- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js@@ -2,7 +2,7 @@ import { fillIn, render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query, queryAll } from "discourse/tests/helpers/qunit-helpers";+import { query, queryAll } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import I18n from "discourse-i18n";import Theme, { COMPONENTS, THEMES } from "admin/models/theme";@@ -56,11 +56,9 @@ module("Integration | Component | themes-list", function (hooks) {.doesNotExist("there is no inactive themes separator when all themes are inactive");- assert.strictEqual(- count(".themes-list-container__item .info"),- 5,- "displays all themes"- );+ assert+ .dom(".themes-list-container__item .info")+ .exists({ count: 5 }, "displays all themes");[2, 3].forEach((num) => this.themes[num].set("user_selectable", true));this.themes[4].set("default", true);@@ -88,11 +86,12 @@ module("Integration | Component | themes-list", function (hooks) {);this.set("themes", []);- assert.strictEqual(- count(".themes-list-container__item .empty"),- 1,- "shows one entry with a message when there is nothing to display"- );+ assert+ .dom(".themes-list-container__item .empty")+ .exists(+ { count: 1 },+ "shows one entry with a message when there is nothing to display"+ );assert.dom(".themes-list-container__item span.empty").hasText(@@ -133,18 +132,17 @@ module("Integration | Component | themes-list", function (hooks) {);assert.dom(".inactive-indicator").doesNotExist("there is no separator");- assert.strictEqual(- count(".themes-list-container__item .info"),- 5,- "displays all components"- );+ assert+ .dom(".themes-list-container__item .info")+ .exists({ count: 5 }, "displays all components");this.set("components", []);- assert.strictEqual(- count(".themes-list-container__item .empty"),- 1,- "shows one entry with a message when there is nothing to display"- );+ assert+ .dom(".themes-list-container__item .empty")+ .exists(+ { count: 1 },+ "shows one entry with a message when there is nothing to display"+ );assert.dom(".themes-list-container__item span.empty").hasText(diff --git a/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.js b/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.jsindex 07c9064dd85..e834028dfdb 100644--- a/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.js@@ -2,7 +2,6 @@ import { click, render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | uppy-image-uploader", function (hooks) {setupRenderingTest(hooks);@@ -12,17 +11,8 @@ module("Integration | Component | uppy-image-uploader", function (hooks) {<UppyImageUploader @type="avatar" @id="test-uppy-image-uploader" @imageUrl="/images/avatar.png" @placeholderUrl="/not/used.png" />`);- assert.strictEqual(- count(".d-icon-far-image"),- 1,- "it displays the upload icon"- );-- assert.strictEqual(- count(".d-icon-trash-can"),- 1,- "it displays the trash icon"- );+ assert.dom(".d-icon-far-image").exists("displays the upload icon");+ assert.dom(".d-icon-trash-can").exists("displays the trash icon");assert.dom(".placeholder-overlay")@@ -42,12 +32,7 @@ module("Integration | Component | uppy-image-uploader", function (hooks) {hbs`<UppyImageUploader @type="site_setting" @id="test-uppy-image-uploader" />`);- assert.strictEqual(- count(".d-icon-far-image"),- 1,- "it displays the upload icon"- );-+ assert.dom(".d-icon-far-image").exists("displays the upload icon");assert.dom(".d-icon-trash-can").doesNotExist("does not display trash icon");assert@@ -60,22 +45,13 @@ module("Integration | Component | uppy-image-uploader", function (hooks) {hbs`<UppyImageUploader @type="composer" @id="test-uppy-image-uploader" @placeholderUrl="/images/avatar.png" />`);- assert.strictEqual(- count(".d-icon-far-image"),- 1,- "it displays the upload icon"- );-+ assert.dom(".d-icon-far-image").exists("displays the upload icon");assert.dom(".d-icon-trash-can").doesNotExist("does not display trash icon");assert.dom(".image-uploader-lightbox-btn").doesNotExist("it does not display the button to open image lightbox");- assert.strictEqual(- count(".placeholder-overlay"),- 1,- "it displays the placeholder image"- );+ assert.dom(".placeholder-overlay").exists("displays the placeholder image");});});diff --git a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.jsindex 2c8301ea81b..43d18d578fe 100644--- a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js@@ -2,7 +2,7 @@ import { blur, click, fillIn, render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";module("Integration | Component | value-list", function (hooks) {@@ -17,11 +17,9 @@ module("Integration | Component | value-list", function (hooks) {await selectKit().fillInFilter("eviltrout");await selectKit().keyboard("Enter");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");assert.strictEqual(this.values,@@ -52,11 +50,9 @@ module("Integration | Component | value-list", function (hooks) {await click(".values .value[data-index='0'] .remove-value-btn");- assert.strictEqual(- count(".values .value"),- 1,- "it removes the value from the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 1 }, "removes the value from the list of values");assert.strictEqual(this.values, "osama", "it removes the expected value");@@ -80,11 +76,9 @@ module("Integration | Component | value-list", function (hooks) {await selectKit().expand();await selectKit().selectRowByValue("maja");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");assert.strictEqual(this.values,@@ -104,11 +98,9 @@ module("Integration | Component | value-list", function (hooks) {await selectKit().fillInFilter("eviltrout");await selectKit().selectRowByValue("eviltrout");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");assert.deepEqual(this.values,@@ -128,11 +120,9 @@ module("Integration | Component | value-list", function (hooks) {await selectKit().fillInFilter("eviltrout");await selectKit().keyboard("Enter");- assert.strictEqual(- count(".values .value"),- 3,- "it adds the value to the list of values"- );+ assert+ .dom(".values .value")+ .exists({ count: 3 }, "adds the value to the list of values");assert.strictEqual(this.values,diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.jsindex 9ff9ed32ae7..68d1e1a2597 100644--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.js@@ -2,7 +2,6 @@ import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | Widget | actions-summary", function (hooks) {setupRenderingTest(hooks);@@ -18,15 +17,7 @@ module("Integration | Component | Widget | actions-summary", function (hooks) {hbs`<MountWidget @widget="actions-summary" @args={{this.args}} />`);- assert.strictEqual(- count(".post-action .d-icon-trash-can"),- 1,- "it has the deleted icon"- );- assert.strictEqual(- count(".avatar[title=eviltrout]"),- 1,- "it has the deleted by avatar"- );+ assert.dom(".post-action .d-icon-trash-can").exists("has the deleted icon");+ assert.dom(".avatar[title=eviltrout]").exists("has the deleted by avatar");});});diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.jsindex 9de7ca440f1..f674bfcf6d5 100644--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.js@@ -2,7 +2,6 @@ import { click, render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";module("Integration | Component | Widget | post-links", function (hooks) {setupRenderingTest(hooks);@@ -26,11 +25,9 @@ module("Integration | Component | Widget | post-links", function (hooks) {await render(hbs`<MountWidget @widget="post-links" @args={{this.args}} />`);- assert.strictEqual(- count(".post-links a.track-link"),- 1,- "it hides the dupe link"- );+ assert+ .dom(".post-links a.track-link")+ .exists({ count: 1 }, "hides the dupe link");});test("collapsed links", async function (assert) {@@ -77,9 +74,9 @@ module("Integration | Component | Widget | post-links", function (hooks) {await render(hbs`<MountWidget @widget="post-links" @args={{this.args}} />`);- assert.strictEqual(count(".expand-links"), 1, "collapsed by default");+ assert.dom(".expand-links").exists({ count: 1 }, "collapsed by default");await click("a.expand-links");- assert.strictEqual(count(".post-links a.track-link"), 7);+ assert.dom(".post-links a.track-link").exists({ count: 7 });});});diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-menu-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-menu-test.jsindex f57a6e665a9..10fe5733cf7 100644--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-menu-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-menu-test.js@@ -4,7 +4,6 @@ import { module, test } from "qunit";import { h } from "virtual-dom";import { withPluginApi } from "discourse/lib/plugin-api";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";import { resetPostMenuExtraButtons } from "discourse/widgets/post-menu";import { createWidget } from "discourse/widgets/widget";@@ -31,11 +30,9 @@ module("Integration | Component | Widget | post-menu", function (hooks) {await render(hbs`<MountWidget @widget="post-menu" @args={{this.args}} />`);- assert.strictEqual(- count(".actions .extra-buttons .hot-coffee"),- 1,- "It renders extra button"- );+ assert+ .dom(".actions .extra-buttons .hot-coffee")+ .exists("renders extra button");});test("add extra button with feedback", async function (assert) {@@ -67,17 +64,11 @@ module("Integration | Component | Widget | post-menu", function (hooks) {await click(".hot-coffee");assert.strictEqual(testPost.id, 123, "callback was called with post");- assert.strictEqual(- count(".post-action-feedback-button"),- 1,- "It renders feedback"- );-- assert.strictEqual(- count(".actions .extra-buttons .hot-coffee"),- 1,- "It renders extra button"- );+ assert.dom(".post-action-feedback-button").exists("renders feedback");++ assert+ .dom(".actions .extra-buttons .hot-coffee")+ .exists("renders extra button");});test("removes button based on callback", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.jsindex 9bcd6fa3828..a054ba5e59c 100644--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.js@@ -4,7 +4,6 @@ import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { withPluginApi } from "discourse/lib/plugin-api";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";import { resetPostMenuExtraButtons } from "discourse/widgets/post-menu";function postStreamTest(name, attrs) {@@ -61,19 +60,17 @@ module("Integration | Component | Widget | post-stream", function (hooks) {},test(assert) {- assert.strictEqual(count(".post-stream"), 1);- assert.strictEqual(count(".topic-post"), 1, "renders all posts");+ assert.dom(".post-stream").exists({ count: 1 });+ assert.dom(".topic-post").exists({ count: 1 }, "renders all posts");assert.notStrictEqual(lastTransformedPost, null, "it transforms posts");assert.strictEqual(lastTransformedPost.topic.id,1234,"it also transforms the topic");- assert.strictEqual(- count(".actions .extra-buttons .hot-coffee"),- 1,- "should have the extended button"- );+ assert+ .dom(".actions .extra-buttons .hot-coffee")+ .exists({ count: 1 }, "has the extended button");},});@@ -129,58 +126,42 @@ module("Integration | Component | Widget | post-stream", function (hooks) {},test(assert) {- assert.strictEqual(count(".post-stream"), 1);- assert.strictEqual(count(".topic-post"), 6, "renders all posts");+ assert.dom(".post-stream").exists({ count: 1 });+ assert.dom(".topic-post").exists({ count: 6 }, "renders all posts");// look for special class bindings- assert.strictEqual(- count(".topic-post:nth-of-type(1).topic-owner"),- 1,- "it applies the topic owner class"- );- assert.strictEqual(- count(".topic-post:nth-of-type(1).group-trout"),- 1,- "it applies the primary group class"- );- assert.strictEqual(- count(".topic-post:nth-of-type(1).regular"),- 1,- "it applies the regular class"- );- assert.strictEqual(- count(".topic-post:nth-of-type(2).moderator"),- 1,- "it applies the moderator class"- );- assert.strictEqual(- count(".topic-post:nth-of-type(3).post-hidden"),- 1,- "it applies the hidden class"- );- assert.strictEqual(- count(".topic-post:nth-of-type(4).whisper"),- 1,- "it applies the whisper class"- );- assert.strictEqual(- count(".topic-post:nth-of-type(5).wiki"),- 1,- "it applies the wiki class"- );+ assert+ .dom(".topic-post:nth-of-type(1).topic-owner")+ .exists({ count: 1 }, "applies the topic owner class");+ assert+ .dom(".topic-post:nth-of-type(1).group-trout")+ .exists({ count: 1 }, "applies the primary group class");+ assert+ .dom(".topic-post:nth-of-type(1).regular")+ .exists({ count: 1 }, "applies the regular class");+ assert+ .dom(".topic-post:nth-of-type(2).moderator")+ .exists({ count: 1 }, "applies the moderator class");+ assert+ .dom(".topic-post:nth-of-type(3).post-hidden")+ .exists({ count: 1 }, "applies the hidden class");+ assert+ .dom(".topic-post:nth-of-type(4).whisper")+ .exists({ count: 1 }, "applies the whisper class");+ assert+ .dom(".topic-post:nth-of-type(5).wiki")+ .exists({ count: 1 }, "applies the wiki class");// it renders an article for the body with appropriate attributes- assert.strictEqual(count("article#post_2"), 1);- assert.strictEqual(count('article[data-user-id="123"]'), 1);- assert.strictEqual(count('article[data-post-id="3"]'), 1);- assert.strictEqual(count("article#post_5.via-email"), 1);- assert.strictEqual(count("article#post_6.is-auto-generated"), 1);-- assert.strictEqual(- count("article:nth-of-type(1) .main-avatar"),- 1,- "renders the main avatar"- );+ assert.dom("article#post_2").exists({ count: 1 });+ assert.dom('article[data-user-id="123"]').exists({ count: 1 });+ assert.dom('article[data-post-id="3"]').exists({ count: 1 });+ assert.dom("article#post_5.via-email").exists({ count: 1 });+ assert.dom("article#post_6.is-auto-generated").exists({ count: 1 });++ assert+ .dom("article:nth-of-type(1) .main-avatar")+ .exists({ count: 1 }, "renders the main avatar");},});@@ -201,16 +182,12 @@ module("Integration | Component | Widget | post-stream", function (hooks) {},test(assert) {- assert.strictEqual(- count(".topic-post.deleted"),- 1,- "it applies the deleted class"- );- assert.strictEqual(- count(".deleted-user-avatar"),- 1,- "it has the trash avatar"- );+ assert+ .dom(".topic-post.deleted")+ .exists({ count: 1 }, "applies the deleted class");+ assert+ .dom(".deleted-user-avatar")+ .exists({ count: 1 }, "has the trash avatar");},});});diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.jsindex 7dcaafc4c35..799b1f086fe 100644--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.js@@ -4,7 +4,7 @@ import { click, render, triggerEvent } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";module("Integration | Component | Widget | post", function (hooks) {@@ -169,8 +169,8 @@ module("Integration | Component | Widget | post", function (hooks) {await render(hbs`<MountWidget @widget="post" @args={{this.args}} />`);- assert.strictEqual(count(".topic-post.whisper"), 1);- assert.strictEqual(count(".post-info.whisper"), 1);+ assert.dom(".topic-post.whisper").exists();+ assert.dom(".post-info.whisper").exists();});test("like count button", async function (assert) {@@ -190,13 +190,13 @@ module("Integration | Component | Widget | post", function (hooks) {hbs`<MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />`);- assert.strictEqual(count("button.like-count"), 1);+ assert.dom("button.like-count").exists();assert.dom(".who-liked").doesNotExist();// toggle it onawait click("button.like-count");- assert.strictEqual(count(".who-liked"), 1);- assert.strictEqual(count(".who-liked a.trigger-user-card"), 1);+ assert.dom(".who-liked").exists();+ assert.dom(".who-liked a.trigger-user-card").exists();// toggle it offawait click("button.like-count");@@ -251,7 +251,7 @@ module("Integration | Component | Widget | post", function (hooks) {await click(".actions button.like");assert.dom(".actions button.like").doesNotExist();assert.dom(".actions button.has-like").exists();- assert.strictEqual(count(".actions button.like-count"), 1);+ assert.dom(".actions button.like-count").exists();await click(".actions button.has-like");assert.dom(".actions button.like").exists();@@ -347,8 +347,8 @@ module("Integration | Component | Widget | post", function (hooks) {await click(".show-more-actions");- assert.strictEqual(count("button.create-flag"), 1, `button is displayed`);- assert.strictEqual(count("button.delete"), 1, `button is displayed`);+ assert.dom("button.create-flag").exists("button is displayed");+ assert.dom("button.delete").exists("button is displayed");assert.dom("button.delete").hasAttribute(@@ -442,7 +442,7 @@ module("Integration | Component | Widget | post", function (hooks) {<MountWidget @widget="post" @args={{this.args}} @showFlags={{this.showFlags}} />`);- assert.strictEqual(count("button.create-flag"), 1);+ assert.dom("button.create-flag").exists();await click("button.create-flag");assert.ok(this.flagsShown, "it triggered the action");@@ -503,7 +503,7 @@ module("Integration | Component | Widget | post", function (hooks) {await render(hbs`<MountWidget @widget="post" @args={{this.args}} />`);assert.dom("a.reply-to-tab").exists("shows the tab");- assert.strictEqual(count(".avoid-tab"), 1, "has the avoid tab class");+ assert.dom(".avoid-tab").exists("has the avoid tab class");});test("reply directly above", async function (assert) {@@ -516,10 +516,10 @@ module("Integration | Component | Widget | post", function (hooks) {await render(hbs`<MountWidget @widget="post" @args={{this.args}} />`);- assert.strictEqual(count(".avoid-tab"), 1, "has the avoid tab class");+ assert.dom(".avoid-tab").exists("has the avoid tab class");await click("a.reply-to-tab");- assert.strictEqual(count("section.embedded-posts.top .cooked"), 1);- assert.strictEqual(count("section.embedded-posts .d-icon-arrow-up"), 1);+ assert.dom("section.embedded-posts.top .cooked").exists();+ assert.dom("section.embedded-posts .d-icon-arrow-up").exists();});test("cooked content hidden", async function (assert) {@@ -579,7 +579,7 @@ module("Integration | Component | Widget | post", function (hooks) {<MountWidget @widget="post" @args={{this.args}} @toggleBookmark={{this.toggleBookmark}} />`);- assert.strictEqual(count(".post-menu-area .bookmark"), 1);+ assert.dom(".post-menu-area .bookmark").exists();assert.dom("button.bookmarked").doesNotExist();});@@ -767,7 +767,7 @@ module("Integration | Component | Widget | post", function (hooks) {await render(hbs`<MountWidget @widget="post" @args={{this.args}} />`);- assert.strictEqual(count("button.show-replies"), 1);+ assert.dom("button.show-replies").exists();});test("replies - one below, suppressed", async function (assert) {@@ -786,8 +786,8 @@ module("Integration | Component | Widget | post", function (hooks) {await render(hbs`<MountWidget @widget="post" @args={{this.args}} />`);await click("button.show-replies");- assert.strictEqual(count("section.embedded-posts.bottom .cooked"), 1);- assert.strictEqual(count("section.embedded-posts .d-icon-arrow-down"), 1);+ assert.dom("section.embedded-posts.bottom .cooked").exists();+ assert.dom("section.embedded-posts .d-icon-arrow-down").exists();});test("shows the topic map when setting the 'topicMap' attribute", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.jsindex bedc4eeae51..2b27307423f 100644--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.js@@ -6,7 +6,7 @@ import { Promise } from "rsvp";import { h } from "virtual-dom";import { withPluginApi } from "discourse/lib/plugin-api";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";import widgetHbs from "discourse/widgets/hbs-compiler";import { createWidget } from "discourse/widgets/widget";import I18n from "discourse-i18n";@@ -266,7 +266,7 @@ module("Integration | Component | Widget | base", function (hooks) {await render(hbs`<MountWidget @widget="attach-test" />`);- assert.ok(count(".container"), "renders container");+ assert.dom(".container").exists("renders container");assert.dom(".container .value").hasText("hello world");});@@ -279,7 +279,7 @@ module("Integration | Component | Widget | base", function (hooks) {hbs`<MountWidget @widget="hbs-icon-test" @args={{this.args}} />`);- assert.strictEqual(count(".d-icon-arrow-down"), 1);+ assert.dom(".d-icon-arrow-down").exists();});test("handlebars i18n", async function (assert) {@@ -328,7 +328,7 @@ module("Integration | Component | Widget | base", function (hooks) {hbs`<MountWidget @widget="hbs-each-test" @args={{this.args}} />`);- assert.strictEqual(count("ul li"), 3);+ assert.dom("ul li").exists({ count: 3 });assert.dom("ul li:nth-of-type(1)").hasText("one");});diff --git a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.js b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.jsindex 1ae08e688c0..5f1ca2ef77d 100644--- a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.js+++ b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.js@@ -3,7 +3,7 @@ import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender from "discourse/tests/helpers/create-pretender";-import { count, createFile } from "discourse/tests/helpers/qunit-helpers";+import { createFile } from "discourse/tests/helpers/qunit-helpers";const fakeUpload = {type: ".png",@@ -48,8 +48,7 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {<ChatComposerUploads @existingUploads={{this.existingUploads}} @fileUploadElementId="chat-widget-uploader" />`);- assert.strictEqual(count(".chat-composer-upload"), 1);- assert.dom(".chat-composer-upload").exists();+ assert.dom(".chat-composer-upload").exists({ count: 1 });});test("upload starts and completes", async function (assert) {@@ -130,9 +129,9 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {);await waitFor(".chat-composer-upload");- assert.strictEqual(count(".chat-composer-upload"), 1);+ assert.dom(".chat-composer-upload").exists({ count: 1 });await click(".chat-composer-upload__remove-btn");- assert.strictEqual(count(".chat-composer-upload"), 0);+ assert.dom(".chat-composer-upload").doesNotExist();});});diff --git a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.js b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.jsindex 0478a117d15..d75f7a4f7b9 100644--- a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.js+++ b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.js@@ -33,9 +33,8 @@ module(});test("when channel is a public channel", async function (assert) {- const count = 10;this.channel = new ChatFabricators(getOwner(this)).channel();- this.siteSettings.chat_channel_retention_days = count;+ this.siteSettings.chat_channel_retention_days = 10;await render(hbs`<ChatRetentionReminderText @channel={{this.channel}} />`@@ -43,7 +42,7 @@ module(assert.dom(".chat-retention-reminder-text")- .includesText(I18n.t("chat.retention_reminders.long", { count }));+ .includesText(I18n.t("chat.retention_reminders.long", { count: 10 }));await render(hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`@@ -51,13 +50,12 @@ module(assert.dom(".chat-retention-reminder-text")- .includesText(I18n.t("chat.retention_reminders.short", { count }));+ .includesText(I18n.t("chat.retention_reminders.short", { count: 10 }));});test("when channel is a DM channel", async function (assert) {- const count = 10;this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();- this.siteSettings.chat_dm_retention_days = count;+ this.siteSettings.chat_dm_retention_days = 10;await render(hbs`<ChatRetentionReminderText @channel={{this.channel}} />`@@ -65,7 +63,7 @@ module(assert.dom(".chat-retention-reminder-text")- .includesText(I18n.t("chat.retention_reminders.long", { count }));+ .includesText(I18n.t("chat.retention_reminders.long", { count: 10 }));await render(hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`@@ -73,7 +71,7 @@ module(assert.dom(".chat-retention-reminder-text")- .includesText(I18n.t("chat.retention_reminders.short", { count }));+ .includesText(I18n.t("chat.retention_reminders.short", { count: 10 }));});});diff --git a/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js b/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.jsindex 67c10ab659e..5d7a325c383 100644--- a/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js+++ b/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js@@ -1,10 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import {- acceptance,- count,- query,-} from "discourse/tests/helpers/qunit-helpers";+import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";acceptance("Poll breakdown", function (needs) {needs.user();@@ -77,11 +73,12 @@ acceptance("Poll breakdown", function (needs) {assert.dom(".poll-breakdown-total-votes").exists("displays the vote count");- assert.strictEqual(- count(".poll-breakdown-chart-container"),- 2,- "renders a chart for each of the groups in group_results response"- );+ assert+ .dom(".poll-breakdown-chart-container")+ .exists(+ { count: 2 },+ "renders a chart for each of the groups in group_results response"+ );assert.ok(query(".poll-breakdown-chart-container > canvas").$chartjs,diff --git a/plugins/poll/test/javascripts/acceptance/poll-quote-test.js b/plugins/poll/test/javascripts/acceptance/poll-quote-test.jsindex 171d28158e4..82a131c373a 100644--- a/plugins/poll/test/javascripts/acceptance/poll-quote-test.js+++ b/plugins/poll/test/javascripts/acceptance/poll-quote-test.js@@ -1,6 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";-import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";+import { acceptance } from "discourse/tests/helpers/qunit-helpers";acceptance("Poll quote", function (needs) {needs.user();@@ -427,7 +427,7 @@ acceptance("Poll quote", function (needs) {test("renders and extends", async function (assert) {await visit("/t/-/topic_with_two_quoted_polls");await click(".quote-controls");- assert.strictEqual(count(".poll"), 2, "polls are rendered");- assert.strictEqual(count(".poll-buttons"), 2, "polls are extended");+ assert.dom(".poll").exists({ count: 2 }, "polls are rendered");+ assert.dom(".poll-buttons").exists({ count: 2 }, "polls are extended");});});diff --git a/plugins/poll/test/javascripts/acceptance/poll-results-test.js b/plugins/poll/test/javascripts/acceptance/poll-results-test.jsindex 29fcc596b70..5d880f6ad5a 100644--- a/plugins/poll/test/javascripts/acceptance/poll-results-test.js+++ b/plugins/poll/test/javascripts/acceptance/poll-results-test.js@@ -2,7 +2,6 @@ import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import {acceptance,- count,publishToMessageBus,query,} from "discourse/tests/helpers/qunit-helpers";@@ -1043,16 +1042,12 @@ acceptance("Poll results", function (needs) {test("can load more voters", async function (assert) {await visit("/t/load-more-poll-voters/134");- assert.strictEqual(- count(".poll-container .results li:nth-child(1) .poll-voters li"),- 1,- "Initially, one voter shown on first option"- );- assert.strictEqual(- count(".poll-container .results li:nth-child(2) .poll-voters li"),- 0,- "Initially, no voter shown on second option"- );+ assert+ .dom(".poll-container .results li:nth-child(1) .poll-voters li")+ .exists({ count: 1 }, "initially, one voter shown on first option");+ assert+ .dom(".poll-container .results li:nth-child(2) .poll-voters li")+ .doesNotExist("initially, no voter shown on second option");await publishToMessageBus("/polls/134", {post_id: "156",@@ -1093,30 +1088,30 @@ acceptance("Poll results", function (needs) {],});- assert.strictEqual(- count(".poll-container .results li:nth-child(1) .poll-voters li"),- 1,- "after incoming message, one voter shown on first option"- );+ assert+ .dom(".poll-container .results li:nth-child(1) .poll-voters li")+ .exists(+ { count: 1 },+ "after incoming message, one voter shown on first option"+ );- assert.strictEqual(- count(".poll-container .results li:nth-child(2) .poll-voters li"),- 0,- "after incoming message, no voter shown on second option"- );+ assert+ .dom(".poll-container .results li:nth-child(2) .poll-voters li")+ .doesNotExist("after incoming message, no voter shown on second option");await click(".poll-voters-toggle-expand");- assert.strictEqual(- count(".poll-container .results li:nth-child(1) .poll-voters li"),- 2,- "after clicking fetch voters button, two voters shown on first option"- );- assert.strictEqual(- count(".poll-container .results li:nth-child(2) .poll-voters li"),- 0,- "after clicking fetch voters button, no voters shown on second option"- );+ assert+ .dom(".poll-container .results li:nth-child(1) .poll-voters li")+ .exists(+ { count: 2 },+ "after clicking fetch voters button, two voters shown on first option"+ );+ assert+ .dom(".poll-container .results li:nth-child(2) .poll-voters li")+ .doesNotExist(+ "after clicking fetch voters button, no voters shown on second option"+ );});test("can load more voters - ranked choice", async function (assert) {@@ -1142,23 +1137,22 @@ acceptance("Poll results", function (needs) {"Votes tab is active");- assert.strictEqual(- count(+ assert+ .dom(".poll-container .discourse-poll-ranked_choice-results .poll-voters li"- ),- 1,- "Initially, one voter shown on first option"- );+ )+ .exists({ count: 1 }, "Initially, one voter shown on first option");await click(".poll-voters-toggle-expand");- assert.strictEqual(- count(+ assert+ .dom(".poll-container .discourse-poll-ranked_choice-results .results li:nth-child(1) .poll-voters li"- ),- 2,- "after clicking fetch voters button, two voters shown on first option"- );+ )+ .exists(+ { count: 2 },+ "after clicking fetch voters button, two voters shown on first option"+ );await publishToMessageBus("/polls/135", {post_id: "158",@@ -1224,13 +1218,14 @@ acceptance("Poll results", function (needs) {],});- assert.strictEqual(- count(+ assert+ .dom(".poll-container .discourse-poll-ranked_choice-results .results li:nth-child(1) .poll-voters li"- ),- 2,- "after incoming message containing 3 voters, only 2 voters shown on first option as bus updates are not supported once voters are expanded"- );+ )+ .exists(+ { count: 2 },+ "after incoming message containing 3 voters, only 2 voters shown on first option as bus updates are not supported once voters are expanded"+ );});test("can unvote", async function (assert) {@@ -1238,13 +1233,13 @@ acceptance("Poll results", function (needs) {await click(".toggle-results");- assert.strictEqual(count(".poll-container .d-icon-circle"), 1);- assert.strictEqual(count(".poll-container .d-icon-far-circle"), 1);+ assert.dom(".poll-container .d-icon-circle").exists({ count: 1 });+ assert.dom(".poll-container .d-icon-far-circle").exists({ count: 1 });await click(".remove-vote");- assert.strictEqual(count(".poll-container .d-icon-circle"), 0);- assert.strictEqual(count(".poll-container .d-icon-far-circle"), 2);+ assert.dom(".poll-container .d-icon-circle").doesNotExist();+ assert.dom(".poll-container .d-icon-far-circle").exists({ count: 2 });});});diff --git a/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.js b/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.jsindex f48bb87e175..e604f5f072e 100644--- a/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.js+++ b/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.js@@ -2,7 +2,7 @@ import { click, render } from "@ember/test-helpers";import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";module("Poll | Component | poll-buttons-dropdown", function (hooks) {@@ -38,7 +38,6 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {await click(".widget-dropdown-header");assert.dom("li.dropdown-menu__item").exists({ count: 2 });-assert.strictEqual(query("li.dropdown-menu__item span").textContent.trim(),I18n.t("poll.export-results.label"),@@ -73,8 +72,7 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {await click(".widget-dropdown-header");- assert.strictEqual(count("li.dropdown-menu__item"), 2);-+ assert.dom("li.dropdown-menu__item").exists({ count: 2 });assert.dom(query("li.dropdown-menu__item span")).hasText(@@ -106,10 +104,8 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {@dropDownClick={{this.dropDownClick}}/>`);- assert.strictEqual(count(".widget-dropdown-header"), 0);-- assert.strictEqual(count("button.widget-button"), 1);-+ assert.dom(".widget-dropdown-header").doesNotExist();+ assert.dom("button.widget-button").exists({ count: 1 });assert.strictEqual(query("button.widget-button span.d-button-label").textContent.trim(),I18n.t("poll.breakdown.breakdown"),@@ -140,8 +136,7 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {@dropDownClick={{this.dropDownClick}}/>`);- assert.strictEqual(count(".widget-dropdown-header"), 0);-- assert.strictEqual(count("button.widget-button"), 0);+ assert.dom(".widget-dropdown-header").doesNotExist();+ assert.dom("button.widget-button").doesNotExist();});});diff --git a/plugins/poll/test/javascripts/component/poll-options-test.js b/plugins/poll/test/javascripts/component/poll-options-test.jsindex 71dbd39e1d1..dfec4af114e 100644--- a/plugins/poll/test/javascripts/component/poll-options-test.js+++ b/plugins/poll/test/javascripts/component/poll-options-test.js@@ -2,7 +2,6 @@ import { click, render } from "@ember/test-helpers";import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";const OPTIONS = [@@ -47,7 +46,7 @@ module("Poll | Component | poll-options", function (hooks) {@sendRadioClick={{this.toggleOption}}/>`);- assert.strictEqual(count("li .d-icon-far-circle:nth-of-type(1)"), 3);+ assert.dom("li .d-icon-far-circle:nth-of-type(1)").exists({ count: 3 });});test("single, selected", async function (assert) {@@ -68,7 +67,7 @@ module("Poll | Component | poll-options", function (hooks) {@sendRadioClick={{this.toggleOption}}/>`);- assert.strictEqual(count("li .d-icon-circle:nth-of-type(1)"), 1);+ assert.dom("li .d-icon-circle:nth-of-type(1)").exists({ count: 1 });});test("multi, not selected", async function (assert) {@@ -89,7 +88,7 @@ module("Poll | Component | poll-options", function (hooks) {@sendRadioClick={{this.toggleOption}}/>`);- assert.strictEqual(count("li .d-icon-far-square:nth-of-type(1)"), 3);+ assert.dom("li .d-icon-far-square:nth-of-type(1)").exists({ count: 3 });});test("multi, selected", async function (assert) {@@ -110,7 +109,9 @@ module("Poll | Component | poll-options", function (hooks) {@sendRadioClick={{this.toggleOption}}/>`);- assert.strictEqual(count("li .d-icon-far-square-check:nth-of-type(1)"), 1);+ assert+ .dom("li .d-icon-far-square-check:nth-of-type(1)")+ .exists({ count: 1 });});test("single with images", async function (assert) {@@ -127,7 +128,7 @@ module("Poll | Component | poll-options", function (hooks) {@sendRadioClick={{this.toggleOption}}/>`);- assert.strictEqual(count("li img"), 2);+ assert.dom("li img").exists({ count: 2 });});test("ranked choice - priorities", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-results-pie-test.js b/plugins/poll/test/javascripts/component/poll-results-pie-test.jsindex 0f2d91cf5b1..5b943d4ba06 100644--- a/plugins/poll/test/javascripts/component/poll-results-pie-test.js+++ b/plugins/poll/test/javascripts/component/poll-results-pie-test.js@@ -2,7 +2,6 @@ import { render } from "@ember/test-helpers";import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";const OPTIONS = [{ id: "1ddc47be0d2315b9711ee8526ca9d83f", html: "This", votes: 3, rank: 0 },@@ -25,8 +24,7 @@ module("Poll | Component | poll-results-pie", function (hooks) {hbs`<PollResultsPie @id={{this.id}} @options={{this.options}} />`);- assert.strictEqual(count("li.legend"), 3);-- assert.strictEqual(count("canvas.poll-results-canvas"), 1);+ assert.dom("li.legend").exists({ count: 3 });+ assert.dom("canvas.poll-results-canvas").exists({ count: 1 });});});diff --git a/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.js b/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.jsindex 1f90bcff703..ea218679269 100644--- a/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.js+++ b/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.js@@ -2,7 +2,7 @@ import { render } from "@ember/test-helpers";import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count, query } from "discourse/tests/helpers/qunit-helpers";+import { query } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";const RANKED_CHOICE_OUTCOME = {@@ -43,11 +43,9 @@ module("Poll | Component | poll-results-ranked-choice", function (hooks) {hbs`<PollResultsRankedChoice @rankedChoiceOutcome={{this.rankedChoiceOutcome}} />`);- assert.strictEqual(- count("table.poll-results-ranked-choice tr"),- 3,- "there are two rounds of ranked choice"- );+ assert+ .dom("table.poll-results-ranked-choice tr")+ .exists({ count: 3 }, "there are two rounds of ranked choice");assert.strictEqual(query("span.poll-results-ranked-choice-info").textContent.trim(),@@ -66,10 +64,11 @@ module("Poll | Component | poll-results-ranked-choice", function (hooks) {hbs`<PollResultsRankedChoice @rankedChoiceOutcome={{this.rankedChoiceOutcome}} />`);- assert.strictEqual(- count("table.poll-results-ranked-choice tr"),- 1,- "there are no rounds of ranked choice displayed, only the header"- );+ assert+ .dom("table.poll-results-ranked-choice tr")+ .exists(+ { count: 1 },+ "there are no rounds of ranked choice displayed, only the header"+ );});});diff --git a/plugins/poll/test/javascripts/component/poll-results-tabs-test.js b/plugins/poll/test/javascripts/component/poll-results-tabs-test.jsindex dfeddb77823..6cf080c4506 100644--- a/plugins/poll/test/javascripts/component/poll-results-tabs-test.js+++ b/plugins/poll/test/javascripts/component/poll-results-tabs-test.js@@ -2,7 +2,6 @@ import { render } from "@ember/test-helpers";import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";-import { count } from "discourse/tests/helpers/qunit-helpers";const TWO_OPTIONS = [{@@ -86,7 +85,7 @@ module("Poll | Component | poll-results-tabs", function (hooks) {@fetchVoters={{this.fetchVoters}}/>`);- assert.strictEqual(count("li.tab"), 1);+ assert.dom("li.tab").exists({ count: 1 });});test("Renders two tabs for public ranked choice poll", async function (assert) {@@ -118,7 +117,7 @@ module("Poll | Component | poll-results-tabs", function (hooks) {@fetchVoters={{this.fetchVoters}}/>`);- assert.strictEqual(count("li.tab"), 2);+ assert.dom("li.tab").exists({ count: 2 });});test("Renders one tab for private ranked choice poll", async function (assert) {@@ -150,6 +149,6 @@ module("Poll | Component | poll-results-tabs", function (hooks) {@fetchVoters={{this.fetchVoters}}/>`);- assert.strictEqual(count("li.tab"), 1);+ assert.dom("li.tab").exists({ count: 1 });});});