diff --git a/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js b/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js
index dc2d179d5de..05ff6fe3649 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js
@@ -1,11 +1,7 @@
import { click, currentRouteName, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import PreloadStore from "discourse/lib/preload-store";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Account Created", function () {
test("account created - message", async function (assert) {
@@ -14,13 +10,11 @@ acceptance("Account Created", function () {
});
await visit("/u/account-created");
- assert.ok(exists(".account-created"));
- assert.strictEqual(
- query(".account-created .success-info").innerText.trim(),
- "Hello World",
- "it displays the message"
- );
- assert.notOk(exists(".activation-controls"));
+ assert.dom(".account-created").exists();
+ assert
+ .dom(".account-created .success-info")
+ .hasText("Hello World", "it displays the message");
+ assert.dom(".activation-controls").doesNotExist();
});
test("account created - resend email", async function (assert) {
@@ -33,18 +27,15 @@ acceptance("Account Created", function () {
await visit("/u/account-created");
- assert.ok(exists(".account-created"));
- assert.strictEqual(
- query(".account-created .success-info").innerText.trim(),
- "Hello World",
- "it displays the message"
- );
+ assert.dom(".account-created").exists();
+ assert
+ .dom(".account-created .success-info")
+ .hasText("Hello World", "it displays the message");
await click(".activation-controls .resend");
assert.strictEqual(currentRouteName(), "account-created.resent");
- const email = query(".account-created b").innerText;
- assert.strictEqual(email, "eviltrout@example.com");
+ assert.dom(".account-created b").hasText("eviltrout@example.com");
});
test("account created - update email - cancel", async function (assert) {
@@ -60,7 +51,7 @@ acceptance("Account Created", function () {
await click(".activation-controls .edit-email");
assert.strictEqual(currentRouteName(), "account-created.edit-email");
- assert.ok(exists(".activation-controls .btn-primary:disabled"));
+ assert.dom(".activation-controls .btn-primary").isDisabled();
await click(".activation-controls .edit-cancel");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js
index 36a35a734fc..bdbfd74328f 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js
@@ -31,11 +31,8 @@ acceptance("Admin - Emails", function (needs) {
await fillIn("textarea.email-body", EMAIL.trim());
await click(".email-advanced-test button");
- assert.strictEqual(query(".text pre").innerText, "Hello, this is a test!");
- assert.strictEqual(
- query(".elided pre").innerText,
- "---\n\nThis part should be elided."
- );
+ assert.dom(".text pre").hasText("Hello, this is a test!");
+ assert.dom(".elided pre").hasText("---\n\nThis part should be elided.");
});
test("displays received errors when testing emails", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
index df042c5e605..87c3bde3dce 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
@@ -18,7 +18,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
await fillIn(urlInput, themeUrl);
await click(".install-theme-content .inputs .advanced-repo");
await fillIn(branchInput, "tests-passed");
- assert.strictEqual(query(urlInput).value, themeUrl, "url input is filled");
+ assert.dom(urlInput).hasValue(themeUrl, "url input is filled");
assert.strictEqual(
query(branchInput).value,
"tests-passed",
@@ -31,8 +31,8 @@ acceptance("Admin - Themes - Install modal", function (needs) {
await click(".create-actions .btn-primary");
await click("#remote");
await click(".install-theme-content .inputs .advanced-repo");
- assert.strictEqual(query(urlInput).value, "", "url input is reset");
- assert.strictEqual(query(branchInput).value, "", "branch input is reset");
+ assert.dom(urlInput).hasValue("", "url input is reset");
+ assert.dom(branchInput).hasValue("", "branch input is reset");
assert.notOk(query(publicKey), "hide public key");
});
@@ -49,7 +49,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
await click("#remote");
await fillIn(urlInput, themeUrl);
await click(".install-theme-content .inputs .advanced-repo");
- assert.strictEqual(query(urlInput).value, themeUrl, "url input is filled");
+ assert.dom(urlInput).hasValue(themeUrl, "url input is filled");
assert.ok(query(publicKey), "shows public key");
// Supports AWS CodeCommit style repo URLs
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-penalize-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-penalize-user-test.js
index e5f3de5c307..33551319324 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-penalize-user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-penalize-user-test.js
@@ -2,8 +2,6 @@ import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import {
acceptance,
- count,
- exists,
fakeTime,
loggedInUser,
query,
@@ -36,39 +34,39 @@ acceptance("Admin - Suspend User", function (needs) {
await visit("/admin/users/1234/regular");
await click(".suspend-user");
- assert.strictEqual(count(".suspend-user-modal:visible"), 1);
+ assert.dom(".suspend-user-modal").exists();
await click(".d-modal-cancel");
- assert.ok(!exists(".suspend-user-modal:visible"));
+ assert.dom(".suspend-user-modal").doesNotExist();
});
test("suspend a user - cancel with input", async function (assert) {
await visit("/admin/users/1234/regular");
await click(".suspend-user");
- assert.strictEqual(count(".suspend-user-modal:visible"), 1);
+ assert.dom(".suspend-user-modal").exists();
await fillIn("input.suspend-reason", "for breaking the rules");
await fillIn(".suspend-message", "this is an email reason why");
await click(".d-modal-cancel");
- assert.strictEqual(count(".dialog-body:visible"), 1);
+ assert.dom(".dialog-body").exists();
await click(".dialog-footer .btn-default");
- assert.strictEqual(count(".suspend-user-modal:visible"), 1);
+ assert.dom(".suspend-user-modal").exists();
assert.strictEqual(
query(".suspend-message").value,
"this is an email reason why"
);
await click(".d-modal-cancel");
- assert.strictEqual(count(".dialog-body:visible"), 1);
+ assert.dom(".dialog-body").exists();
await click(".dialog-footer .btn-primary");
- assert.ok(!exists(".suspend-user-modal:visible"));
- assert.ok(!exists(".dialog-body:visible"));
+ assert.dom(".suspend-user-modal").doesNotExist();
+ assert.dom(".dialog-body").doesNotExist();
});
test("suspend, then unsuspend a user", async function (assert) {
@@ -78,15 +76,11 @@ acceptance("Admin - Suspend User", function (needs) {
await visit("/admin/users/1234/regular");
- assert.ok(!exists(".suspension-info"));
+ assert.dom(".suspension-info").doesNotExist();
await click(".suspend-user");
- assert.strictEqual(
- count(".perform-penalize[disabled]"),
- 1,
- "disabled by default"
- );
+ assert.dom(".perform-penalize").isDisabled("disabled by default");
await suspendUntilCombobox.expand();
await suspendUntilCombobox.selectRowByValue("tomorrow");
@@ -94,16 +88,16 @@ acceptance("Admin - Suspend User", function (needs) {
await fillIn("input.suspend-reason", "for breaking the rules");
await fillIn(".suspend-message", "this is an email reason why");
- assert.ok(!exists(".perform-penalize[disabled]"), "no longer disabled");
+ assert.dom(".perform-penalize").isEnabled("no longer disabled");
await click(".perform-penalize");
- assert.ok(!exists(".suspend-user-modal:visible"));
- assert.ok(exists(".suspension-info"));
+ assert.dom(".suspend-user-modal").doesNotExist();
+ assert.dom(".suspension-info").exists();
await click(".unsuspend-user");
- assert.ok(!exists(".suspension-info"));
+ assert.dom(".suspension-info").doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-permalink-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-permalink-test.js
index 66675c20693..e5083df9725 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-permalink-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-permalink-test.js
@@ -1,6 +1,6 @@
import { fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Permalinks", function (needs) {
const startingData = [
@@ -36,21 +36,19 @@ acceptance("Admin - Permalinks", function (needs) {
test("search permalinks with result", async function (assert) {
await visit("/admin/customize/permalinks");
await fillIn(".permalink-search input", "feature");
- assert.ok(
- exists(".permalink-results span[title='c/feature/announcements']"),
- "permalink is found after search"
- );
+ assert
+ .dom(".permalink-results span[title='c/feature/announcements']")
+ .exists("permalink is found after search");
});
test("search permalinks without results", async function (assert) {
await visit("/admin/customize/permalinks");
await fillIn(".permalink-search input", "garboogle");
- assert.ok(
- exists(".permalink-results__no-result"),
- "no results message shown"
- );
+ assert
+ .dom(".permalink-results__no-result")
+ .exists("no results message shown");
- assert.ok(exists(".permalink-search"), "search input still visible");
+ assert.dom(".permalink-search").exists("search input still visible");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-plugins-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-plugins-test.js
index 1e967aa6146..6561b387a07 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-plugins-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-plugins-test.js
@@ -64,11 +64,11 @@ acceptance("Admin - Plugins", function (needs) {
"table.admin-plugins-list tr .admin-plugins-list__enabled button";
assert
.dom(toggleSelector)
- .hasAttribute("aria-checked", "true", "displays the plugin as enabled");
+ .hasAria("checked", "true", "displays the plugin as enabled");
await click(toggleSelector);
assert
.dom(toggleSelector)
- .hasAttribute("aria-checked", "false", "displays the plugin as enabled");
+ .hasAria("checked", "false", "displays the plugin as enabled");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-search-logs-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-search-logs-test.js
index b8a14f5648e..b11e95802c3 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-search-logs-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-search-logs-test.js
@@ -1,6 +1,6 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Search Logs", function (needs) {
needs.user();
@@ -8,18 +8,14 @@ acceptance("Admin - Search Logs", function (needs) {
test("show search logs", async function (assert) {
await visit("/admin/logs/search_logs");
- assert.ok(exists("table.search-logs-list.grid"), "has the div class");
+ assert.dom("table.search-logs-list.grid").exists("has the div class");
- assert.ok(
- exists(".search-logs-list .admin-list-item .col"),
- "has a list of search logs"
- );
+ assert
+ .dom(".search-logs-list .admin-list-item .col")
+ .exists("has a list of search logs");
await click(".term a");
- assert.ok(
- exists(".search-logs-filter"),
- "it should show the search log term page"
- );
+ assert.dom(".search-logs-filter").exists("shows the search log term page");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js
index e375cc45947..b4745ff3f97 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js
@@ -1,10 +1,6 @@
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Admin - Site Texts", function (needs) {
needs.user();
@@ -19,9 +15,9 @@ acceptance("Admin - Site Texts", function (needs) {
await fillIn(".site-text-search", "Test");
assert.strictEqual(currentURL(), "/admin/customize/site_texts?q=Test");
- assert.ok(exists(".site-text"));
- assert.ok(exists(".site-text:not(.overridden)"));
- assert.ok(exists(".site-text.overridden"));
+ assert.dom(".site-text").exists();
+ assert.dom(".site-text:not(.overridden)").exists();
+ assert.dom(".site-text.overridden").exists();
// Only show overridden
await click(".search-area .filter-options #toggle-overridden");
@@ -30,8 +26,8 @@ acceptance("Admin - Site Texts", function (needs) {
"/admin/customize/site_texts?overridden=true&q=Test"
);
- assert.ok(!exists(".site-text:not(.overridden)"));
- assert.ok(exists(".site-text.overridden"));
+ assert.dom(".site-text:not(.overridden)").doesNotExist();
+ assert.dom(".site-text.overridden").exists();
await click(".search-area .filter-options #toggle-overridden");
// Only show outdated
@@ -45,25 +41,25 @@ acceptance("Admin - Site Texts", function (needs) {
test("edit and revert a site text by key", async function (assert) {
await visit("/admin/customize/site_texts/site.test?locale=en");
- assert.strictEqual(query(".title h3").innerText, "site.test");
- assert.ok(!exists(".saved"));
- assert.ok(!exists(".revert-site-text"));
+ assert.dom(".title h3").hasText("site.test");
+ assert.dom(".saved").doesNotExist();
+ assert.dom(".revert-site-text").doesNotExist();
// Change the value
await fillIn(".site-text-value", "New Test Value");
await click(".save-changes");
- assert.ok(exists(".saved"));
- assert.ok(exists(".revert-site-text"));
+ assert.dom(".saved").exists();
+ assert.dom(".revert-site-text").exists();
// Revert the changes
await click(".revert-site-text");
- assert.ok(exists("#dialog-holder .dialog-content"));
+ assert.dom("#dialog-holder .dialog-content").exists();
await click("#dialog-holder .btn-primary");
- assert.ok(!exists(".saved"));
- assert.ok(!exists(".revert-site-text"));
+ assert.dom(".saved").doesNotExist();
+ assert.dom(".revert-site-text").doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js
index dcb41a0a74b..00930f82ca5 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js
@@ -43,11 +43,12 @@ acceptance("Admin - User Emails", function (needs) {
test("viewing self with multiple secondary emails", async function (assert) {
await visit("/admin/users/3/markvanlan");
- assert.strictEqual(
- query(".display-row.email .value a").innerText,
- "markvanlan@example.com",
- "it should display the user's primary email"
- );
+ assert
+ .dom(".display-row.email .value a")
+ .hasText(
+ "markvanlan@example.com",
+ "it should display the user's primary email"
+ );
assertMultipleSecondary(
assert,
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js
index 948fc212b54..8f8752b63dd 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js
@@ -153,34 +153,25 @@ acceptance("Admin - User Index", function (needs) {
test("can edit username", async function (assert) {
await visit("/admin/users/2/sam");
- assert.strictEqual(
- query(".display-row.username .value").innerText.trim(),
- "sam"
- );
+ assert.dom(".display-row.username .value").hasText("sam");
// Trying cancel.
await click(".display-row.username button");
await fillIn(".display-row.username .value input", "new-sam");
await click(".display-row.username a");
- assert.strictEqual(
- query(".display-row.username .value").innerText.trim(),
- "sam"
- );
+ assert.dom(".display-row.username .value").hasText("sam");
// Doing edit.
await click(".display-row.username button");
await fillIn(".display-row.username .value input", "new-sam");
await click(".display-row.username button");
- assert.strictEqual(
- query(".display-row.username .value").innerText.trim(),
- "new-sam"
- );
+ assert.dom(".display-row.username .value").hasText("new-sam");
});
test("shows the number of post edits", async function (assert) {
await visit("/admin/users/1/eviltrout");
- assert.strictEqual(query(".post-edits-count .value").innerText.trim(), "6");
+ assert.dom(".post-edits-count .value").hasText("6");
assert.ok(
exists(".post-edits-count .controls .btn.btn-icon"),
@@ -214,11 +205,9 @@ acceptance("Admin - User Index", function (needs) {
test("will clear unsaved groups when switching user", async function (assert) {
await visit("/admin/users/2/sam");
- assert.strictEqual(
- query(".display-row.username .value").innerText.trim(),
- "sam",
- "the name should be correct"
- );
+ assert
+ .dom(".display-row.username .value")
+ .hasText("sam", "the name should be correct");
const groupChooser = selectKit(".group-chooser");
await groupChooser.expand();
@@ -231,11 +220,9 @@ acceptance("Admin - User Index", function (needs) {
await visit("/admin/users/1/eviltrout");
- assert.strictEqual(
- query(".display-row.username .value").innerText.trim(),
- "eviltrout",
- "the name should be correct"
- );
+ assert
+ .dom(".display-row.username .value")
+ .hasText("eviltrout", "the name should be correct");
assert.ok(
!exists('.group-chooser span[title="Macdonald"]'),
@@ -246,7 +233,7 @@ acceptance("Admin - User Index", function (needs) {
test("grant admin - shows the confirmation dialog", async function (assert) {
await visit("/admin/users/3/user1");
await click(".grant-admin");
- assert.ok(exists(".dialog-content"));
+ assert.dom(".dialog-content").exists();
assert.strictEqual(
I18n.t("admin.user.grant_admin_confirm"),
query(".dialog-body").textContent.trim()
@@ -258,7 +245,7 @@ acceptance("Admin - User Index", function (needs) {
test("grant admin - optionally allows HTML to be shown in the confirmation dialog", async function (assert) {
await visit("/admin/users/6/user6");
await click(".grant-admin");
- assert.ok(exists(".dialog-content"));
+ assert.dom(".dialog-content").exists();
assert.ok(
exists(".dialog-content .dialog-body strong"),
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js
index a0c146e9da7..b068ccd111e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js
@@ -13,7 +13,7 @@ acceptance("Admin - Users List", function (needs) {
test("lists users", async function (assert) {
await visit("/admin/users/list/active");
- assert.ok(exists(".users-list .user"));
+ assert.dom(".users-list .user").exists();
assert.ok(!exists(".user:nth-of-type(1) .email small"), "escapes email");
});
@@ -31,7 +31,7 @@ acceptance("Admin - Users List", function (needs) {
test("sorts users", async function (assert) {
await visit("/admin/users/list/active");
- assert.ok(exists(".users-list .user"));
+ assert.dom(".users-list .user").exists();
await click(".users-list .sortable:nth-child(1)");
@@ -55,15 +55,13 @@ acceptance("Admin - Users List", function (needs) {
test("toggles email visibility", async function (assert) {
await visit("/admin/users/list/active");
- assert.ok(exists(".users-list .user"));
+ assert.dom(".users-list .user").exists();
await click(".show-emails");
- assert.strictEqual(
- query(".users-list .user:nth-child(1) .email").innerText,
- "eviltrout@example.com",
- "shows the emails"
- );
+ assert
+ .dom(".users-list .user:nth-child(1) .email")
+ .hasText("eviltrout@example.com", "shows the emails");
await click(".hide-emails");
@@ -83,7 +81,7 @@ acceptance("Admin - Users List", function (needs) {
await visit("/admin/users/list/active");
- assert.strictEqual(query(".admin-title h2").innerText, activeTitle);
+ assert.dom(".admin-title h2").hasText(activeTitle);
assert.ok(
query(".users-list .user:nth-child(1) .username").innerText.includes(
activeUser
@@ -92,7 +90,7 @@ acceptance("Admin - Users List", function (needs) {
await click('a[href="/admin/users/list/new"]');
- assert.strictEqual(query(".admin-title h2").innerText, suspectTitle);
+ assert.dom(".admin-title h2").hasText(suspectTitle);
assert.ok(
query(".users-list .user:nth-child(1) .username").innerText.includes(
suspectUser
@@ -101,7 +99,7 @@ acceptance("Admin - Users List", function (needs) {
await click(".users-list .sortable:nth-child(4)");
- assert.strictEqual(query(".admin-title h2").innerText, suspectTitle);
+ assert.dom(".admin-title h2").hasText(suspectTitle);
assert.ok(
query(".users-list .user:nth-child(1) .username").innerText.includes(
suspectUser
@@ -110,7 +108,7 @@ acceptance("Admin - Users List", function (needs) {
await click('a[href="/admin/users/list/active"]');
- assert.strictEqual(query(".admin-title h2").innerText, activeTitle);
+ assert.dom(".admin-title h2").hasText(activeTitle);
assert.ok(
query(".users-list .user:nth-child(1) .username").innerText.includes(
activeUser
diff --git a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
index d8dc46d52b6..ef90ee5e311 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
@@ -1,6 +1,6 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Bootstrap Mode Notice", function (needs) {
needs.user({ admin: true });
@@ -13,12 +13,12 @@ acceptance("Bootstrap Mode Notice", function (needs) {
test("is displayed if bootstrap mode is enabled", async function (assert) {
this.siteSettings.bootstrap_mode_enabled = true;
await visit("/");
- assert.ok(exists(".bootstrap-mode"));
+ assert.dom(".bootstrap-mode").exists();
});
test("is hidden if bootstrap mode is disabled", async function (assert) {
this.siteSettings.bootstrap_mode_enabled = false;
await visit("/");
- assert.ok(!exists(".bootstrap-mode"));
+ assert.dom(".bootstrap-mode").doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js
index b54af84bb2d..ff544f3146b 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
@@ -41,11 +41,12 @@ acceptance("Category Edit - Security", function (needs) {
availableGroups.rowByValue("everyone").exists(),
"everyone has been removed and appears in the available groups"
);
- assert.strictEqual(
- query(".row-empty").innerText,
- I18n.t("category.permissions.no_groups_selected"),
- "shows message when no groups are selected"
- );
+ assert
+ .dom(".row-empty")
+ .hasText(
+ I18n.t("category.permissions.no_groups_selected"),
+ "shows message when no groups are selected"
+ );
});
test("adding a permission", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js
index 14a5eda0a7b..1df33c22f06 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js
@@ -6,7 +6,6 @@ import pretender from "discourse/tests/helpers/create-pretender";
import {
acceptance,
count,
- exists,
query,
visible,
} from "discourse/tests/helpers/qunit-helpers";
@@ -27,19 +26,10 @@ acceptance("Category Edit", function (needs) {
"it jumps to the correct screen"
);
- assert.strictEqual(
- query(".category-breadcrumb .badge-category").innerText,
- "bug"
- );
- assert.strictEqual(
- query(".category-color-editor .badge-category").innerText,
- "bug"
- );
+ assert.dom(".category-breadcrumb .badge-category").hasText("bug");
+ assert.dom(".category-color-editor .badge-category").hasText("bug");
await fillIn("input.category-name", "testing");
- assert.strictEqual(
- query(".category-color-editor .badge-category").innerText,
- "testing"
- );
+ assert.dom(".category-color-editor .badge-category").hasText("testing");
await fillIn(".edit-text-color input", "ff0000");
@@ -77,9 +67,9 @@ acceptance("Category Edit", function (needs) {
test("Editing required tag groups", async function (assert) {
await visit("/c/bug/edit/tags");
- assert.ok(exists(".minimum-required-tags"));
+ assert.dom(".minimum-required-tags").exists();
- assert.ok(exists(".required-tag-groups"));
+ assert.dom(".required-tag-groups").exists();
assert.strictEqual(count(".required-tag-group-row"), 0);
await click(".add-required-tag-group");
@@ -191,7 +181,7 @@ acceptance("Category Edit", function (needs) {
"/c/1-category/edit/general",
"it goes to the general tab"
);
- assert.strictEqual(query("input.category-name").value, "bug");
+ assert.dom("input.category-name").hasValue("bug");
});
test("Error Saving", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js
index fa5a6b0defe..acab2f6ed35 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js
@@ -2,11 +2,7 @@ import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import sinon from "sinon";
import DiscourseURL from "discourse/lib/url";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import I18n from "discourse-i18n";
@@ -43,11 +39,11 @@ acceptance("Category New", function (needs) {
test("Creating a new category", async function (assert) {
await visit("/new-category");
- assert.ok(exists(".badge-category"));
- assert.notOk(exists(".category-breadcrumb"));
+ assert.dom(".badge-category").exists();
+ assert.dom(".category-breadcrumb").doesNotExist();
await fillIn("input.category-name", "testing");
- assert.strictEqual(query(".badge-category").innerText, "testing");
+ assert.dom(".badge-category").hasText("testing");
await click(".edit-category-nav .edit-category-topic-template a");
assert
@@ -80,8 +76,7 @@ acceptance("Category New", function (needs) {
"it shows saved required tag group"
);
- assert.strictEqual(
- query(".edit-category-title h2").innerText,
+ assert.dom(".edit-category-title h2").hasText(
I18n.t("category.edit_dialog_title", {
categoryName: "testing",
})
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js
index cdf6cb9f0b8..baeaa794dfa 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js
@@ -66,10 +66,9 @@ acceptance("Composer Actions", function (needs) {
await composerActions.expand();
await composerActions.selectRowByValue("reply_to_topic");
- assert.strictEqual(
- query(".action-title .topic-link").innerText.trim(),
- "Internationalization / localization"
- );
+ assert
+ .dom(".action-title .topic-link")
+ .hasText("Internationalization / localization");
assert.strictEqual(
query(".action-title .topic-link").getAttribute("href"),
"/t/internationalization-localization/280"
@@ -137,10 +136,7 @@ acceptance("Composer Actions", function (needs) {
await composerActions.selectRowByValue("reply_as_new_topic");
assert.strictEqual(categoryChooserReplyArea.header().name(), "faq");
- assert.strictEqual(
- query(".action-title").innerText.trim(),
- I18n.t("topic.create_long")
- );
+ assert.dom(".action-title").hasText(I18n.t("topic.create_long"));
assert.ok(query(".d-editor-input").value.includes(quote));
});
@@ -150,7 +146,7 @@ acceptance("Composer Actions", function (needs) {
const composerActions = selectKit(".composer-actions");
await composerActions.expand();
await composerActions.selectRowByValue("reply_as_new_topic");
- assert.ok(!exists(".dialog-body"));
+ assert.dom(".dialog-body").doesNotExist();
});
test("reply_as_new_topic without a permission to create topic", async function (assert) {
@@ -186,11 +182,8 @@ acceptance("Composer Actions", function (needs) {
await composerActions.expand();
await composerActions.selectRowByValue("reply_to_topic");
- assert.strictEqual(
- query(".action-title").innerText.trim(),
- "Short topic with two posts"
- );
- assert.strictEqual(query(".d-editor-input").value, quote);
+ assert.dom(".action-title").hasText("Short topic with two posts");
+ assert.dom(".d-editor-input").hasValue(quote);
await composerActions.expand();
@@ -209,12 +202,9 @@ acceptance("Composer Actions", function (needs) {
await composerActions.selectRowByValue("reply_to_post");
await composerActions.expand();
- assert.ok(exists(".action-title img.avatar"));
- assert.strictEqual(
- query(".action-title .user-link").innerText.trim(),
- "tms"
- );
- assert.strictEqual(query(".d-editor-input").value, quote);
+ assert.dom(".action-title img.avatar").exists();
+ assert.dom(".action-title .user-link").hasText("tms");
+ assert.dom(".d-editor-input").hasValue(quote);
assert.strictEqual(
composerActions.rowByIndex(0).value(),
"reply_as_new_topic"
@@ -230,10 +220,7 @@ acceptance("Composer Actions", function (needs) {
await composerActions.selectRowByValue("reply_as_new_topic");
await composerActions.expand();
- assert.strictEqual(
- query(".action-title").innerText.trim(),
- I18n.t("topic.create_long")
- );
+ assert.dom(".action-title").hasText(I18n.t("topic.create_long"));
assert.ok(query(".d-editor-input").value.includes(quote));
assert.strictEqual(composerActions.rowByIndex(0).value(), "reply_to_post");
assert.strictEqual(composerActions.rowByIndex(1).value(), "reply_to_topic");
@@ -249,10 +236,7 @@ acceptance("Composer Actions", function (needs) {
await click(".usercard-controls .compose-pm .btn-primary");
await composerActions.expand();
- assert.strictEqual(
- query(".action-title").innerText.trim(),
- I18n.t("topic.private_message")
- );
+ assert.dom(".action-title").hasText(I18n.t("topic.private_message"));
assert.strictEqual(composerActions.rowByIndex(0).value(), "create_topic");
assert.strictEqual(composerActions.rows().length, 1);
});
@@ -458,10 +442,9 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
"This is the new text for the title using 'quotes'"
);
- assert.strictEqual(
- query("#reply-control .btn-primary.create .d-button-label").innerText,
- I18n.t("composer.create_shared_draft")
- );
+ 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,
@@ -479,10 +462,9 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
await composerActions.expand();
await composerActions.selectRowByValue("reply_as_new_topic");
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- I18n.t("composer.composer_actions.reply_as_new_topic.confirm")
- );
+ assert
+ .dom(".dialog-body")
+ .hasText(I18n.t("composer.composer_actions.reply_as_new_topic.confirm"));
await click(".dialog-footer .btn-primary");
assert.ok(
@@ -504,10 +486,7 @@ acceptance("Prioritize Username", function (needs) {
await visit("/t/short-topic-with-two-posts/54079");
await click("article#post_2 button.reply");
- assert.strictEqual(
- query(".action-title .user-link").innerText.trim(),
- "james_john"
- );
+ assert.dom(".action-title .user-link").hasText("james_john");
});
test("Quotes use username", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js
index 73f1b85ddd7..3316003d349 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js
@@ -1,10 +1,6 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
acceptance("Composer - Draft saving", function (needs) {
@@ -34,11 +30,12 @@ acceptance("Composer - Draft saving", function (needs) {
);
await fillIn(".d-editor-input", "This won't be saved because of error");
- assert.strictEqual(
- query("div#draft-status span").innerText.trim(),
- I18n.t("composer.drafts_offline"),
- "the draft wasn't saved, a warning is rendered"
- );
+ assert
+ .dom("div#draft-status span")
+ .hasText(
+ I18n.t("composer.drafts_offline"),
+ "the draft wasn't saved, a warning is rendered"
+ );
assert.ok(
exists("div#draft-status svg.d-icon-triangle-exclamation"),
"an exclamation icon is rendered"
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js
index 4dafcaa90ea..587d5a6b786 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js
@@ -3,8 +3,6 @@ import { test } from "qunit";
import Category from "discourse/models/category";
import {
acceptance,
- exists,
- query,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
@@ -54,11 +52,12 @@ acceptance("Composer - Tags", function (needs) {
await click("#reply-control button.create");
assert.strictEqual(currentURL(), "/");
- assert.strictEqual(
- query(".popup-tip.bad").innerText.trim(),
- I18n.t("composer.error.tags_missing", { count: 1 }),
- "it should display the right alert"
- );
+ assert
+ .dom(".popup-tip.bad")
+ .hasText(
+ I18n.t("composer.error.tags_missing", { count: 1 }),
+ "it should display the right alert"
+ );
const tags = selectKit(".mini-tag-chooser");
await tags.expand();
@@ -87,11 +86,12 @@ acceptance("Composer - Tags", function (needs) {
await click("#reply-control button.create");
assert.strictEqual(currentURL(), "/");
- assert.strictEqual(
- query(".popup-tip.bad").innerText.trim(),
- I18n.t("composer.error.tags_missing", { count: 1 }),
- "it should display the right alert"
- );
+ assert
+ .dom(".popup-tip.bad")
+ .hasText(
+ I18n.t("composer.error.tags_missing", { count: 1 }),
+ "it should display the right alert"
+ );
const tags = selectKit(".mini-tag-chooser");
await tags.expand();
@@ -105,7 +105,7 @@ acceptance("Composer - Tags", function (needs) {
await visit("/u/charlie");
await click("button.compose-pm");
- assert.notOk(exists(".composer-fields .mini-tag-chooser"));
+ assert.dom(".composer-fields .mini-tag-chooser").doesNotExist();
});
});
@@ -122,6 +122,6 @@ acceptance("Composer - Tags (PMs)", function (needs) {
await visit("/u/charlie");
await click("button.compose-pm");
- assert.ok(exists(".composer-fields .mini-tag-chooser"));
+ assert.dom(".composer-fields .mini-tag-chooser").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
index 06a84824166..7e222f29be0 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
@@ -301,10 +301,9 @@ acceptance("Composer", function (needs) {
await fillIn(".d-editor-input", "custom message that is a good length");
await click("#reply-control button.create");
- assert.strictEqual(
- query("#dialog-holder .dialog-body").innerText,
- "This is a custom response"
- );
+ assert
+ .dom("#dialog-holder .dialog-body")
+ .hasText("This is a custom response");
assert.strictEqual(currentURL(), "/", "it doesn't change routes");
await click(".dialog-footer .btn-primary");
@@ -332,26 +331,23 @@ acceptance("Composer", function (needs) {
await fillIn(".d-editor-input", "this is the content of my reply");
await click("#reply-control button.create");
- assert.strictEqual(
- query(".topic-post:last-of-type .cooked p").innerText,
- "this is the content of my reply"
- );
+ assert
+ .dom(".topic-post:last-of-type .cooked p")
+ .hasText("this is the content of my reply");
});
test("Replying to the first post in a topic is a topic reply", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#post_1 .reply.create");
- assert.strictEqual(
- query(".reply-details a.topic-link").innerText,
- "Internationalization / localization"
- );
+ assert
+ .dom(".reply-details a.topic-link")
+ .hasText("Internationalization / localization");
await click("#post_1 .reply.create");
- assert.strictEqual(
- query(".reply-details a.topic-link").innerText,
- "Internationalization / localization"
- );
+ assert
+ .dom(".reply-details a.topic-link")
+ .hasText("Internationalization / localization");
});
test("Can edit a post after starting a reply", async function (assert) {
@@ -420,10 +416,11 @@ acceptance("Composer", function (needs) {
assert.ok(visible(".reply-where-modal"), "it pops up a modal");
await click(".btn-reply-here");
- assert.strictEqual(
- query(".topic-post:last-of-type .cooked p").innerText,
- "If you use gettext format you could leverage Launchpad 13 translations and the community behind it."
- );
+ assert
+ .dom(".topic-post:last-of-type .cooked p")
+ .hasText(
+ "If you use gettext format you could leverage Launchpad 13 translations and the community behind it."
+ );
});
test("Discard draft modal works when switching topics", async function (assert) {
@@ -473,7 +470,7 @@ acceptance("Composer", function (needs) {
});
await visit("/t/internationalization-localization/280");
- assert.ok(!exists(".pending-posts .reviewable-item"));
+ assert.dom(".pending-posts .reviewable-item").doesNotExist();
await click("#topic-footer-buttons .btn.create");
assert.ok(exists(".d-editor-input"), "the composer input is visible");
@@ -493,7 +490,7 @@ acceptance("Composer", function (needs) {
await click(".d-modal__footer button");
assert.ok(invisible(".d-modal"), "the modal can be dismissed");
- assert.ok(exists(".pending-posts .reviewable-item"));
+ assert.dom(".pending-posts .reviewable-item").exists();
});
test("Edit the first post", async function (assert) {
@@ -815,11 +812,12 @@ acceptance("Composer", function (needs) {
"it pops up a confirmation dialog"
);
assert.ok(invisible(".d-modal__footer button.save-draft"));
- assert.strictEqual(
- query(".d-modal__footer button.keep-editing").innerText.trim(),
- I18n.t("post.cancel_composer.keep_editing"),
- "has keep editing button"
- );
+ assert
+ .dom(".d-modal__footer button.keep-editing")
+ .hasText(
+ I18n.t("post.cancel_composer.keep_editing"),
+ "has keep editing button"
+ );
await click(".d-modal__footer button.discard-draft");
assert.ok(
query(".d-editor-input").value.startsWith("This is the second post."),
@@ -840,16 +838,18 @@ acceptance("Composer", function (needs) {
exists(".discard-draft-modal.modal"),
"it pops up a confirmation dialog"
);
- assert.strictEqual(
- query(".d-modal__footer button.save-draft").innerText.trim(),
- I18n.t("post.cancel_composer.save_draft"),
- "has save draft button"
- );
- assert.strictEqual(
- query(".d-modal__footer button.keep-editing").innerText.trim(),
- I18n.t("post.cancel_composer.keep_editing"),
- "has keep editing button"
- );
+ assert
+ .dom(".d-modal__footer button.save-draft")
+ .hasText(
+ I18n.t("post.cancel_composer.save_draft"),
+ "has save draft button"
+ );
+ assert
+ .dom(".d-modal__footer button.keep-editing")
+ .hasText(
+ I18n.t("post.cancel_composer.keep_editing"),
+ "has keep editing button"
+ );
await click(".d-modal__footer button.save-draft");
assert.strictEqual(
query(".d-editor-input").value,
@@ -866,10 +866,7 @@ acceptance("Composer", function (needs) {
await click(".topic-post:nth-of-type(1) button.show-more-actions");
await click(".topic-post:nth-of-type(1) button.edit");
- assert.strictEqual(
- query(".dialog-body").innerText,
- I18n.t("drafts.abandon.confirm")
- );
+ assert.dom(".dialog-body").hasText(I18n.t("drafts.abandon.confirm"));
await click(".dialog-footer .btn-resume-editing");
});
@@ -946,10 +943,7 @@ acceptance("Composer", function (needs) {
});
await visit("/latest");
- assert.strictEqual(
- query("#create-topic").innerText.trim(),
- I18n.t("topic.open_draft")
- );
+ assert.dom("#create-topic").hasText(I18n.t("topic.open_draft"));
await click("#create-topic");
assert.strictEqual(selectKit(".category-chooser").header().value(), "2");
@@ -976,11 +970,9 @@ acceptance("Composer", function (needs) {
test("reply button has envelope icon when replying to private message", async function (assert) {
await visit("/t/34");
await click("article#post_3 button.reply");
- assert.strictEqual(
- query(".save-or-cancel button.create").innerText.trim(),
- I18n.t("composer.create_pm"),
- "reply button says Message"
- );
+ 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,
@@ -993,11 +985,9 @@ acceptance("Composer", function (needs) {
await click("article#post_3 button.show-more-actions");
await click("article#post_3 button.edit");
- assert.strictEqual(
- query(".save-or-cancel button.create").innerText.trim(),
- I18n.t("composer.save_edit"),
- "save button says Save Edit"
- );
+ 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,
@@ -1022,10 +1012,10 @@ acceptance("Composer", function (needs) {
);
await fillIn(".d-editor-input", "[](https://discourse.org)");
- assert.ok(!exists(".composer-popup"));
+ assert.dom(".composer-popup").doesNotExist();
await fillIn(".d-editor-input", "[quote][](https://github.com)[/quote]");
- assert.ok(!exists(".composer-popup"));
+ assert.dom(".composer-popup").doesNotExist();
await fillIn(".d-editor-input", "[](https://github.com)");
assert.strictEqual(count(".composer-popup"), 1);
@@ -1053,7 +1043,7 @@ acceptance("Composer", function (needs) {
await fillIn("#reply-title", "Something");
await fillIn(".d-editor-input", "Something");
await click(".save-or-cancel .cancel");
- assert.notOk(exists(".discard-draft-modal .save-draft"));
+ assert.dom(".discard-draft-modal .save-draft").doesNotExist();
});
test("Saves drafts that only contain quotes", async function (assert) {
@@ -1063,7 +1053,7 @@ acceptance("Composer", function (needs) {
await fillIn(".d-editor-input", "[quote]some quote[/quote]");
await click(".save-or-cancel .cancel");
- assert.ok(exists(".discard-draft-modal .save-draft"));
+ assert.dom(".discard-draft-modal .save-draft").exists();
});
});
@@ -1099,22 +1089,15 @@ acceptance("Composer - Customizations", function (needs) {
test("Supports text customization", async function (assert) {
await visit("/");
await click("#create-topic");
- assert.strictEqual(
- query(".action-title").innerText,
- I18n.t("topic.create_long")
- );
- assert.strictEqual(
- query(".save-or-cancel button").innerText,
- I18n.t("composer.create_topic")
- );
+ assert.dom(".action-title").hasText(I18n.t("topic.create_long"));
+ assert
+ .dom(".save-or-cancel button")
+ .hasText(I18n.t("composer.create_topic"));
const tags = selectKit(".mini-tag-chooser");
await tags.expand();
await tags.selectRowByValue("monkey");
- assert.strictEqual(query(".action-title").innerText, "custom text");
- assert.strictEqual(
- query(".save-or-cancel button").innerText,
- I18n.t("composer.emoji")
- );
+ assert.dom(".action-title").hasText("custom text");
+ assert.dom(".save-or-cancel button").hasText(I18n.t("composer.emoji"));
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js
index 0e2f30dcf83..dbbe470b357 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js
@@ -47,9 +47,9 @@ acceptance("Invites - Create & Edit Invite Modal", function (needs) {
await visit("/u/eviltrout/invited/pending");
await click(".user-invite-buttons .btn:first-child");
- await assert.ok(exists(".invite-to-groups"));
- await assert.ok(exists(".invite-to-topic"));
- await assert.ok(exists(".invite-expires-at"));
+ await assert.dom(".invite-to-groups").exists();
+ await assert.dom(".invite-to-topic").exists();
+ await assert.dom(".invite-expires-at").exists();
});
test("saving", async function (assert) {
@@ -72,7 +72,7 @@ acceptance("Invites - Create & Edit Invite Modal", function (needs) {
await click(".user-invite-buttons .btn:first-child");
await click(".save-invite");
- assert.ok(exists(".invite-link .btn"));
+ assert.dom(".invite-link .btn").exists();
});
});
@@ -238,7 +238,7 @@ acceptance(
test("hides `Arrive at Topic` field on sites with `must_approve_users`", async function (assert) {
await visit("/u/eviltrout/invited/pending");
await click(".user-invite-buttons .btn:first-child");
- assert.ok(!exists(".invite-to-topic"));
+ assert.dom(".invite-to-topic").doesNotExist();
});
}
);
diff --git a/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js b/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js
index 3cdc6f0de91..e5317ce5b6d 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js
@@ -2,11 +2,7 @@ import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { setCustomHTML } from "discourse/helpers/custom-html";
import PreloadStore from "discourse/lib/preload-store";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
acceptance("CustomHTML set", function () {
test("has no custom HTML in the top", async function (assert) {
@@ -18,11 +14,9 @@ acceptance("CustomHTML set", function () {
setCustomHTML("top", 'HTML');
await visit("/static/faq");
- assert.strictEqual(
- query("span.custom-html-test").innerText,
- "HTML",
- "it inserted the markup"
- );
+ assert
+ .dom("span.custom-html-test")
+ .hasText("HTML", "it inserted the markup");
});
test("renders preloaded HTML", async function (assert) {
@@ -31,10 +25,6 @@ acceptance("CustomHTML set", function () {
});
await visit("/static/faq");
- assert.strictEqual(
- query("span.cookie").innerText,
- "monster",
- "it inserted the markup"
- );
+ assert.dom("span.cookie").hasText("monster", "it inserted the markup");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js
index e494aa7f85b..ceff52d2b1e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js
@@ -75,10 +75,12 @@ acceptance("Dashboard", function (needs) {
test("activity metrics", async function (assert) {
await visit("/admin");
- assert.ok(exists(".admin-report.page-view-total-reqs .today-count"));
- assert.ok(exists(".admin-report.page-view-total-reqs .yesterday-count"));
- assert.ok(exists(".admin-report.page-view-total-reqs .sevendays-count"));
- assert.ok(exists(".admin-report.page-view-total-reqs .thirty-days-count"));
+ assert.dom(".admin-report.page-view-total-reqs .today-count").exists();
+ assert.dom(".admin-report.page-view-total-reqs .yesterday-count").exists();
+ assert.dom(".admin-report.page-view-total-reqs .sevendays-count").exists();
+ assert
+ .dom(".admin-report.page-view-total-reqs .thirty-days-count")
+ .exists();
});
test("reports tab", 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.js
index 6ba7ff0d60d..a6de9ce3a71 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
@@ -130,7 +130,7 @@ acceptance("Do not disturb", function (needs) {
await click("#user-menu-button-profile");
await click("#quick-access-profile .do-not-disturb .btn");
- assert.notOk(exists(".user-menu"));
+ assert.dom(".user-menu").doesNotExist();
});
test("doesn't show the end date for eternal DnD", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js
index 3ba9ade569a..06917829225 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js
@@ -36,7 +36,7 @@ acceptance("EmojiPicker", function (needs) {
await click("button.emoji.btn");
await fillIn(".emoji-picker input.filter", "guitar");
- assert.strictEqual(query(`.emoji-picker .results img`).title, "guitar");
+ assert.dom(".emoji-picker .results img").hasAttribute("title", "guitar");
});
test("emoji picker triggers event when picking emoji", async function (assert) {
@@ -267,7 +267,7 @@ acceptance("EmojiPicker", function (needs) {
await click("#topic-footer-buttons .btn.create");
await click("button.emoji.btn");
await triggerKeyEvent(document.activeElement, "keydown", "Escape");
- assert.notOk(exists(".emoji-picker"));
+ assert.dom(".emoji-picker").doesNotExist();
assert.strictEqual(
document.activeElement,
document.querySelector("textarea"),
diff --git a/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js b/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js
index 507fcbbda3b..cd3c47c5d60 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js
@@ -3,7 +3,6 @@ import { IMAGE_VERSION as v } from "pretty-text/emoji/version";
import { test } from "qunit";
import {
acceptance,
- exists,
normalizeHtml,
query,
simulateKey,
@@ -70,10 +69,10 @@ acceptance("Emoji", function (needs) {
await simulateKeys(editor, ":s");
- assert.notOk(exists(".autocomplete.ac-emoji"));
+ assert.dom(".autocomplete.ac-emoji").doesNotExist();
await simulateKey(editor, "w");
- assert.ok(exists(".autocomplete.ac-emoji"));
+ assert.dom(".autocomplete.ac-emoji").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js b/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js
index 58d48c80f3f..670255fe271 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js
@@ -136,11 +136,11 @@ acceptance("flagging", function (needs) {
const silenceUntilCombobox = selectKit(".silence-until .combobox");
await silenceUntilCombobox.expand();
await silenceUntilCombobox.selectRowByValue("tomorrow");
- assert.ok(exists(".d-modal__body"));
+ assert.dom(".d-modal__body").exists();
await fillIn("input.silence-reason", "for breaking the rules");
await click(".perform-penalize");
- assert.ok(!exists(".d-modal__body"));
+ assert.dom(".d-modal__body").doesNotExist();
});
test("Message appears in penalty modal", async function (assert) {
@@ -163,7 +163,7 @@ acceptance("flagging", function (needs) {
await openFlagModal();
await click("#radio_spam");
- assert.ok(exists(".delete-spammer"));
+ assert.dom(".delete-spammer").exists();
});
test("Gets dismissable warning from canceling incomplete silence from take action", async function (assert) {
@@ -178,17 +178,17 @@ acceptance("flagging", function (needs) {
await silenceUntilCombobox.selectRowByValue("tomorrow");
await fillIn("input.silence-reason", "for breaking the rules");
await click(".d-modal-cancel");
- assert.ok(exists(".dialog-body"));
+ assert.dom(".dialog-body").exists();
await click(".dialog-footer .btn-default");
- assert.ok(!exists(".dialog-body"));
+ assert.dom(".dialog-body").doesNotExist();
assert.ok(exists(".silence-user-modal"), "it shows the silence modal");
await click(".d-modal-cancel");
- assert.ok(exists(".dialog-body"));
+ assert.dom(".dialog-body").exists();
await click(".dialog-footer .btn-primary");
- assert.ok(!exists(".dialog-body"));
+ assert.dom(".dialog-body").doesNotExist();
});
test("CTRL + ENTER accepts the modal", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
index ddbd7d2beca..2c49564ab44 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js
@@ -83,7 +83,7 @@ acceptance(
);
await click("#enable_smtp");
- assert.ok(exists(".group-smtp-email-settings"));
+ assert.dom(".group-smtp-email-settings").exists();
await click("#prefill_smtp_gmail");
assert
@@ -326,7 +326,7 @@ acceptance(
);
const regex = /updated: (.*?) by eviltrout/;
- assert.ok(exists(".group-email-last-updated-details.for-imap"));
+ assert.dom(".group-email-last-updated-details.for-imap").exists();
assert.ok(
regex.test(
query(".group-email-last-updated-details.for-imap").innerText.trim()
diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-test.js
index 0871efae311..ca5f0586844 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/group-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/group-test.js
@@ -190,10 +190,11 @@ acceptance("Group - Authenticated", function (needs) {
await visit("/g");
await click(".group-index-request");
- assert.strictEqual(
- query(".d-modal__header .d-modal__title-text").innerText.trim(),
- I18n.t("groups.membership_request.title", { group_name: "Macdonald" })
- );
+ assert
+ .dom(".d-modal__header .d-modal__title-text")
+ .hasText(
+ I18n.t("groups.membership_request.title", { group_name: "Macdonald" })
+ );
assert.strictEqual(
query(".request-group-membership-form textarea").value,
@@ -202,10 +203,7 @@ acceptance("Group - Authenticated", function (needs) {
await click(".d-modal__footer .btn-primary");
- assert.strictEqual(
- query(".fancy-title").innerText.trim(),
- "Internationalization / localization"
- );
+ assert.dom(".fancy-title").hasText("Internationalization / localization");
await visit("/g/discourse");
@@ -226,22 +224,24 @@ acceptance("Group - Authenticated", function (needs) {
await visit("/g/alternative-group");
await click(".nav-pills li a[title='Messages']");
- assert.strictEqual(
- query("span.empty-state-title").innerText.trim(),
- I18n.t("no_group_messages_title"),
- "it should display the right text"
- );
+ assert
+ .dom("span.empty-state-title")
+ .hasText(
+ I18n.t("no_group_messages_title"),
+ "it should display the right text"
+ );
});
test("Admin viewing group messages", async function (assert) {
await visit("/g/discourse");
await click(".nav-pills li a[title='Messages']");
- assert.strictEqual(
- query(".topic-list-item .link-top-line").innerText.trim(),
- "This is a private message 1",
- "it should display the list of group topics"
- );
+ assert
+ .dom(".topic-list-item .link-top-line")
+ .hasText(
+ "This is a private message 1",
+ "it should display the list of group topics"
+ );
await click("#search-button");
await fillIn("#search-term", "something");
@@ -266,11 +266,9 @@ acceptance("Group - Authenticated", function (needs) {
1,
"it displays show group message button"
);
- assert.strictEqual(
- query(".group-info-name").innerText,
- "Awesome Team",
- "it should display the group name"
- );
+ assert
+ .dom(".group-info-name")
+ .hasText("Awesome Team", "it should display the group name");
await click(".group-details-button button.btn-danger");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js
index e5ac1a52b5c..f722aaba560 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js
@@ -5,7 +5,6 @@ import {
count,
exists,
invisible,
- query,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Groups", function () {
@@ -36,11 +35,9 @@ acceptance("Groups", function () {
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
await click("a[href='/g/discourse/members']");
- assert.strictEqual(
- query(".group-info-name").innerText.trim(),
- "Awesome Team",
- "it displays the group page"
- );
+ assert
+ .dom(".group-info-name")
+ .hasText("Awesome Team", "it displays the group page");
await click(".group-index-join");
assert.ok(exists(".modal.login-modal"), "it 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.js
index 9845fc99f9b..76c40ff415f 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js
@@ -34,11 +34,12 @@ acceptance("New Group - Authenticated", function (needs) {
await fillIn("input[name='name']", "1");
- assert.strictEqual(
- query(".tip.bad").innerText.trim(),
- I18n.t("admin.groups.new.name.too_short"),
- "it should show the right validation tooltip"
- );
+ assert
+ .dom(".tip.bad")
+ .hasText(
+ I18n.t("admin.groups.new.name.too_short"),
+ "it should show the right validation tooltip"
+ );
assert.strictEqual(
count(".group-form-save:disabled"),
@@ -51,27 +52,30 @@ acceptance("New Group - Authenticated", function (needs) {
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
);
- assert.strictEqual(
- query(".tip.bad").innerText.trim(),
- I18n.t("admin.groups.new.name.too_long"),
- "it should show the right validation tooltip"
- );
+ assert
+ .dom(".tip.bad")
+ .hasText(
+ I18n.t("admin.groups.new.name.too_long"),
+ "it should show the right validation tooltip"
+ );
await fillIn("input[name='name']", "");
- assert.strictEqual(
- query(".tip.bad").innerText.trim(),
- I18n.t("admin.groups.new.name.blank"),
- "it should show the right validation tooltip"
- );
+ assert
+ .dom(".tip.bad")
+ .hasText(
+ I18n.t("admin.groups.new.name.blank"),
+ "it should show the right validation tooltip"
+ );
await fillIn("input[name='name']", "good-username");
- assert.strictEqual(
- query(".tip.good").innerText.trim(),
- I18n.t("admin.groups.new.name.available"),
- "it should show the right validation tooltip"
- );
+ assert
+ .dom(".tip.good")
+ .hasText(
+ I18n.t("admin.groups.new.name.available"),
+ "it should show the right validation tooltip"
+ );
await click(".group-form-public-admission");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js b/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js
index 1709997f8fc..8625eab09fb 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js
@@ -5,7 +5,6 @@ import {
acceptance,
chromeTest,
exists,
- query,
} from "discourse/tests/helpers/qunit-helpers";
import { cloneJSON } from "discourse-common/lib/object";
import I18n from "discourse-i18n";
@@ -158,10 +157,9 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
exists("#dismiss-read-confirm"),
"confirmation modal to dismiss unread is present"
);
- assert.strictEqual(
- query(".d-modal__body").innerText,
- I18n.t("topics.bulk.also_dismiss_topics")
- );
+ assert
+ .dom(".d-modal__body")
+ .hasText(I18n.t("topics.bulk.also_dismiss_topics"));
await click("#dismiss-read-confirm");
assert.strictEqual(
markReadCalled,
@@ -188,10 +186,11 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {
exists("#dismiss-read-confirm"),
"confirmation modal to dismiss unread is present"
);
- assert.strictEqual(
- query(".d-modal__body").innerText,
- "Stop tracking these topics so they never show up as unread for me again"
- );
+ assert
+ .dom(".d-modal__body")
+ .hasText(
+ "Stop tracking these topics so they never show up as unread for me again"
+ );
await click("#dismiss-read-confirm");
assert.strictEqual(
diff --git a/app/assets/javascripts/discourse/tests/acceptance/modal/login/login-with-email-and-no-social-logins-test.js b/app/assets/javascripts/discourse/tests/acceptance/modal/login/login-with-email-and-no-social-logins-test.js
index fc922706c83..30c4ce08ef1 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/modal/login/login-with-email-and-no-social-logins-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/modal/login/login-with-email-and-no-social-logins-test.js
@@ -1,10 +1,6 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- exists,
- queryAll,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
acceptance("Login with email - no social logins", function (needs) {
needs.settings({ enable_local_logins_via_email: true });
@@ -15,7 +11,7 @@ acceptance("Login with email - no social logins", function (needs) {
await visit("/");
await click("header .login-button");
- assert.ok(exists("#email-login-link"));
+ assert.dom("#email-login-link").exists();
});
test("with login with email disabled", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/page-publishing-test.js b/app/assets/javascripts/discourse/tests/acceptance/page-publishing-test.js
index 54b98b4dce3..c162a210ac1 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/page-publishing-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/page-publishing-test.js
@@ -1,6 +1,6 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Page Publishing", function (needs) {
needs.user();
@@ -31,13 +31,13 @@ acceptance("Page Publishing", function (needs) {
await click(".publish-page");
await fillIn(".publish-slug", "bad-slug");
- assert.ok(!exists(".valid-slug"));
- assert.ok(exists(".invalid-slug"));
+ assert.dom(".valid-slug").doesNotExist();
+ assert.dom(".invalid-slug").exists();
await fillIn(".publish-slug", "internationalization-localization");
- assert.ok(exists(".valid-slug"));
- assert.ok(!exists(".invalid-slug"));
+ assert.dom(".valid-slug").exists();
+ assert.dom(".invalid-slug").doesNotExist();
await click(".publish-page");
- assert.ok(exists(".current-url"));
+ assert.dom(".current-url").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js b/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js
index 3c5c481a9fb..4c7ff52add7 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js
@@ -1,17 +1,15 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- count,
- exists,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
acceptance("Pending posts - no existing pending posts", function (needs) {
needs.user();
test("No link to pending posts", async function (assert) {
await visit("/u/eviltrout");
- assert.ok(!exists(".action-list [href='/u/eviltrout/activity/pending']"));
+ assert
+ .dom(".action-list [href='/u/eviltrout/activity/pending']")
+ .doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js b/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js
index 3264778aa50..acdadbe390e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js
@@ -10,7 +10,6 @@ import DiscourseURL from "discourse/lib/url";
import {
acceptance,
publishToMessageBus,
- query,
} from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
import selectKit from "../helpers/select-kit-helper";
@@ -21,10 +20,9 @@ acceptance("Personal Message", function (needs) {
test("suggested messages", async function (assert) {
await visit("/t/pm-for-testing/12");
- assert.strictEqual(
- query("#suggested-topics-title").innerText.trim(),
- I18n.t("suggested_topics.pm_title")
- );
+ assert
+ .dom("#suggested-topics-title")
+ .hasText(I18n.t("suggested_topics.pm_title"));
});
test("redirects to inbox after topic is archived and clears topicList cache", async function (assert) {
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.js
index 790702b9c1d..294b96f69bc 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,11 +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,
- exists,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
acceptance("Plugin Keyboard Shortcuts - Logged In", function (needs) {
needs.user();
@@ -65,7 +61,7 @@ acceptance("Plugin Keyboard Shortcuts - Anonymous", function () {
await visit("/");
await triggerKeyEvent(document, "keypress", "?".charCodeAt(0));
- assert.ok(exists(".shortcut-category-new_category"));
+ assert.dom(".shortcut-category-new_category").exists();
assert.strictEqual(count(".shortcut-category-new_category li"), 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.js
index dd20e73840c..daddaae2e37 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,11 +1,7 @@
import { visit } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { test } from "qunit";
-import {
- acceptance,
- count,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
import { registerTemporaryModule } from "../helpers/temporary-module-helper";
const HELLO =
@@ -34,15 +30,7 @@ acceptance("Plugin Outlet - Multi Template", function (needs) {
1,
"it has class names"
);
- assert.strictEqual(
- query(".hello-span").innerText,
- "Hello",
- "it renders into the outlet"
- );
- assert.strictEqual(
- query(".bye-span").innerText,
- "Goodbye",
- "it renders into the outlet"
- );
+ assert.dom(".hello-span").hasText("Hello", "it renders into the outlet");
+ assert.dom(".bye-span").hasText("Goodbye", "it renders into the outlet");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js
index ac877356498..85a21ef9f54 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,11 +1,7 @@
import { visit } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { test } from "qunit";
-import {
- acceptance,
- count,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
import { registerTemporaryModule } from "../helpers/temporary-module-helper";
const CONNECTOR_MODULE =
@@ -26,10 +22,8 @@ acceptance("Plugin Outlet - Single Template", function (needs) {
1,
"it has class names"
);
- assert.strictEqual(
- query(".hello-username").innerText,
- "eviltrout",
- "it renders into the outlet"
- );
+ assert
+ .dom(".hello-username")
+ .hasText("eviltrout", "it renders into the outlet");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/reports-test.js b/app/assets/javascripts/discourse/tests/acceptance/reports-test.js
index c0c951a0110..4277fd6f9f4 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/reports-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/reports-test.js
@@ -3,7 +3,6 @@ import { test } from "qunit";
import {
acceptance,
count,
- exists,
query,
} from "discourse/tests/helpers/qunit-helpers";
@@ -35,6 +34,6 @@ acceptance("Reports", function (needs) {
test("Visit report page", async function (assert) {
await visit("/admin/reports/staff_logins");
- assert.ok(exists(".export-csv-btn"));
+ assert.dom(".export-csv-btn").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/review-test.js b/app/assets/javascripts/discourse/tests/acceptance/review-test.js
index ecf3ff4598f..b963f4b0f70 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/review-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/review-test.js
@@ -234,7 +234,7 @@ acceptance("Review", function (needs) {
count(`[data-reviewable-id="1234"] .status .pending`),
1
);
- assert.ok(!exists(".stale-help"));
+ assert.dom(".stale-help").doesNotExist();
await publishToMessageBus(`/reviewable_counts/${loggedInUser().id}`, {
review_count: 1,
diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-test.js
index 36f57292ebb..3e68f6c321a 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/search-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/search-test.js
@@ -108,16 +108,16 @@ acceptance("Search - Anonymous", function (needs) {
await visit("/");
await click("#search-button");
- assert.ok(exists(".search-menu"));
+ assert.dom(".search-menu").exists();
await clickOutside();
- assert.ok(!exists(".search-menu"));
+ assert.dom(".search-menu").doesNotExist();
await click("#search-button");
- assert.ok(exists(".search-menu"));
+ assert.dom(".search-menu").exists();
await click("#search-button"); // toggle same button
- assert.ok(!exists(".search-menu"));
+ assert.dom(".search-menu").doesNotExist();
});
test("initial options", async function (assert) {
@@ -522,9 +522,9 @@ acceptance("Search - Authenticated", function (needs) {
assert.ok(inSelector.rowByValue("tracking").exists());
assert.ok(inSelector.rowByValue("bookmarks").exists());
- assert.ok(exists(".search-advanced-options .in-likes"));
- assert.ok(exists(".search-advanced-options .in-private"));
- assert.ok(exists(".search-advanced-options .in-seen"));
+ assert.dom(".search-advanced-options .in-likes").exists();
+ assert.dom(".search-advanced-options .in-private").exists();
+ assert.dom(".search-advanced-options .in-seen").exists();
});
test("topic results - topic search scope - works with empty result sets", async function (assert) {
@@ -541,10 +541,9 @@ acceptance("Search - Authenticated", function (needs) {
assert.strictEqual(count(".search-menu .results .item"), 0);
assert.strictEqual(count(".search-menu .results .no-results"), 1);
- assert.strictEqual(
- query(".search-menu .results .no-results").innerText,
- I18n.t("search.no_results")
- );
+ assert
+ .dom(".search-menu .results .no-results")
+ .hasText(I18n.t("search.no_results"));
});
test("topic results - topic search scope - clicking a search result navigates to topic url", async function (assert) {
@@ -755,7 +754,7 @@ acceptance("Search - Authenticated", function (needs) {
".search-menu .search-menu-recent li:nth-of-type(1) .search-link"
);
- assert.strictEqual(query("#search-term").value, "hijacked!");
+ assert.dom("#search-term").hasValue("hijacked!");
});
test("initial options - search history - category context", async function (assert) {
@@ -1193,7 +1192,7 @@ acceptance("Search - assistant", function (needs) {
);
await fillIn("#search-term", "in:mess");
- assert.strictEqual(query(firstTarget).innerText, "in:messages");
+ assert.dom(firstTarget).hasText("in:messages");
});
test("initial options - user search scope - shows users when typing @", async function (assert) {
@@ -1207,7 +1206,7 @@ acceptance("Search - assistant", function (needs) {
assert.strictEqual(username, "TeaMoe");
await click(firstUser);
- assert.strictEqual(query("#search-term").value, `@${username}`);
+ assert.dom("#search-term").hasValue(`@${username}`);
});
test("initial options - topic search scope - selecting a tag defaults to searching 'in all topics'", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js
index 8d26ea39ed8..8d065c9654e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js
@@ -92,8 +92,7 @@ acceptance("Share and Invite modal", function (needs) {
exists("#modal-alert.alert-warning"),
"it shows restricted warning"
);
- assert.strictEqual(
- query("#modal-alert.alert-warning").innerText,
+ assert.dom("#modal-alert.alert-warning").hasText(
I18n.t("topic.share.restricted_groups", {
count: 2,
groupNames: "group_name_1, group_name_2",
diff --git a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js
index 1ccaa414dc4..a4a28ef2160 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js
@@ -1,10 +1,6 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- count,
- exists,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
acceptance("Shared Drafts", function () {
@@ -17,7 +13,7 @@ acceptance("Shared Drafts", function () {
await click(".publish-shared-draft");
await click(".dialog-footer .btn-primary");
- assert.ok(!exists(".shared-draft-controls"));
+ assert.dom(".shared-draft-controls").doesNotExist();
});
test("Updating category", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js
index 3a220e74323..9956ca26819 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js
@@ -70,6 +70,6 @@ acceptance("Sidebar - Narrow Desktop", function (needs) {
await click(".header-dropdown-toggle.current-user button");
$(".header-dropdown-toggle.current-user").click();
- assert.ok(exists(".quick-access-panel"));
+ assert.dom(".quick-access-panel").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js
index fefe3110c40..c3449943a75 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js
@@ -1,10 +1,6 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
acceptance("Signing In", function () {
test("sign in", async function (assert) {
@@ -50,17 +46,15 @@ acceptance("Signing In", function () {
await fillIn("#login-account-name", "eviltrout");
await fillIn("#login-account-password", "not-activated");
await click(".d-modal__footer .btn-primary");
- assert.strictEqual(
- query(".d-modal__body b").innerText,
- "eviltrout@example.com"
- );
+ assert
+ .dom(".d-modal__body b")
+ .hasText("eviltrout@example.com");
assert.ok(!exists(".d-modal__body small"), "it escapes the email address");
await click(".d-modal__footer button.resend");
- assert.strictEqual(
- query(".d-modal__body b").innerText,
- "current@example.com"
- );
+ assert
+ .dom(".d-modal__body b")
+ .hasText("current@example.com");
assert.ok(!exists(".d-modal__body small"), "it escapes the email address");
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.js b/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.js
index 2f06a6ff94e..5bb9b19c451 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.js
@@ -1,6 +1,6 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
acceptance("Table Builder", function (needs) {
@@ -21,7 +21,7 @@ acceptance("Table Builder", function (needs) {
await visit("/t/internationalization-localization/280");
await click("#post_1 .show-more-actions");
await click("#post_1 .edit");
- assert.ok(exists("#reply-control"));
+ assert.dom("#reply-control").exists();
await click(".d-editor-button-bar .options");
await selectKit(".toolbar-popup-menu-options").expand();
diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js
index 73f8505d97d..2b18857a0af 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js
@@ -1,11 +1,7 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
acceptance("Tags intersection", function (needs) {
needs.user();
@@ -33,11 +29,9 @@ acceptance("Tags intersection", function (needs) {
await click("#create-topic");
assert.ok(exists(".mini-tag-chooser"), "The tag selector appears");
- assert.strictEqual(
- query(".composer-fields .mini-tag-chooser").innerText.trim(),
- "first, second",
- "populates the tags when clicking 'New topic'"
- );
+ assert
+ .dom(".composer-fields .mini-tag-chooser")
+ .hasText("first, second", "populates the tags when clicking 'New topic'");
});
test("correctly passes the category filter", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js
index cb78d15ebba..8ef1da754db 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js
@@ -230,7 +230,7 @@ acceptance("Tags listed by group", function (needs) {
updateCurrentUser({ moderator: false, admin: false });
await visit("/tag/regular-tag");
- assert.ok(!exists("#create-topic:disabled"));
+ assert.dom("#create-topic:disabled").doesNotExist();
await visit("/tag/staff-only-tag");
assert.strictEqual(count("#create-topic:disabled"), 1);
@@ -238,10 +238,10 @@ acceptance("Tags listed by group", function (needs) {
updateCurrentUser({ moderator: true });
await visit("/tag/regular-tag");
- assert.ok(!exists("#create-topic:disabled"));
+ assert.dom("#create-topic:disabled").doesNotExist();
await visit("/tag/staff-only-tag");
- assert.ok(!exists("#create-topic:disabled"));
+ assert.dom("#create-topic:disabled").doesNotExist();
});
});
@@ -644,7 +644,7 @@ acceptance(
test("load more footer message is present", async function (assert) {
await visit("/tag/planters");
- assert.notOk(exists(".topic-list-bottom .footer-message"));
+ assert.dom(".topic-list-bottom .footer-message").doesNotExist();
});
}
);
@@ -724,6 +724,6 @@ acceptance("Tag show - topic list without `more_topics_url`", function (needs) {
});
test("load more footer message is not present", async function (assert) {
await visit("/tag/planters");
- assert.ok(exists(".topic-list-bottom .footer-message"));
+ assert.dom(".topic-list-bottom .footer-message").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js
index 91a249f89d3..ec16bff4dbe 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js
@@ -212,10 +212,10 @@ acceptance("Topic Discovery | Footer", function (needs) {
// TODO: Needs scroll support in tests
skip("No footer, then shows footer when all loaded", async function (assert) {
await visit("/c/dev");
- assert.ok(!exists(".custom-footer-content"));
+ assert.dom(".custom-footer-content").doesNotExist();
document.querySelector("#ember-testing-container").scrollTop = 100000; // scroll to bottom
await settled();
- assert.ok(exists(".custom-footer-content"));
+ assert.dom(".custom-footer-content").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-footer-button-api-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-footer-button-api-test.js
index c04fcd9264c..76090791d5b 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-footer-button-api-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-footer-button-api-test.js
@@ -1,7 +1,7 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api";
-import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance(
"Topic - Plugin API - registerTopicFooterButton - logged in user",
@@ -38,7 +38,7 @@ acceptance(
});
await visit("/t/internationalization-localization/280");
- assert.ok(!exists("#topic-footer-button-my-button"));
+ assert.dom("#topic-footer-button-my-button").doesNotExist();
});
}
);
@@ -76,7 +76,7 @@ acceptance(
});
await visit("/t/internationalization-localization/280");
- assert.ok(!exists("#topic-footer-button-my-button"));
+ assert.dom("#topic-footer-button-my-button").doesNotExist();
});
}
);
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js
index d120e549556..42108c5ce6c 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js
@@ -23,11 +23,12 @@ acceptance("Topic move posts", function (needs) {
await click(".topic-admin-multi-select .btn");
await click("#post_11 .select-below");
- assert.strictEqual(
- query(".selected-posts .move-to-topic").innerText.trim(),
- I18n.t("topic.move_to.action"),
- "it should show the move to button"
- );
+ assert
+ .dom(".selected-posts .move-to-topic")
+ .hasText(
+ I18n.t("topic.move_to.action"),
+ "it should show the move to button"
+ );
await click(".selected-posts .move-to-topic");
@@ -68,10 +69,7 @@ acceptance("Topic move posts", function (needs) {
await click(".selected-posts .move-to-topic");
await fillIn(".choose-topic-modal #split-topic-name", "Existing topic");
await click(".choose-topic-modal .d-modal__footer .btn-primary");
- assert.strictEqual(
- query("#modal-alert").innerText.trim(),
- I18n.t("topic.move_to.error")
- );
+ assert.dom("#modal-alert").hasText(I18n.t("topic.move_to.error"));
});
test("moving all posts", async function (assert) {
@@ -150,11 +148,12 @@ acceptance("Topic move posts", function (needs) {
await click(".topic-admin-multi-select .btn");
await click("#post_1 .select-post");
- assert.strictEqual(
- query(".selected-posts .move-to-topic").innerText.trim(),
- I18n.t("topic.move_to.action"),
- "it should show the move to button"
- );
+ assert
+ .dom(".selected-posts .move-to-topic")
+ .hasText(
+ I18n.t("topic.move_to.action"),
+ "it should show the move to button"
+ );
await click(".selected-posts .move-to-topic");
@@ -186,11 +185,12 @@ acceptance("Topic move posts", function (needs) {
await click(".topic-admin-multi-select .btn");
await click("#post_2 .select-below");
- assert.strictEqual(
- query(".selected-posts .move-to-topic").innerText.trim(),
- I18n.t("topic.move_to.action"),
- "it should show the move to button"
- );
+ assert
+ .dom(".selected-posts .move-to-topic")
+ .hasText(
+ I18n.t("topic.move_to.action"),
+ "it should show the move to button"
+ );
await click(".selected-posts .move-to-topic");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js
index bc75a2e5339..eecf7416e73 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js
@@ -4,7 +4,6 @@ import topicFixtures from "discourse/tests/fixtures/topic";
import {
acceptance,
exists,
- query,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
@@ -50,11 +49,12 @@ acceptance("Topic - Slow Mode - enabled", function (needs) {
// but at least we can make sure that components for choosing date and time are rendered
// (in case of inactive slow mode it would be only a combo box with text "Select a timeframe",
// and date picker and time picker wouldn't be rendered)
- assert.strictEqual(
- query("div.enabled-until span.name").innerText,
- I18n.t("time_shortcut.custom"),
- "enabled until combobox is switched to the option Pick Date and Time"
- );
+ assert
+ .dom("div.enabled-until span.name")
+ .hasText(
+ I18n.t("time_shortcut.custom"),
+ "enabled until combobox is switched to the option Pick Date and Time"
+ );
assert.ok(exists("input.date-picker"), "date picker is rendered");
assert.ok(exists("input.time-input"), "time picker is rendered");
@@ -66,21 +66,23 @@ acceptance("Topic - Slow Mode - enabled", function (needs) {
await click(".topic-admin-slow-mode button");
await click(".future-date-input-selector-header");
- assert.strictEqual(
- query("div.d-modal__footer button.btn-primary span").innerText,
- I18n.t("topic.slow_mode_update.enable"),
- "shows 'Enable' button when slow mode is disabled"
- );
+ assert
+ .dom("div.d-modal__footer button.btn-primary span")
+ .hasText(
+ I18n.t("topic.slow_mode_update.enable"),
+ "shows 'Enable' button when slow mode is disabled"
+ );
await visit("/t/a-topic-with-enabled-slow-mode/1");
await click(".toggle-admin-menu");
await click(".topic-admin-slow-mode button");
await click(".future-date-input-selector-header");
- assert.strictEqual(
- query("div.d-modal__footer button.btn-primary span").innerText,
- I18n.t("topic.slow_mode_update.update"),
- "shows 'Update' button when slow mode is enabled"
- );
+ assert
+ .dom("div.d-modal__footer button.btn-primary span")
+ .hasText(
+ I18n.t("topic.slow_mode_update.update"),
+ "shows 'Update' button when slow mode is enabled"
+ );
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js
index 8962bc5a244..43b49926dc0 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js
@@ -128,16 +128,12 @@ acceptance("Topic", function (needs) {
await categoryChooser.selectRowByValue(4);
await click("#topic-title .submit-edit");
- assert.strictEqual(
- query("#topic-title .badge-category").innerText,
- "faq",
- "it displays the new category"
- );
- assert.strictEqual(
- query(".fancy-title").innerText.trim(),
- "this is the new title",
- "it displays the new title"
- );
+ assert
+ .dom("#topic-title .badge-category")
+ .hasText("faq", "it displays the new category");
+ assert
+ .dom(".fancy-title")
+ .hasText("this is the new title", "it displays the new title");
});
test("Marking a topic as wiki", async function (assert) {
@@ -155,19 +151,18 @@ acceptance("Topic", function (needs) {
test("Visit topic routes", async function (assert) {
await visit("/t/12");
- assert.strictEqual(
- query(".fancy-title").innerText.trim(),
- "PM for testing",
- "it routes to the right topic"
- );
+ assert
+ .dom(".fancy-title")
+ .hasText("PM for testing", "it routes to the right topic");
await visit("/t/280/20");
- assert.strictEqual(
- query(".fancy-title").innerText.trim(),
- "Internationalization / localization",
- "it routes to the right topic"
- );
+ assert
+ .dom(".fancy-title")
+ .hasText(
+ "Internationalization / localization",
+ "it routes to the right topic"
+ );
});
test("Updating the topic title with emojis", async function (assert) {
@@ -218,10 +213,9 @@ acceptance("Topic", function (needs) {
test("Suggested topics", async function (assert) {
await visit("/t/internationalization-localization/280");
- assert.strictEqual(
- query("#suggested-topics-title").innerText.trim(),
- I18n.t("suggested_topics.title")
- );
+ assert
+ .dom("#suggested-topics-title")
+ .hasText(I18n.t("suggested_topics.title"));
});
test("Deleting a topic", async function (assert) {
@@ -313,7 +307,7 @@ acceptance("Topic featured links", function (needs) {
test("Converting to a public topic", async function (assert) {
await visit("/t/test-pm/34");
- assert.ok(exists(".private_message"));
+ assert.dom(".private_message").exists();
await click(".toggle-admin-menu");
await click(".topic-admin-convert button");
@@ -324,7 +318,7 @@ acceptance("Topic featured links", function (needs) {
await categoryChooser.selectRowByValue(21);
await click(".convert-to-public-topic .btn-primary");
- assert.ok(!exists(".private_message"));
+ assert.dom(".private_message").doesNotExist();
});
test("Unpinning unlisted topic", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js
index 2d466b84d1c..64f6467e68a 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js
@@ -1,10 +1,6 @@
import { click, currentURL, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
acceptance("Glimmer Topic Timeline", function (needs) {
needs.user({
@@ -362,10 +358,7 @@ acceptance("Glimmer Topic Timeline", function (needs) {
test("Shows dates of first and last posts", async function (assert) {
await visit("/t/deleted-topic-with-whisper-post/129");
- assert.strictEqual(
- query(".timeline-date-wrapper .now-date").innerText,
- "Jul 2020"
- );
+ assert.dom(".timeline-date-wrapper .now-date").hasText("Jul 2020");
});
test("selecting start-date navigates you to the first post", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-activity-drafts-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-activity-drafts-test.js
index 5ba6a2c85e9..dd81ee25492 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-activity-drafts-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-activity-drafts-test.js
@@ -1,6 +1,6 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
-import { acceptance, exists } from "../helpers/qunit-helpers";
+import { acceptance } from "../helpers/qunit-helpers";
acceptance("User Activity / Drafts - empty state", function (needs) {
needs.user();
@@ -15,6 +15,6 @@ acceptance("User Activity / Drafts - empty state", function (needs) {
test("It renders the empty state panel", async function (assert) {
await visit("/u/eviltrout/activity/drafts");
- assert.ok(exists("div.empty-state"));
+ assert.dom("div.empty-state").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-activity-read-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-activity-read-test.js
index 0182cb9c855..5742a3cf5d8 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-activity-read-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-activity-read-test.js
@@ -1,7 +1,7 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import userFixtures from "../fixtures/user-fixtures";
-import { acceptance, exists, queryAll } from "../helpers/qunit-helpers";
+import { acceptance, queryAll } from "../helpers/qunit-helpers";
acceptance("User Activity / Read - bulk actions", function (needs) {
needs.user();
@@ -48,6 +48,6 @@ acceptance("User Activity / Read - empty state", function (needs) {
test("It renders the empty state panel", async function (assert) {
await visit("/u/charlie/activity/read");
- assert.ok(exists("div.empty-state"));
+ assert.dom("div.empty-state").exists();
});
});
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.js
index fff0dea7e38..5c17d3ba361 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
@@ -14,7 +14,7 @@ acceptance("Bookmark - Bulk Actions", function (needs) {
test("bulk select - modal", async function (assert) {
await visit("/u/eviltrout/activity/bookmarks");
- assert.ok(exists("button.bulk-select"));
+ assert.dom("button.bulk-select").exists();
await click("button.bulk-select");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js
index d90bfaa275c..db3ec8eb957 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js
@@ -1,11 +1,7 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import userFixtures from "discourse/tests/fixtures/user-fixtures";
-import {
- acceptance,
- count,
- exists,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { cloneJSON } from "discourse-common/lib/object";
@@ -14,18 +10,18 @@ acceptance("User's bookmarks", function (needs) {
test("removing a bookmark with no reminder does not show a confirmation", async function (assert) {
await visit("/u/eviltrout/activity/bookmarks");
- assert.ok(exists(".bookmark-list-item"));
+ assert.dom(".bookmark-list-item").exists();
const dropdown = selectKit(".bookmark-actions-dropdown:nth-of-type(1)");
await dropdown.expand();
await dropdown.selectRowByValue("remove");
- assert.notOk(exists(".dialog-body"), "it should not show the modal");
+ assert.dom(".dialog-body").doesNotExist("does not show the modal");
});
test("it renders search controls if there are bookmarks", async function (assert) {
await visit("/u/eviltrout/activity/bookmarks");
- assert.ok(exists("div.bookmark-search-form"));
+ assert.dom("div.bookmark-search-form").exists();
});
});
@@ -51,22 +47,22 @@ acceptance("User's bookmarks - reminder", function (needs) {
await dropdown.expand();
await dropdown.selectRowByValue("remove");
- assert.ok(exists(".dialog-body"), "it asks for delete confirmation");
+ assert.dom(".dialog-body").exists("asks for delete confirmation");
await click(".dialog-footer .btn-danger");
- assert.notOk(exists(".dialog-body"));
+ assert.dom(".dialog-body").doesNotExist();
});
test("bookmarks with reminders have a clear reminder option", async function (assert) {
await visit("/u/eviltrout/activity/bookmarks");
- assert.strictEqual(count(".bookmark-reminder"), 2);
+ assert.dom(".bookmark-reminder").exists({ count: 2 });
const dropdown = selectKit(".bookmark-actions-dropdown");
await dropdown.expand();
await dropdown.selectRowByValue("clear_reminder");
- assert.strictEqual(count(".bookmark-reminder"), 1);
+ assert.dom(".bookmark-reminder").exists({ count: 1 });
});
});
@@ -82,10 +78,9 @@ acceptance("User's bookmarks - no bookmarks", function (needs) {
test("listing users bookmarks - no bookmarks", async function (assert) {
await visit("/u/eviltrout/activity/bookmarks");
- assert.notOk(
- exists("div.bookmark-search-form"),
- "does not render search controls"
- );
- assert.ok(exists("div.empty-state", "renders the empty-state message"));
+ assert
+ .dom("div.bookmark-search-form")
+ .doesNotExist("does not render search controls");
+ assert.dom("div.empty-state").exists("renders the empty-state message");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js
index e32cc4c93f4..b127bb77d0c 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js
@@ -1024,7 +1024,7 @@ acceptance("User menu - Dismiss button", function (needs) {
"dismiss_types=bookmark_reminder",
"mark-read request specifies bookmark_reminder types"
);
- assert.notOk(exists(".user-menu .notifications-dismiss"));
+ assert.dom(".user-menu .notifications-dismiss").doesNotExist();
});
test("shows confirmation modal for the messages list", async function (assert) {
@@ -1080,7 +1080,7 @@ acceptance("User menu - Dismiss button", function (needs) {
"dismiss_types=private_message%2Cgroup_message_summary",
"mark-read request specifies private_message types"
);
- assert.notOk(exists(".user-menu .notifications-dismiss"));
+ assert.dom(".user-menu .notifications-dismiss").doesNotExist();
});
test("doesn't show confirmation modal for the likes notifications list", async function (assert) {
@@ -1131,8 +1131,8 @@ acceptance("User menu - avatars", function (needs) {
test("It shows user avatars for various notifications on all notifications pane", async function (assert) {
await visit("/");
await click(".d-header-icons .current-user button");
- assert.ok(exists("li.notification.edited .icon-avatar"));
- assert.ok(exists("li.notification.replied .icon-avatar"));
+ assert.dom("li.notification.edited .icon-avatar").exists();
+ assert.dom("li.notification.replied .icon-avatar").exists();
});
test("It shows user avatars for messages", async function (assert) {
@@ -1140,8 +1140,8 @@ acceptance("User menu - avatars", function (needs) {
await click(".d-header-icons .current-user button");
await click("#user-menu-button-messages");
- assert.ok(exists("li.notification.private-message .icon-avatar"));
- assert.ok(exists("li.message .icon-avatar"));
+ assert.dom("li.notification.private-message .icon-avatar").exists();
+ assert.dom("li.message .icon-avatar").exists();
});
test("It shows user avatars for bookmark items and bookmark reminder notification items", async function (assert) {
@@ -1149,14 +1149,14 @@ acceptance("User menu - avatars", function (needs) {
await click(".d-header-icons .current-user button");
await click("#user-menu-button-bookmarks");
- assert.ok(exists("li.notification.bookmark-reminder .icon-avatar"));
- assert.ok(exists("li.bookmark .icon-avatar"));
+ assert.dom("li.notification.bookmark-reminder .icon-avatar").exists();
+ assert.dom("li.bookmark .icon-avatar").exists();
});
test("Icon avatars have correct class names based on system avatar usage", async function (assert) {
await visit("/");
await click(".d-header-icons .current-user button");
- assert.ok(exists("li.group-message-summary .icon-avatar.system-avatar"));
- assert.ok(exists("li.notification.replied .icon-avatar.user-avatar"));
+ assert.dom("li.group-message-summary .icon-avatar.system-avatar").exists();
+ assert.dom("li.notification.replied .icon-avatar.user-avatar").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-test.js
index b35d48375a6..69761484ef1 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-test.js
@@ -77,14 +77,11 @@ acceptance("User Preferences - Account", function (needs) {
await visit("/u/eviltrout/preferences/account");
- assert.strictEqual(
- query(".username-preference__current-username").innerText,
- "eviltrout"
- );
+ assert.dom(".username-preference__current-username").hasText("eviltrout");
await click(".username-preference__edit-username");
- assert.strictEqual(query(".username-preference__input").value, "eviltrout");
+ assert.dom(".username-preference__input").hasValue("eviltrout");
assert.true(query(".username-preference__submit").disabled);
await fillIn(query(".username-preference__input"), "good_trout");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-user-status-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-user-status-test.js
index 545cb76f546..f3ab9e8d715 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-user-status-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-account-user-status-test.js
@@ -36,7 +36,7 @@ acceptance("User Profile - Account - User Status", function (needs) {
test("doesn't render status block if status is disabled in site settings", async function (assert) {
this.siteSettings.enable_user_status = false;
await visit(`/u/${username}/preferences/account`);
- assert.notOk(exists(".pref-user-status"));
+ assert.dom(".pref-user-status").doesNotExist();
});
test("renders status block if status is enabled in site settings", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-email-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-email-test.js
index aadbdb2e94e..0818c7d1bd8 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-email-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-email-test.js
@@ -1,10 +1,6 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- exists,
- query,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
acceptance("User Preferences - Email", function (needs) {
@@ -25,11 +21,12 @@ acceptance("User Preferences - Email", function (needs) {
await fillIn("#change-email", "invalid-email");
- assert.strictEqual(
- query(".tip.bad").innerText.trim(),
- I18n.t("user.email.invalid"),
- "it should display invalid email tip"
- );
+ assert
+ .dom(".tip.bad")
+ .hasText(
+ I18n.t("user.email.invalid"),
+ "it should display invalid email tip"
+ );
});
test("email field always shows up", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js
index 1f80ac2888b..cfa3f1c55ba 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
@@ -199,7 +199,7 @@ acceptance(
site.set("user_color_schemes", []);
await visit("/u/eviltrout/preferences/interface");
- assert.ok(!exists(".control-group.color-scheme"));
+ assert.dom(".control-group.color-scheme").doesNotExist();
});
test("light color scheme picker", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-backup-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-backup-test.js
index 40bf968f624..af68822b538 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-backup-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-backup-test.js
@@ -3,7 +3,6 @@ import { test } from "qunit";
import {
acceptance,
exists,
- query,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
@@ -55,9 +54,6 @@ acceptance("User Preferences - Second Factor Backup", function (needs) {
await click(".two-factor-backup-dropdown .select-kit-header");
await click("li[data-name='Disable']");
- assert.strictEqual(
- query("#dialog-title").innerText.trim(),
- "Deleting backup codes"
- );
+ assert.dom("#dialog-title").hasText("Deleting backup codes");
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-test.js
index dd0a5edcd57..d22ba51d3c4 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-second-factor-test.js
@@ -109,10 +109,7 @@ acceptance("User Preferences - Second Factor", function (needs) {
await click(".token-based-auth-dropdown .select-kit-header");
await click("li[data-name='Disable']");
- assert.strictEqual(
- query("#dialog-title").innerText.trim(),
- "Deleting an authenticator"
- );
+ assert.dom("#dialog-title").hasText("Deleting an authenticator");
await click(".dialog-close");
assert.ok(
@@ -123,10 +120,7 @@ acceptance("User Preferences - Second Factor", function (needs) {
await click(".security-key-dropdown .select-kit-header");
await click("li[data-name='Disable']");
- assert.strictEqual(
- query("#dialog-title").innerText.trim(),
- "Deleting an authenticator"
- );
+ assert.dom("#dialog-title").hasText("Deleting an authenticator");
await click(".dialog-footer .btn-danger");
assert.notOk(
exists(".security-key .second-factor-item"),
@@ -134,10 +128,9 @@ acceptance("User Preferences - Second Factor", function (needs) {
);
await click(".pref-second-factor-disable-all .btn-danger");
- assert.strictEqual(
- query("#dialog-title").innerText.trim(),
- "Are you sure you want to disable two-factor authentication?"
- );
+ assert
+ .dom("#dialog-title")
+ .hasText("Are you sure you want to disable two-factor authentication?");
});
test("rename second factor security method", 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.js
index 89c1295fc05..27b39525079 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
@@ -38,11 +38,12 @@ acceptance("User Preferences - Security", function (needs) {
"it should display active token first"
);
- assert.strictEqual(
- query(".pref-auth-tokens > a:nth-of-type(1)").innerText.trim(),
- I18n.t("user.auth_tokens.show_all", { count: 3 }),
- "it should display two tokens"
- );
+ assert
+ .dom(".pref-auth-tokens > a:nth-of-type(1)")
+ .hasText(
+ I18n.t("user.auth_tokens.show_all", { count: 3 }),
+ "it should display two tokens"
+ );
assert.strictEqual(
count(".pref-auth-tokens .auth-token"),
2,
@@ -79,17 +80,19 @@ acceptance("User Preferences - Security", function (needs) {
await visit("/u/eviltrout/preferences/security");
- assert.strictEqual(
- query(".pref-user-api-keys__application-name").innerText.trim(),
- "Discourse Hub",
- "displays the application name for the API key"
- );
+ assert
+ .dom(".pref-user-api-keys__application-name")
+ .hasText(
+ "Discourse Hub",
+ "displays the application name for the API key"
+ );
- assert.strictEqual(
- query(".pref-user-api-keys__scopes-list-item").innerText.trim(),
- "Read and clear notifications",
- "displays the scope for the API key"
- );
+ assert
+ .dom(".pref-user-api-keys__scopes-list-item")
+ .hasText(
+ "Read and clear notifications",
+ "displays the scope for the API key"
+ );
assert.ok(
exists(".pref-user-api-keys__created-at"),
@@ -118,11 +121,9 @@ acceptance("User Preferences - Security", function (needs) {
await visit("/u/eviltrout/preferences/security");
- assert.strictEqual(
- query(".pref-passkeys__rows .row-passkey__name").innerText.trim(),
- "Password Manager",
- "displays the passkey name"
- );
+ assert
+ .dom(".pref-passkeys__rows .row-passkey__name")
+ .hasText("Password Manager", "displays the passkey name");
assert
.dom(".row-passkey__created-date")
@@ -212,11 +213,9 @@ acceptance("User Preferences - Security", function (needs) {
// user charlie has passkeys in fixtures
await visit("/u/charlie/preferences/security");
- assert.strictEqual(
- query(".pref-passkeys__rows .row-passkey__name").innerText.trim(),
- "iCloud Keychain",
- "displays the passkey name"
- );
+ assert
+ .dom(".pref-passkeys__rows .row-passkey__name")
+ .hasText("iCloud Keychain", "displays the passkey name");
assert
.dom(".row-passkey__created-date")
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.js
index 9e77e852f1a..27d61e5f5c2 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
@@ -849,19 +849,19 @@ acceptance("User Private Messages - user with no messages", function (needs) {
test("It renders the empty state panel", async function (assert) {
await visit("/u/charlie/messages");
- assert.ok(exists("div.empty-state"));
+ assert.dom("div.empty-state").exists();
await visit("/u/charlie/messages/sent");
- assert.ok(exists("div.empty-state"));
+ assert.dom("div.empty-state").exists();
await visit("/u/charlie/messages/new");
- assert.ok(exists("div.empty-state"));
+ assert.dom("div.empty-state").exists();
await visit("/u/charlie/messages/unread");
- assert.ok(exists("div.empty-state"));
+ assert.dom("div.empty-state").exists();
await visit("/u/charlie/messages/archive");
- assert.ok(exists("div.empty-state"));
+ assert.dom("div.empty-state").exists();
});
});
@@ -927,7 +927,7 @@ acceptance(
await visit("/u/eviltrout/messages");
await click(".new-private-message");
- assert.ok(exists("#reply-control .mini-tag-chooser"));
+ assert.dom("#reply-control .mini-tag-chooser").exists();
await fillIn("#reply-title", "Sending a message with tags");
await fillIn(
@@ -980,7 +980,7 @@ acceptance(
test("tags are present on private messages - Mobile mode", async function (assert) {
await visit("/u/eviltrout/messages");
await click(".new-private-message");
- assert.ok(exists("#reply-control .mini-tag-chooser"));
+ assert.dom("#reply-control .mini-tag-chooser").exists();
});
}
);
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js
index c8e84a6844c..d12005709a0 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js
@@ -61,7 +61,7 @@ acceptance("User Profile - Summary - User Status", function (needs) {
test("Shows User Status", async function (assert) {
await visit("/u/eviltrout/summary");
- assert.ok(exists(".user-status-message .emoji[alt='tooth']"));
+ assert.dom(".user-status-message .emoji[alt='tooth']").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-status-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-status-test.js
index bea7e81694e..e8774817424 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-status-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-status-test.js
@@ -208,7 +208,9 @@ acceptance("User Status", function (needs) {
await openUserStatusModal();
await click(".btn.delete-status");
- assert.notOk(exists(".header-dropdown-toggle .user-status-background"));
+ assert
+ .dom(".header-dropdown-toggle .user-status-background")
+ .doesNotExist();
});
test("setting user status with auto removing timer", async function (assert) {
@@ -299,7 +301,7 @@ acceptance("User Status", function (needs) {
await visit("/");
await openUserStatusModal();
- assert.ok(exists(".btn.delete-status"));
+ assert.dom(".btn.delete-status").exists();
});
test("doesn't show the trash button when status wasn't set before", async function (assert) {
@@ -309,7 +311,7 @@ acceptance("User Status", function (needs) {
await visit("/");
await openUserStatusModal();
- assert.notOk(exists(".btn.delete-status"));
+ assert.dom(".btn.delete-status").doesNotExist();
});
test("shows empty modal after deleting the status", async function (assert) {
@@ -487,7 +489,7 @@ acceptance("User Status - user menu", function (needs) {
await click(".header-dropdown-toggle.current-user button");
await click("#user-menu-button-profile");
- assert.notOk(exists("li.set-user-status"));
+ assert.dom("li.set-user-status").doesNotExist();
});
test("shows the user status button on the menu when enabled in settings", async function (assert) {
@@ -541,6 +543,6 @@ acceptance("User Status - user menu", function (needs) {
await click("#user-menu-button-profile");
await click(".set-user-status button");
- assert.notOk(exists(".user-menu"));
+ assert.dom(".user-menu").doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-test.js
index 36b268f193f..4907470084a 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-test.js
@@ -251,7 +251,7 @@ acceptance("User - Notification level dropdown visibility", function (needs) {
test("Notification level button is not rendered for user who cannot mute or ignore another user", async function (assert) {
await visit("/u/charlie");
- assert.notOk(exists(".user-notifications-dropdown"));
+ assert.dom(".user-notifications-dropdown").doesNotExist();
});
});
@@ -335,7 +335,7 @@ acceptance(
);
await notificationLevelDropdown.selectRowByValue("changeToIgnored");
- assert.ok(exists(".ignore-duration-with-username-modal"));
+ assert.dom(".ignore-duration-with-username-modal").exists();
const durationDropdown = selectKit(
".ignore-duration-with-username-modal .future-date-input-selector"
@@ -391,16 +391,14 @@ acceptance("User - Logout", function (needs) {
await visit("/u/eviltrout");
await publishToMessageBus("/logout/19");
- assert.ok(exists(".dialog-body"));
+ assert.dom(".dialog-body").exists();
assert.ok(
!exists(".dialog-footer .btn-default"),
"no cancel button present"
);
- assert.strictEqual(
- query(".dialog-footer .btn-primary").innerText,
- I18n.t("house"),
- "primary dialog button is present"
- );
+ assert
+ .dom(".dialog-footer .btn-primary")
+ .hasText(I18n.t("house"), "primary dialog button is present");
await click(".dialog-overlay");
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/activation-controls-test.js b/app/assets/javascripts/discourse/tests/integration/components/activation-controls-test.js
index 758d0a7d5ba..bac2ad2a09d 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/activation-controls-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/activation-controls-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 { exists } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | activation-controls", function (hooks) {
setupRenderingTest(hooks);
@@ -13,6 +12,6 @@ module("Integration | Component | activation-controls", function (hooks) {
await render(hbs``);
- assert.ok(!exists("button.edit-email"));
+ assert.dom("button.edit-email").doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js
index a6bbc66d642..ccba1c2d2ae 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js
@@ -3,7 +3,6 @@ import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
-import { count, exists, query } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | admin-report", function (hooks) {
setupRenderingTest(hooks);
@@ -11,15 +10,9 @@ module("Integration | Component | admin-report", function (hooks) {
test("default", async function (assert) {
await render(hbs``);
- assert.ok(exists(".admin-report.signups"));
-
- assert.ok(exists(".admin-report.signups", "it defaults to table mode"));
-
- assert.strictEqual(
- query(".header .item.report").innerText.trim(),
- "Signups",
- "it has a title"
- );
+ assert.dom(".admin-report.signups").exists();
+ assert.dom(".admin-report-table").exists("defaults to table mode");
+ assert.dom(".header .item.report").hasText("Signups", "has a title");
await click("[data-trigger]");
@@ -27,49 +20,29 @@ module("Integration | Component | admin-report", function (hooks) {
.dom("[data-content]")
.hasText("New account registrations for this period");
- assert.strictEqual(
- query(
- ".admin-report-table thead tr th:first-child .title"
- ).innerText.trim(),
- "Day",
- "it has col headers"
- );
+ assert
+ .dom(".admin-report-table thead tr th:first-child .title")
+ .hasText("Day", "has col headers");
- assert.strictEqual(
- query(
- ".admin-report-table thead tr th:nth-child(2) .title"
- ).innerText.trim(),
- "Count",
- "it has col headers"
- );
+ assert
+ .dom(".admin-report-table thead tr th:nth-child(2) .title")
+ .hasText("Count", "has col headers");
- assert.strictEqual(
- query(
- ".admin-report-table tbody tr:nth-child(1) td:nth-child(1)"
- ).innerText.trim(),
- "June 16, 2018",
- "it has rows"
- );
+ assert
+ .dom(".admin-report-table tbody tr:nth-child(1) td:nth-child(1)")
+ .hasText("June 16, 2018", "has rows");
- assert.strictEqual(
- query(
- ".admin-report-table tbody tr:nth-child(1) td:nth-child(2)"
- ).innerText.trim(),
- "12",
- "it has rows"
- );
+ assert
+ .dom(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)")
+ .hasText("12", "has rows");
- assert.ok(exists(".total-row"), "it has totals");
+ assert.dom(".total-row").exists("has totals");
await click(".admin-report-table-header.y .sort-btn");
- assert.strictEqual(
- query(
- ".admin-report-table tbody tr:nth-child(1) td:nth-child(2)"
- ).innerText.trim(),
- "7",
- "it can sort rows"
- );
+ assert
+ .dom(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)")
+ .hasText("7", "can sort rows");
});
test("options", async function (assert) {
@@ -84,14 +57,12 @@ module("Integration | Component | admin-report", function (hooks) {
hbs``
);
- assert.ok(exists(".pagination"), "it paginates the results");
- assert.strictEqual(
- count(".pagination button"),
- 3,
- "it creates the correct number of pages"
- );
+ assert.dom(".pagination").exists("paginates the results");
+ assert
+ .dom(".pagination button")
+ .exists({ count: 3 }, "creates the correct number of pages");
- assert.notOk(exists(".totals-sample-table"), "it hides totals");
+ assert.dom(".totals-sample-table").doesNotExist("hides totals");
});
test("switch modes", async function (assert) {
@@ -101,26 +72,26 @@ module("Integration | Component | admin-report", function (hooks) {
await click(".mode-btn.chart");
- assert.notOk(exists(".admin-report-table"), "it removes the table");
- assert.ok(exists(".admin-report-chart"), "it shows the chart");
+ assert.dom(".admin-report-table").doesNotExist("removes the table");
+ assert.dom(".admin-report-chart").exists("shows the chart");
});
test("timeout", async function (assert) {
await render(hbs``);
- assert.ok(exists(".alert-error.timeout"), "it displays a timeout error");
+ assert.dom(".alert-error.timeout").exists("displays a timeout error");
});
test("no data", async function (assert) {
await render(hbs``);
- assert.ok(exists(".no-data"), "it displays a no data alert");
+ assert.dom(".no-data").exists("displays a no data alert");
});
test("exception", async function (assert) {
await render(hbs``);
- assert.ok(exists(".alert-error.exception"), "it displays an error");
+ assert.dom(".alert-error.exception").exists("displays an error");
});
test("rate limited", async function (assert) {
@@ -136,27 +107,22 @@ module("Integration | Component | admin-report", function (hooks) {
await render(hbs``);
- assert.ok(
- exists(".alert-error.rate-limited"),
- "it displays a rate limited error"
- );
+ assert
+ .dom(".alert-error.rate-limited")
+ .exists("displays a rate limited error");
});
test("post edits", async function (assert) {
await render(hbs``);
- assert.ok(
- exists(".admin-report.post-edits"),
- "it displays the post edits report"
- );
+ assert
+ .dom(".admin-report.post-edits")
+ .exists("displays the post edits report");
});
test("not found", async function (assert) {
await render(hbs``);
- assert.ok(
- exists(".alert-error.not-found"),
- "it displays a not found error"
- );
+ assert.dom(".alert-error.not-found").exists("displays a not found error");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/badge-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/badge-button-test.js
index e68d3231646..929a9fd295f 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/badge-button-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/badge-button-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 { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { query } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | badge-button", function (hooks) {
setupRenderingTest(hooks);
@@ -12,7 +12,7 @@ module("Integration | Component | badge-button", function (hooks) {
await render(hbs``);
- assert.ok(exists(".user-badge.disabled"));
+ assert.dom(".user-badge.disabled").exists();
});
test("enabled badge", async function (assert) {
@@ -20,7 +20,7 @@ module("Integration | Component | badge-button", function (hooks) {
await render(hbs``);
- assert.notOk(exists(".user-badge.disabled"));
+ assert.dom(".user-badge.disabled").doesNotExist();
});
test("data-badge-name", async function (assert) {
@@ -28,7 +28,7 @@ module("Integration | Component | badge-button", function (hooks) {
await render(hbs``);
- assert.ok(exists('.user-badge[data-badge-name="foo"]'));
+ assert.dom('.user-badge[data-badge-name="foo"]').exists();
});
test("title", async function (assert) {
@@ -56,7 +56,7 @@ module("Integration | Component | badge-button", function (hooks) {
await render(hbs``);
- assert.ok(exists(".d-icon.d-icon-xmark"));
+ assert.dom(".d-icon.d-icon-xmark").exists();
});
test("accepts block", async function (assert) {
@@ -68,7 +68,7 @@ module("Integration | Component | badge-button", function (hooks) {
`);
- assert.ok(exists(".test"));
+ assert.dom(".test").exists();
});
test("badgeTypeClassName", async function (assert) {
@@ -76,6 +76,6 @@ module("Integration | Component | badge-button", function (hooks) {
await render(hbs``);
- assert.ok(exists(".user-badge.foo"));
+ assert.dom(".user-badge.foo").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/bookmark-icon-test.js b/app/assets/javascripts/discourse/tests/integration/components/bookmark-icon-test.js
index a5a1567c94d..82355059c3f 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/bookmark-icon-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/bookmark-icon-test.js
@@ -48,7 +48,7 @@ module("Integration | Component | bookmark-icon", function (hooks) {
await render(hbs``);
- assert.ok(exists(".d-icon-bookmark.bookmark-icon__bookmarked"));
+ assert.dom(".d-icon-bookmark.bookmark-icon__bookmarked").exists();
assert.strictEqual(
query(".svg-icon-title").title,
I18n.t("bookmarks.created_generic", {
@@ -64,7 +64,7 @@ module("Integration | Component | bookmark-icon", function (hooks) {
await render(hbs``);
- assert.ok(exists(".d-icon-bookmark.bookmark-icon"));
+ assert.dom(".d-icon-bookmark.bookmark-icon").exists();
assert.strictEqual(
query(".svg-icon-title").title,
I18n.t("bookmarks.create")
diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js
index ac4d1c36348..0454b8fd2bf 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js
@@ -135,7 +135,7 @@ module("Integration | Component | d-button", function (hooks) {
translatedAriaLabel: "bar",
});
- assert.strictEqual(query("button").getAttribute("aria-label"), "bar");
+ assert.dom("button").hasAttribute("aria-label", "bar");
});
test("title", async function (assert) {
@@ -156,7 +156,7 @@ module("Integration | Component | d-button", function (hooks) {
translatedTitle: "bar",
});
- assert.strictEqual(query("button").getAttribute("title"), "bar");
+ assert.dom("button").hasAttribute("title", "bar");
});
test("label", async function (assert) {
@@ -168,35 +168,32 @@ module("Integration | Component | d-button", function (hooks) {
this.set("label", "test.fooLabel");
- assert.strictEqual(
- query("button .d-button-label").innerText,
- I18n.t("test.fooLabel")
- );
+ assert.dom("button .d-button-label").hasText(I18n.t("test.fooLabel"));
this.setProperties({
label: null,
translatedLabel: "bar",
});
- assert.strictEqual(query("button .d-button-label").innerText, "bar");
+ assert.dom("button .d-button-label").hasText("bar");
});
test("aria-expanded", async function (assert) {
await render(hbs``);
- assert.strictEqual(query("button").getAttribute("aria-expanded"), null);
+ assert.dom("button").doesNotHaveAria("expanded");
this.set("ariaExpanded", true);
- assert.strictEqual(query("button").getAttribute("aria-expanded"), "true");
+ assert.dom("button").hasAria("expanded", "true");
this.set("ariaExpanded", false);
- assert.strictEqual(query("button").getAttribute("aria-expanded"), "false");
+ assert.dom("button").hasAria("expanded", "false");
this.set("ariaExpanded", "false");
- assert.strictEqual(query("button").getAttribute("aria-expanded"), null);
+ assert.dom("button").doesNotHaveAria("expanded");
this.set("ariaExpanded", "true");
- assert.strictEqual(query("button").getAttribute("aria-expanded"), null);
+ assert.dom("button").doesNotHaveAria("expanded");
});
test("aria-controls", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js
index 6bb6a7eb239..40ef89b4c68 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js
@@ -13,12 +13,7 @@ import { withPluginApi } from "discourse/lib/plugin-api";
import { setCaretPosition } from "discourse/lib/utilities";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper";
-import {
- exists,
- paste,
- query,
- queryAll,
-} from "discourse/tests/helpers/qunit-helpers";
+import { paste, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
import {
getTextareaSelection,
setTextareaSelection,
@@ -31,7 +26,7 @@ module("Integration | Component | d-editor", function (hooks) {
test("preview updates with markdown", async function (assert) {
await render(hbs``);
- assert.ok(exists(".d-editor-button-bar"));
+ assert.dom(".d-editor-button-bar").exists();
await fillIn(".d-editor-input", "hello **world**");
assert.strictEqual(this.value, "hello **world**");
@@ -749,8 +744,8 @@ third line`
await render(hbs``);
- assert.ok(exists(".d-editor-button-bar button.shown"));
- assert.notOk(exists(".d-editor-button-bar button.not-shown"));
+ assert.dom(".d-editor-button-bar button.shown").exists();
+ assert.dom(".d-editor-button-bar button.not-shown").doesNotExist();
});
test("toolbar buttons tabindex", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-toggle-switch-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-toggle-switch-test.js
index 56d2bab7ce8..f68a879a06e 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/d-toggle-switch-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/d-toggle-switch-test.js
@@ -36,7 +36,7 @@ module("Integration | Component | d-toggle-switch", function (hooks) {
this.set("state", true);
await render(hbs``);
- assert.ok(exists(".d-toggle-switch__checkbox-slider .d-icon-check"));
+ assert.dom(".d-toggle-switch__checkbox-slider .d-icon-check").exists();
});
test("it renders a label for the button", async function (assert) {
@@ -48,19 +48,15 @@ module("Integration | Component | d-toggle-switch", function (hooks) {
this.set("label", "test.fooLabel");
- assert.strictEqual(
- query(".d-toggle-switch__checkbox-label").innerText,
- I18n.t("test.fooLabel")
- );
+ assert
+ .dom(".d-toggle-switch__checkbox-label")
+ .hasText(I18n.t("test.fooLabel"));
this.setProperties({
label: null,
translatedLabel: "bar",
});
- assert.strictEqual(
- query(".d-toggle-switch__checkbox-label").innerText,
- "bar"
- );
+ assert.dom(".d-toggle-switch__checkbox-label").hasText("bar");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/dialog-holder-test.js b/app/assets/javascripts/discourse/tests/integration/components/dialog-holder-test.js
index 912556ef807..ffcfc38af4a 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/dialog-holder-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/dialog-holder-test.js
@@ -23,11 +23,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
test("basics", async function (assert) {
await render(hbs``);
assert.ok(query("#dialog-holder"), "element is in DOM");
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog is empty by default"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog is empty by default");
this.dialog.alert({
message: "This is an error",
@@ -35,11 +31,9 @@ module("Integration | Component | dialog-holder", function (hooks) {
await settled();
assert.true(query(".dialog-overlay").offsetWidth > 0, "overlay is visible");
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "This is an error",
- "dialog has error message"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("This is an error", "dialog has error message");
// dismiss by clicking on overlay
await click(".dialog-overlay");
@@ -50,22 +44,14 @@ module("Integration | Component | dialog-holder", function (hooks) {
0,
"overlay is not visible"
);
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog is empty"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog is empty");
});
test("basics - dismiss using Esc", async function (assert) {
let cancelCallbackCalled = false;
await render(hbs``);
assert.ok(query("#dialog-holder"), "element is in DOM");
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog is empty by default"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog is empty by default");
this.dialog.alert({
message: "This is an error",
@@ -76,11 +62,9 @@ module("Integration | Component | dialog-holder", function (hooks) {
await settled();
assert.true(query(".dialog-overlay").offsetWidth > 0, "overlay is visible");
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "This is an error",
- "dialog has error message"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("This is an error", "dialog has error message");
// dismiss by pressing Esc
await triggerKeyEvent(document.activeElement, "keydown", "Escape");
@@ -94,11 +78,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
"overlay is not visible"
);
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog is empty"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog is empty");
});
test("alert with title", async function (assert) {
@@ -111,11 +91,9 @@ module("Integration | Component | dialog-holder", function (hooks) {
await settled();
- assert.strictEqual(
- query("#dialog-title").innerText.trim(),
- "And this is a title",
- "dialog has title"
- );
+ assert
+ .dom("#dialog-title")
+ .hasText("And this is a title", "dialog has title");
assert.ok(
query("#dialog-holder[aria-labelledby='dialog-title']"),
@@ -124,11 +102,9 @@ module("Integration | Component | dialog-holder", function (hooks) {
assert.ok(query(".dialog-close"), "close button present");
assert.ok(query("#dialog-holder"), "element is still in DOM");
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "This is a note.",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("This is a note.", "dialog message is shown");
await click(".dialog-close");
@@ -138,11 +114,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
0,
"overlay is not visible"
);
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog is empty"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog is empty");
});
test("alert with a string parameter", async function (assert) {
@@ -151,11 +123,9 @@ module("Integration | Component | dialog-holder", function (hooks) {
this.dialog.alert("An alert message");
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "An alert message",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("An alert message", "dialog message is shown");
});
test("confirm", async function (assert) {
@@ -174,34 +144,27 @@ module("Integration | Component | dialog-holder", function (hooks) {
});
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "A confirm message",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("A confirm message", "dialog message is shown");
- assert.strictEqual(
- query(".dialog-footer .btn-primary").innerText.trim(),
- I18n.t("ok_value"),
- "dialog primary button says Ok"
- );
+ assert
+ .dom(".dialog-footer .btn-primary")
+ .hasText(I18n.t("ok_value"), "dialog primary button says Ok");
- assert.strictEqual(
- query(".dialog-footer .btn-default").innerText.trim(),
- I18n.t("cancel_value"),
- "dialog second button is present and says No"
- );
+ assert
+ .dom(".dialog-footer .btn-default")
+ .hasText(
+ I18n.t("cancel_value"),
+ "dialog second button is present and says No"
+ );
await click(".dialog-footer .btn-primary");
assert.ok(confirmCallbackCalled, "confirm callback called");
assert.notOk(cancelCallbackCalled, "cancel callback NOT called");
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog is empty"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog is empty");
});
test("cancel callback", async function (assert) {
@@ -221,21 +184,15 @@ module("Integration | Component | dialog-holder", function (hooks) {
});
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "A confirm message",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("A confirm message", "dialog message is shown");
await click(".dialog-footer .btn-default");
assert.notOk(confirmCallbackCalled, "confirm callback NOT called");
assert.ok(cancelCallbackCalled, "cancel callback called");
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog has been dismissed"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog has been dismissed");
});
test("yes/no confirm", async function (assert) {
@@ -244,23 +201,20 @@ module("Integration | Component | dialog-holder", function (hooks) {
this.dialog.yesNoConfirm({ message: "A yes/no confirm message" });
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "A yes/no confirm message",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("A yes/no confirm message", "dialog message is shown");
- assert.strictEqual(
- query(".dialog-footer .btn-primary").innerText.trim(),
- I18n.t("yes_value"),
- "dialog primary button says Yes"
- );
+ assert
+ .dom(".dialog-footer .btn-primary")
+ .hasText(I18n.t("yes_value"), "dialog primary button says Yes");
- assert.strictEqual(
- query(".dialog-footer .btn-default").innerText.trim(),
- I18n.t("no_value"),
- "dialog second button is present and says No"
- );
+ assert
+ .dom(".dialog-footer .btn-default")
+ .hasText(
+ I18n.t("no_value"),
+ "dialog second button is present and says No"
+ );
});
test("alert with custom buttons", async function (assert) {
@@ -285,17 +239,13 @@ module("Integration | Component | dialog-holder", function (hooks) {
});
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "An alert with custom buttons",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("An alert with custom buttons", "dialog message is shown");
- assert.strictEqual(
- query(".dialog-footer .btn-danger").innerText.trim(),
- "Danger ahead",
- "dialog custom button is present"
- );
+ assert
+ .dom(".dialog-footer .btn-danger")
+ .hasText("Danger ahead", "dialog custom button is present");
assert.notOk(
query(".dialog-footer .btn-primary"),
@@ -309,11 +259,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
await click(".dialog-footer .btn-danger");
assert.ok(customCallbackTriggered, "custom action was triggered");
- assert.strictEqual(
- query("#dialog-holder").innerText.trim(),
- "",
- "dialog has been dismissed"
- );
+ assert.dom("#dialog-holder").hasText("", "dialog has been dismissed");
});
test("alert with custom classes", async function (assert) {
@@ -325,11 +271,9 @@ module("Integration | Component | dialog-holder", function (hooks) {
});
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "An alert with custom classes",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("An alert with custom classes", "dialog message is shown");
assert.ok(
query("#dialog-holder.dialog-special.dialog-super"),
@@ -355,11 +299,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
this.dialog.notice("Noted!");
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "Noted!",
- "message is shown"
- );
+ assert.dom(".dialog-body").hasText("Noted!", "message is shown");
assert.notOk(query(".dialog-footer"), "no footer");
assert.notOk(query(".dialog-header"), "no header");
@@ -371,17 +311,16 @@ module("Integration | Component | dialog-holder", function (hooks) {
this.dialog.deleteConfirm({ message: "A delete confirm message" });
await settled();
- assert.strictEqual(
- query(".dialog-body").innerText.trim(),
- "A delete confirm message",
- "dialog message is shown"
- );
+ assert
+ .dom(".dialog-body")
+ .hasText("A delete confirm message", "dialog message is shown");
- assert.strictEqual(
- query(".dialog-footer .btn-danger").innerText.trim(),
- I18n.t("delete"),
- "dialog primary button use danger class and label is Delete"
- );
+ assert
+ .dom(".dialog-footer .btn-danger")
+ .hasText(
+ I18n.t("delete"),
+ "dialog primary button use danger class and label is Delete"
+ );
assert.notOk(
query(".dialog-footer .btn-primary"),
@@ -398,11 +337,11 @@ module("Integration | Component | dialog-holder", function (hooks) {
});
await settled();
- assert.strictEqual(query(".btn-danger").disabled, true);
+ assert.dom(".btn-danger").isDisabled();
await fillIn("#confirm-phrase", "Disa");
- assert.strictEqual(query(".btn-danger").disabled, true);
+ assert.dom(".btn-danger").isDisabled();
await fillIn("#confirm-phrase", "Disable");
- assert.strictEqual(query(".btn-danger").disabled, false);
+ assert.dom(".btn-danger").isEnabled();
});
test("delete confirm with a component and model", async function (assert) {
@@ -417,8 +356,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
});
await settled();
- assert.strictEqual(
- query(".dialog-body p:first-child").innerText.trim(),
+ assert.dom(".dialog-body p:first-child").hasText(
I18n.t("admin.groups.delete_with_messages_confirm", {
count: message_count,
}),
diff --git a/app/assets/javascripts/discourse/tests/integration/components/empty-state-test.js b/app/assets/javascripts/discourse/tests/integration/components/empty-state-test.js
index baf95c91214..404cf475399 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/empty-state-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/empty-state-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 { query } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | empty-state", function (hooks) {
setupRenderingTest(hooks);
@@ -10,7 +9,7 @@ module("Integration | Component | empty-state", function (hooks) {
test("it renders", async function (assert) {
await render(hbs``);
- assert.strictEqual(query("[data-test-title]").textContent, "title");
- assert.strictEqual(query("[data-test-body]").textContent, "body");
+ assert.dom("[data-test-title]").hasText("title");
+ assert.dom("[data-test-body]").hasText("body");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js b/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js
index 989427ed082..4f7a2ae0ff9 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js
@@ -4,7 +4,7 @@ import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
-import { exists, 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 | invite-panel", function (hooks) {
@@ -31,7 +31,7 @@ module("Integration | Component | invite-panel", function (hooks) {
await input.expand();
await input.fillInFilter("eviltrout@example.com");
await input.selectRowByValue("eviltrout@example.com");
- assert.ok(!exists(".send-invite:disabled"));
+ assert.dom(".send-invite:disabled").doesNotExist();
await click(".generate-invite-link");
assert.strictEqual(
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js
index cbc2c2a459c..1c75c95869c 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js
@@ -100,7 +100,7 @@ module("Integration | Component | select-kit/api", function (hooks) {
await this.comboBox.expand();
await this.comboBox.selectRowByIndex(0);
- assert.strictEqual(query("#test").innerText, "foo");
+ assert.dom("#test").hasText("foo");
});
test("modifySelectKit(identifier).replaceContent", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.js
index 290572911cb..bf192214cf5 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.js
@@ -109,7 +109,7 @@ module(
await this.subject.expand();
await fillIn(".filter-input", "test-user");
- assert.notOk(exists(".user-status-message"));
+ assert.dom(".user-status-message").doesNotExist();
});
test("shows user status if enabled", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js b/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js
index 10961cbe756..96f8c9608db 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js
@@ -45,7 +45,7 @@ module("Integration | Component | sidebar | section-link", function (hooks) {
const template = hbs``;
await render(template);
- assert.strictEqual(query("a").target, "_self");
+ assert.dom("a").hasAttribute("target", "_self");
});
test("target attribute for link when user set external links in new tab", async function (assert) {
@@ -53,6 +53,6 @@ module("Integration | Component | sidebar | section-link", function (hooks) {
const template = hbs``;
await render(template);
- assert.strictEqual(query("a").target, "_blank");
+ assert.dom("a").hasAttribute("target", "_blank");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.js b/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.js
index 3b757c733aa..8450d55bfeb 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.js
@@ -18,7 +18,7 @@ module("Integration | Component | site-setting", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".formatted-selection").innerText, "a.com, b.com");
+ assert.dom(".formatted-selection").hasText("a.com, b.com");
});
test("Error response with html_message is rendered as HTML", async function (assert) {
@@ -58,7 +58,7 @@ module("Integration | Component | site-setting", function (hooks) {
await fillIn(query(".setting input"), "value");
await click(query(".setting .d-icon-check"));
- assert.strictEqual(query(".validation-error h1"), null);
+ assert.dom(".validation-error h1").doesNotExist();
});
test("displays file types list setting", async function (assert) {
@@ -70,24 +70,19 @@ module("Integration | Component | site-setting", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query(".formatted-selection").innerText,
- "jpg, jpeg, png"
- );
+ assert.dom(".formatted-selection").hasText("jpg, jpeg, png");
await click(query(".file-types-list__button.image"));
- assert.strictEqual(
- query(".formatted-selection").innerText,
- "jpg, jpeg, png, gif, heic, heif, webp, avif, svg"
- );
+ assert
+ .dom(".formatted-selection")
+ .hasText("jpg, jpeg, png, gif, heic, heif, webp, avif, svg");
await click(query(".file-types-list__button.image"));
- assert.strictEqual(
- query(".formatted-selection").innerText,
- "jpg, jpeg, png, gif, heic, heif, webp, avif, svg"
- );
+ assert
+ .dom(".formatted-selection")
+ .hasText("jpg, jpeg, png, gif, heic, heif, webp, avif, svg");
});
// Skipping for now because ember-test-helpers doesn't check for defaultPrevented when firing that event chain
diff --git a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js
index 1cacf207a55..b63b71098b6 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js
@@ -3,7 +3,6 @@ import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import sinon from "sinon";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
-import { exists, query } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
module("Integration | Component | text-field", function (hooks) {
@@ -12,7 +11,7 @@ module("Integration | Component | text-field", function (hooks) {
test("renders correctly with no properties set", async function (assert) {
await render(hbs``);
- assert.ok(exists("input[type=text]"));
+ assert.dom("input[type=text]").exists();
});
test("support a placeholder", async function (assert) {
@@ -20,8 +19,8 @@ module("Integration | Component | text-field", function (hooks) {
await render(hbs``);
- assert.ok(exists("input[type=text]"));
- assert.strictEqual(query("input").placeholder, "placeholder.i18n.key");
+ assert.dom("input[type=text]").exists();
+ assert.dom("input").hasAttribute("placeholder", "placeholder.i18n.key");
});
test("sets the dir attribute to auto when mixed text direction enabled", 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.js
index bf39fb01c27..3b5781fb864 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
@@ -96,11 +96,12 @@ module("Integration | Component | themes-list", function (hooks) {
1,
"shows one entry with a message when there is nothing to display"
);
- assert.strictEqual(
- query(".themes-list-container__item span.empty").innerText.trim(),
- I18n.t("admin.customize.theme.empty"),
- "displays the right message"
- );
+ assert
+ .dom(".themes-list-container__item span.empty")
+ .hasText(
+ I18n.t("admin.customize.theme.empty"),
+ "displays the right message"
+ );
});
test("current tab is components", async function (assert) {
@@ -147,11 +148,12 @@ module("Integration | Component | themes-list", function (hooks) {
1,
"shows one entry with a message when there is nothing to display"
);
- assert.strictEqual(
- query(".themes-list-container__item span.empty").innerText.trim(),
- I18n.t("admin.customize.theme.empty"),
- "displays the right message"
- );
+ assert
+ .dom(".themes-list-container__item span.empty")
+ .hasText(
+ I18n.t("admin.customize.theme.empty"),
+ "displays the right message"
+ );
});
test("themes search is not visible when there are less than 10 themes", async function (assert) {
@@ -184,7 +186,7 @@ module("Integration | Component | themes-list", function (hooks) {
hbs``
);
- assert.ok(exists(".themes-list-search__input"));
+ assert.dom(".themes-list-search__input").exists();
await fillIn(".themes-list-search__input", " oSAma ");
assert.deepEqual(
[...queryAll(".themes-list-container__item .info .name")].map((node) =>
@@ -237,7 +239,7 @@ module("Integration | Component | themes-list", function (hooks) {
hbs``
);
- assert.ok(exists(".themes-list-filter__input"));
+ assert.dom(".themes-list-filter__input").exists();
assert.deepEqual(themeNames(), [
"Theme enabled 1",
"Theme enabled 2",
@@ -327,7 +329,7 @@ module("Integration | Component | themes-list", function (hooks) {
.filter((name) => !name.includes("OtherComponent"));
}
- assert.ok(exists(".themes-list-filter__input"));
+ assert.dom(".themes-list-filter__input").exists();
assert.deepEqual(componentNames(), [
"Component used 1",
"Component used 2",
diff --git a/app/assets/javascripts/discourse/tests/integration/components/time-shortcut-picker-test.js b/app/assets/javascripts/discourse/tests/integration/components/time-shortcut-picker-test.js
index 5202ba4d667..991d4f674d2 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/time-shortcut-picker-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/time-shortcut-picker-test.js
@@ -130,8 +130,8 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
await render(hbs``);
await click("#tap_tile_custom");
- assert.strictEqual(query("#custom-date > input").value, "2100-12-11");
- assert.strictEqual(query("#custom-time").value, "18:00");
+ assert.dom("#custom-date > input").hasValue("2100-12-11");
+ assert.dom("#custom-time").hasValue("18:00");
});
test("shows 'Next Monday' instead of 'Monday' on Sundays", async function (assert) {
@@ -140,10 +140,9 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query("#tap_tile_start_of_next_business_week .tap-tile-title").innerText,
- "Next Monday"
- );
+ assert
+ .dom("#tap_tile_start_of_next_business_week .tap-tile-title")
+ .hasText("Next Monday");
assert.strictEqual(
query("div#tap_tile_start_of_next_business_week div.tap-tile-date")
@@ -158,10 +157,9 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query("#tap_tile_start_of_next_business_week .tap-tile-title").innerText,
- "Next Monday"
- );
+ assert
+ .dom("#tap_tile_start_of_next_business_week .tap-tile-title")
+ .hasText("Next Monday");
assert.strictEqual(
query("div#tap_tile_start_of_next_business_week div.tap-tile-date")
@@ -179,9 +177,8 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query("div#tap_tile_next_month div.tap-tile-date").innerText,
- "Feb 1, 8:00 am"
- );
+ assert
+ .dom("div#tap_tile_next_month div.tap-tile-date")
+ .hasText("Feb 1, 8:00 am");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js
index c324a22b7c7..e815428cf66 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js
@@ -13,8 +13,8 @@ module("Integration | Component | user-info", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".name").innerText.trim(), "Evil Trout");
- assert.strictEqual(query(".username").innerText.trim(), "eviltrout");
+ assert.dom(".name").hasText("Evil Trout");
+ assert.dom(".username").hasText("eviltrout");
});
test("prioritized username", async function (assert) {
@@ -23,8 +23,8 @@ module("Integration | Component | user-info", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".username").innerText.trim(), "eviltrout");
- assert.strictEqual(query(".name").innerText.trim(), "Evil Trout");
+ assert.dom(".username").hasText("eviltrout");
+ assert.dom(".name").hasText("Evil Trout");
});
test("includeLink", async function (assert) {
@@ -47,10 +47,10 @@ module("Integration | Component | user-info", function (hooks) {
);
this.set("includeAvatar", true);
- assert.ok(exists(".user-image"));
+ assert.dom(".user-image").exists();
this.set("includeAvatar", false);
- assert.notOk(exists(".user-image"));
+ assert.dom(".user-image").doesNotExist();
});
test("shows status if enabled and user has status", async function (assert) {
@@ -61,7 +61,7 @@ module("Integration | Component | user-info", function (hooks) {
hbs``
);
- assert.ok(exists(".user-status-message"));
+ assert.dom(".user-status-message").exists();
});
test("doesn't show status if enabled but user doesn't have status", async function (assert) {
@@ -71,7 +71,7 @@ module("Integration | Component | user-info", function (hooks) {
hbs``
);
- assert.notOk(exists(".user-status-message"));
+ assert.dom(".user-status-message").doesNotExist();
});
test("doesn't show status if disabled", async function (assert) {
@@ -82,7 +82,7 @@ module("Integration | Component | user-info", function (hooks) {
hbs``
);
- assert.notOk(exists(".user-status-message"));
+ assert.dom(".user-status-message").doesNotExist();
});
test("doesn't show status by default", async function (assert) {
@@ -91,7 +91,7 @@ module("Integration | Component | user-info", function (hooks) {
await render(hbs``);
- assert.notOk(exists(".user-status-message"));
+ assert.dom(".user-status-message").doesNotExist();
});
test("doesn't show status description by default", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-item-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-item-test.js
index b243b5c074f..23e1ec2f5dc 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-item-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-item-test.js
@@ -62,8 +62,8 @@ module(
);
this.item.notification.read = false;
await render(template);
- assert.notOk(exists("li.read"));
- assert.ok(exists("li.unread"));
+ assert.dom("li.read").doesNotExist();
+ assert.dom("li.unread").exists();
this.item.notification.read = true;
await settled();
@@ -109,7 +109,7 @@ module(
})
);
await render(template);
- assert.ok(exists("li.is-warning"));
+ assert.dom("li.is-warning").exists();
});
test("doesn't push is-warning to the classList if the notification doesn't originate from a warning PM", async function (assert) {
@@ -118,8 +118,8 @@ module(
getNotification(this.currentUser, this.siteSettings, this.site)
);
await render(template);
- assert.ok(!exists("li.is-warning"));
- assert.ok(exists("li"));
+ assert.dom("li.is-warning").doesNotExist();
+ assert.dom("li").exists();
});
test("the item's href links to the topic that the notification originates from", async function (assert) {
@@ -574,8 +574,8 @@ module(
})
);
await render(template);
- assert.ok(!exists("li.reviewed"));
- assert.ok(exists("li"));
+ assert.dom("li.reviewed").doesNotExist();
+ assert.dom("li").exists();
});
test("pushes `reviewed` to the classList if the reviewable isn't pending", async function (assert) {
@@ -586,7 +586,7 @@ module(
})
);
await render(template);
- assert.ok(exists("li.reviewed"));
+ assert.dom("li.reviewed").exists();
});
test("has elements for label and description", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-test.js
index 21d17ddb392..2d190672e6c 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-menu/menu-test.js
@@ -4,7 +4,7 @@ import { module, test } from "qunit";
import { NOTIFICATION_TYPES } from "discourse/tests/fixtures/concerns/notification-types";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender from "discourse/tests/helpers/create-pretender";
-import { exists, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
+import { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | user-menu", function (hooks) {
setupRenderingTest(hooks);
@@ -67,7 +67,7 @@ module("Integration | Component | user-menu", function (hooks) {
this.currentUser.set("user_option.likes_notifications_disabled", true);
this.currentUser.set("can_send_private_messages", true);
await render(template);
- assert.ok(!exists("#user-menu-button-likes"));
+ assert.dom("#user-menu-button-likes").doesNotExist();
const tabs = Array.from(queryAll(".tabs-list .btn")); // top and bottom tabs
assert.strictEqual(tabs.length, 6);
@@ -101,7 +101,7 @@ module("Integration | Component | user-menu", function (hooks) {
this.currentUser.set("can_review", true);
this.currentUser.set("reviewable_count", 0);
await render(template);
- assert.notOk(exists("#user-menu-button-review-queue"));
+ assert.dom("#user-menu-button-review-queue").doesNotExist();
});
test("messages tab isn't shown if current user does not have can_send_private_messages permission", async function (assert) {
@@ -112,7 +112,7 @@ module("Integration | Component | user-menu", function (hooks) {
await render(template);
- assert.ok(!exists("#user-menu-button-messages"));
+ assert.dom("#user-menu-button-messages").doesNotExist();
const tabs = Array.from(queryAll(".tabs-list .btn")); // top and bottom tabs
assert.strictEqual(tabs.length, 6);
@@ -132,7 +132,7 @@ module("Integration | Component | user-menu", function (hooks) {
await render(template);
- assert.ok(exists("#user-menu-button-messages"));
+ assert.dom("#user-menu-button-messages").exists();
});
test("reviewables count is shown on the reviewables tab", async function (assert) {
@@ -147,7 +147,9 @@ module("Integration | Component | user-menu", function (hooks) {
this.currentUser.set("reviewable_count", 0);
await settled();
- assert.ok(!exists("#user-menu-button-review-queue .badge-notification"));
+ assert
+ .dom("#user-menu-button-review-queue .badge-notification")
+ .doesNotExist();
});
test("changing tabs", async function (assert) {
@@ -261,7 +263,7 @@ module("Integration | Component | user-menu", function (hooks) {
});
await click("#user-menu-button-likes");
- assert.ok(exists("#quick-access-likes.quick-access-panel"));
+ assert.dom("#quick-access-likes.quick-access-panel").exists();
assert.strictEqual(
queryParams.filter_by_types,
"liked,liked_consolidated,reaction",
@@ -278,7 +280,7 @@ module("Integration | Component | user-menu", function (hooks) {
assert.strictEqual(queryAll("#quick-access-likes ul li").length, 3);
await click("#user-menu-button-replies");
- assert.ok(exists("#quick-access-replies.quick-access-panel"));
+ assert.dom("#quick-access-replies.quick-access-panel").exists();
assert.strictEqual(
queryParams.filter_by_types,
"mentioned,group_mentioned,posted,quoted,replied",
@@ -294,7 +296,7 @@ module("Integration | Component | user-menu", function (hooks) {
);
await click("#user-menu-button-review-queue");
- assert.ok(exists("#quick-access-review-queue.quick-access-panel"));
+ assert.dom("#quick-access-review-queue.quick-access-panel").exists();
activeTabs = queryAll(".top-tabs .btn.active");
assert.strictEqual(activeTabs.length, 1);
assert.strictEqual(
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-menu/notifications-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-menu/notifications-list-test.js
index 8f265ff904d..c861da8098f 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-menu/notifications-list-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-menu/notifications-list-test.js
@@ -47,8 +47,8 @@ module(
test("empty state when there are no notifications", async function (assert) {
notificationsData.clear();
await render(template);
- assert.ok(exists(".empty-state .empty-state-title"));
- assert.ok(exists(".empty-state .empty-state-body"));
+ assert.dom(".empty-state .empty-state-title").exists();
+ assert.dom(".empty-state .empty-state-body").exists();
});
test("doesn't set filter_by_types in the params of the request that fetches the notifications", async function (assert) {
@@ -100,7 +100,9 @@ module(
notification.read = true;
});
await render(template);
- assert.ok(!exists(".panel-body-bottom .btn.notifications-dismiss"));
+ assert
+ .dom(".panel-body-bottom .btn.notifications-dismiss")
+ .doesNotExist();
});
test("dismiss button makes a request to the server and then refreshes the notifications list", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-menu/other-notifications-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-menu/other-notifications-list-test.js
index 49b2f104b8b..fbc41a9ca79 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-menu/other-notifications-list-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-menu/other-notifications-list-test.js
@@ -3,7 +3,7 @@ import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
-import { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { query } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
module(
@@ -21,7 +21,7 @@ module(
test("empty state when there are no notifications", async function (assert) {
await render(template);
- assert.ok(exists(".empty-state .empty-state-body"));
+ assert.dom(".empty-state .empty-state-body").exists();
assert.strictEqual(
query(".empty-state .empty-state-title").textContent.trim(),
I18n.t("user.no_other_notifications_title")
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-menu/replies-notifications-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-menu/replies-notifications-list-test.js
index f342f11b2b2..99fac0669c8 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-menu/replies-notifications-list-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-menu/replies-notifications-list-test.js
@@ -3,7 +3,7 @@ import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
-import { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { query } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
module(
@@ -21,7 +21,7 @@ module(
test("empty state when there are no notifications", async function (assert) {
await render(template);
- assert.ok(exists(".empty-state .empty-state-body"));
+ assert.dom(".empty-state .empty-state-body").exists();
assert.strictEqual(
query(".empty-state .empty-state-title").textContent.trim(),
I18n.t("user.no_notifications_title")
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.js
index 35a059cd3cd..2c8301ea81b 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
@@ -62,11 +62,9 @@ module("Integration | Component | value-list", function (hooks) {
await selectKit().expand();
- assert.strictEqual(
- query(".select-kit-collection li.select-kit-row span.name").innerText,
- "vinkas",
- "it adds the removed value to choices"
- );
+ assert
+ .dom(".select-kit-collection li.select-kit-row span.name")
+ .hasText("vinkas", "it adds the removed value to choices");
});
test("selecting a value", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.js
index ea9545329cf..c222ae2131b 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/button-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 { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { exists } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | Widget | button", function (hooks) {
setupRenderingTest(hooks);
@@ -53,10 +53,7 @@ module("Integration | Component | Widget | button", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query("button span.d-button-label").innerText,
- "foo bar"
- );
+ assert.dom("button span.d-button-label").hasText("foo bar");
});
test("translatedTitle", async function (assert) {
@@ -64,7 +61,7 @@ module("Integration | Component | Widget | button", function (hooks) {
await render(hbs``);
- assert.strictEqual(query("button").title, "foo bar");
+ assert.dom("button").hasAttribute("title", "foo bar");
});
test("translatedLabel skips no-text class in icon", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js
index e42f285e16d..1d120e2f902 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js
@@ -18,9 +18,9 @@ module(
hbs``
);
- assert.ok(!exists(".small-action-desc .small-action-delete"));
- assert.ok(!exists(".small-action-desc .small-action-recover"));
- assert.ok(!exists(".small-action-desc .small-action-edit"));
+ assert.dom(".small-action-desc .small-action-delete").doesNotExist();
+ assert.dom(".small-action-desc .small-action-recover").doesNotExist();
+ assert.dom(".small-action-desc .small-action-edit").doesNotExist();
});
test("shows edit button if canEdit", async function (assert) {
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.js
index de35d238c79..05279cd4d9c 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
@@ -185,7 +185,7 @@ module("Integration | Component | Widget | post", function (hooks) {
);
assert.strictEqual(count("button.like-count"), 1);
- assert.ok(!exists(".who-liked"));
+ assert.dom(".who-liked").doesNotExist();
// toggle it on
await click("button.like-count");
@@ -194,8 +194,8 @@ module("Integration | Component | Widget | post", function (hooks) {
// toggle it off
await click("button.like-count");
- assert.ok(!exists(".who-liked"));
- assert.ok(!exists(".who-liked a.trigger-user-card"));
+ assert.dom(".who-liked").doesNotExist();
+ assert.dom(".who-liked a.trigger-user-card").doesNotExist();
});
test("like count with no likes", async function (assert) {
@@ -205,7 +205,7 @@ module("Integration | Component | Widget | post", function (hooks) {
hbs``
);
- assert.ok(!exists("button.like-count"));
+ assert.dom("button.like-count").doesNotExist();
});
test("share button", async function (assert) {
@@ -240,18 +240,18 @@ module("Integration | Component | Widget | post", function (hooks) {
`);
- assert.ok(exists(".actions button.like"));
- assert.ok(!exists(".actions button.like-count"));
+ assert.dom(".actions button.like").exists();
+ assert.dom(".actions button.like-count").doesNotExist();
await click(".actions button.like");
- assert.ok(!exists(".actions button.like"));
- assert.ok(exists(".actions button.has-like"));
+ assert.dom(".actions button.like").doesNotExist();
+ assert.dom(".actions button.has-like").exists();
assert.strictEqual(count(".actions button.like-count"), 1);
await click(".actions button.has-like");
- assert.ok(exists(".actions button.like"));
- assert.ok(!exists(".actions button.has-like"));
- assert.ok(!exists(".actions button.like-count"));
+ assert.dom(".actions button.like").exists();
+ assert.dom(".actions button.has-like").doesNotExist();
+ assert.dom(".actions button.like-count").doesNotExist();
});
test("anon liking", async function (assert) {
@@ -264,8 +264,8 @@ module("Integration | Component | Widget | post", function (hooks) {
`);
- assert.ok(exists(".actions button.like"));
- assert.ok(!exists(".actions button.like-count"));
+ assert.dom(".actions button.like").exists();
+ assert.dom(".actions button.like-count").doesNotExist();
assert.strictEqual(
query("button.like").getAttribute("title"),
@@ -442,7 +442,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(!exists("button.create-flag"));
+ assert.dom("button.create-flag").doesNotExist();
});
test(`flagging: can't flag when post is hidden`, async function (assert) {
@@ -450,7 +450,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(!exists("button.create-flag"));
+ assert.dom("button.create-flag").doesNotExist();
});
test(`read indicator`, async function (assert) {
@@ -458,7 +458,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(exists(".read-state.read"));
+ assert.dom(".read-state.read").exists();
});
test(`unread indicator`, async function (assert) {
@@ -466,7 +466,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(exists(".read-state"));
+ assert.dom(".read-state").exists();
});
test("reply directly above (suppressed)", async function (assert) {
@@ -552,8 +552,8 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(!exists("button.bookmark"));
- assert.ok(!exists("button.bookmarked"));
+ assert.dom("button.bookmark").doesNotExist();
+ assert.dom("button.bookmarked").doesNotExist();
});
test("bookmark", async function (assert) {
@@ -567,7 +567,7 @@ module("Integration | Component | Widget | post", function (hooks) {
`);
assert.strictEqual(count(".post-menu-area .bookmark"), 1);
- assert.ok(!exists("button.bookmarked"));
+ assert.dom("button.bookmarked").doesNotExist();
});
test("can't show admin menu when you can't manage", async function (assert) {
@@ -575,7 +575,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(!exists(".post-menu-area .show-post-admin-menu"));
+ assert.dom(".post-menu-area .show-post-admin-menu").doesNotExist();
});
test("show admin menu", async function (assert) {
@@ -737,7 +737,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(!exists(".post-controls .create"));
+ assert.dom(".post-controls .create").doesNotExist();
});
test("replies - no replies", async function (assert) {
@@ -745,7 +745,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(!exists("button.show-replies"));
+ assert.dom("button.show-replies").doesNotExist();
});
test("replies - multiple replies", async function (assert) {
@@ -763,7 +763,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(!exists("button.show-replies"));
+ assert.dom("button.show-replies").doesNotExist();
});
test("replies - one below, not suppressed", async function (assert) {
@@ -952,8 +952,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query(".post-notice.returning-user:not(.old)").innerText.trim(),
+ assert.dom(".post-notice.returning-user:not(.old)").hasText(
I18n.t("post.notice.returning_user", {
user: "codinghorror",
time: "2 days ago",
@@ -974,10 +973,11 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query(".post-notice.old.new-user").innerText.trim(),
- I18n.t("post.notice.new_user", { user: "Jeff", time: "Jan '10" })
- );
+ assert
+ .dom(".post-notice.old.new-user")
+ .hasText(
+ I18n.t("post.notice.new_user", { user: "Jeff", time: "Jan '10" })
+ );
});
test("show group request in post", async function (assert) {
@@ -1008,7 +1008,7 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.ok(exists(".user-status-message"));
+ assert.dom(".user-status-message").exists();
});
test("doesn't show user status if disabled in site settings", async function (assert) {
@@ -1023,6 +1023,6 @@ module("Integration | Component | Widget | post", function (hooks) {
await render(hbs``);
- assert.notOk(exists(".user-status-message"));
+ assert.dom(".user-status-message").doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-test.js
index cb6b30b717b..14ea46f737c 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-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 { exists, query } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | Widget | poster-name", function (hooks) {
setupRenderingTest(hooks);
@@ -19,11 +18,11 @@ module("Integration | Component | Widget | poster-name", function (hooks) {
hbs``
);
- assert.ok(exists(".names"));
- assert.ok(exists("span.username"));
- assert.ok(exists('a[data-user-card="eviltrout"]'));
- assert.strictEqual(query(".username a").innerText, "eviltrout");
- assert.strictEqual(query(".user-title").innerText, "Trout Master");
+ assert.dom(".names").exists();
+ assert.dom("span.username").exists();
+ assert.dom('a[data-user-card="eviltrout"]').exists();
+ assert.dom(".username a").hasText("eviltrout");
+ assert.dom(".user-title").hasText("Trout Master");
});
test("extra classes and glyphs", async function (assert) {
@@ -41,12 +40,12 @@ module("Integration | Component | Widget | poster-name", function (hooks) {
hbs``
);
- assert.ok(exists("span.staff"));
- assert.ok(exists("span.admin"));
- assert.ok(exists("span.moderator"));
- assert.ok(exists(".d-icon-shield-halved"));
- assert.ok(exists("span.new-user"));
- assert.ok(exists("span.group--fish"));
+ assert.dom("span.staff").exists();
+ assert.dom("span.admin").exists();
+ assert.dom("span.moderator").exists();
+ assert.dom(".d-icon-shield-halved").exists();
+ assert.dom("span.new-user").exists();
+ assert.dom("span.group--fish").exists();
});
test("disable display name on posts", async function (assert) {
@@ -57,7 +56,7 @@ module("Integration | Component | Widget | poster-name", function (hooks) {
hbs``
);
- assert.ok(!exists(".full-name"));
+ assert.dom(".full-name").doesNotExist();
});
test("doesn't render a name if it's similar to the username", async function (assert) {
@@ -69,6 +68,6 @@ module("Integration | Component | Widget | poster-name", function (hooks) {
hbs``
);
- assert.ok(!exists(".second"));
+ assert.dom(".second").doesNotExist();
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js
index 1c8de7153b5..da2c77aa8ea 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js
@@ -4,7 +4,7 @@ import { 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 { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { exists } from "discourse/tests/helpers/qunit-helpers";
import widgetHbs from "discourse/widgets/hbs-compiler";
import RenderGlimmer, {
registerWidgetShim,
@@ -171,19 +171,18 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
assert.true(exists("div.my-widget"), "widget is rendered");
assert.true(exists("div.glimmer-content"), "glimmer content is rendered");
- assert.strictEqual(
- query("div.glimmer-content").innerText,
- "arg1=val1 dynamicArg=",
- "arguments are passed through"
- );
+ assert
+ .dom("div.glimmer-content")
+ .hasText("arg1=val1 dynamicArg=", "arguments are passed through");
await fillIn("input.dynamic-value-input", "somedynamicvalue");
await click(".my-widget button");
- assert.strictEqual(
- query("div.glimmer-content").innerText,
- "arg1=val1 dynamicArg=somedynamicvalue",
- "changed arguments are applied after rerender"
- );
+ assert
+ .dom("div.glimmer-content")
+ .hasText(
+ "arg1=val1 dynamicArg=somedynamicvalue",
+ "changed arguments are applied after rerender"
+ );
});
test("child component lifecycle", async function (assert) {
@@ -281,11 +280,9 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
"widget event has not been triggered yet"
);
- assert.strictEqual(
- query(".action-state").innerText,
- "false",
- "eventTriggered is false in nested component"
- );
+ assert
+ .dom(".action-state")
+ .hasText("false", "eventTriggered is false in nested component");
assert.true(
exists("div.demo-component button"),
@@ -295,11 +292,9 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
await click("div.demo-component button");
assert.true(DemoWidget.actionTriggered, "widget event is triggered");
- assert.strictEqual(
- query(".action-state").innerText,
- "true",
- "eventTriggered is true in nested component"
- );
+ assert
+ .dom(".action-state")
+ .hasText("true", "eventTriggered is true in nested component");
});
test("developer ergonomics", function (assert) {
@@ -328,11 +323,11 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
test("multiple adjacent components", async function (assert) {
await render(hbs``);
- assert.strictEqual(query("div.glimmer-wrapper").innerText, "One");
+ assert.dom("div.glimmer-wrapper").hasText("One");
await click(".toggleButton");
- assert.strictEqual(query("div.glimmer-wrapper").innerText, "Two");
+ assert.dom("div.glimmer-wrapper").hasText("Two");
await click(".toggleButton");
- assert.strictEqual(query("div.glimmer-wrapper").innerText, "One");
+ assert.dom("div.glimmer-wrapper").hasText("One");
});
test("registerWidgetShim can register a fake widget", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-test.js
index 85d41ec5755..f642da5fc28 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-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, exists } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | Widget | small-user-list", function (hooks) {
setupRenderingTest(hooks);
@@ -19,8 +18,8 @@ module("Integration | Component | Widget | small-user-list", function (hooks) {
hbs``
);
- assert.strictEqual(count('[data-user-card="eviltrout"]'), 1);
- assert.ok(!exists('[data-user-card="someone"]'));
- assert.ok(exists(".unknown"), "includes unknown user");
+ assert.dom('[data-user-card="eviltrout"]').exists({ count: 1 });
+ assert.dom('[data-user-card="someone"]').doesNotExist();
+ assert.dom(".unknown").exists("includes unknown user");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.js
index d475ced78e1..90bf460d526 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.js
@@ -20,7 +20,7 @@ module("Integration | Component | Widget | topic-status", function (hooks) {
hbs``
);
- assert.ok(exists(".topic-status .d-icon-lock"));
+ assert.dom(".topic-status .d-icon-lock").exists();
});
test("extendability", async function (assert) {
@@ -41,7 +41,7 @@ module("Integration | Component | Widget | topic-status", function (hooks) {
hbs``
);
- assert.ok(exists(".topic-status .d-icon-far-square-check"));
+ assert.dom(".topic-status .d-icon-far-square-check").exists();
});
test("toggling pin status", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.js
index 5c0a0893a24..bd0041b5cfd 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.js
@@ -70,7 +70,7 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
await render(TEMPLATE);
- assert.ok(exists("#my-dropdown"));
+ assert.dom("#my-dropdown").exists();
});
test("label", async function (assert) {
@@ -123,11 +123,7 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
await toggle();
await clickRowById(2);
- assert.strictEqual(
- query("#test").innerText,
- "2",
- "it calls the onChange actions"
- );
+ assert.dom("#test").hasText("2", "it calls the onChange actions");
});
test("can be opened and closed", async function (assert) {
@@ -135,15 +131,15 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
await render(TEMPLATE);
- assert.ok(exists("#my-dropdown.closed"));
- assert.ok(!exists("#my-dropdown .widget-dropdown-body"));
+ assert.dom("#my-dropdown.closed").exists();
+ assert.dom("#my-dropdown .widget-dropdown-body").doesNotExist();
await toggle();
assert.strictEqual(rowById(2).innerText.trim(), "FooBar");
- assert.ok(exists("#my-dropdown.opened"));
- assert.ok(exists("#my-dropdown .widget-dropdown-body"));
+ assert.dom("#my-dropdown.opened").exists();
+ assert.dom("#my-dropdown .widget-dropdown-body").exists();
await toggle();
- assert.ok(exists("#my-dropdown.closed"));
- assert.ok(!exists("#my-dropdown .widget-dropdown-body"));
+ assert.dom("#my-dropdown.closed").exists();
+ assert.dom("#my-dropdown .widget-dropdown-body").doesNotExist();
});
test("icon", async function (assert) {
@@ -161,7 +157,7 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
await render(TEMPLATE);
- assert.ok(exists("#my-dropdown.activated"));
+ assert.dom("#my-dropdown.activated").exists();
});
test("content with translatedLabel", async function (assert) {
@@ -219,8 +215,8 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
await render(TEMPLATE);
- assert.notOk(exists("#my-dropdown .widget-dropdown-header"));
- assert.notOk(exists("#my-dropdown .widget-dropdown-body"));
+ assert.dom("#my-dropdown .widget-dropdown-header").doesNotExist();
+ assert.dom("#my-dropdown .widget-dropdown-body").doesNotExist();
});
test("headerClass option", async function (assert) {
@@ -263,7 +259,7 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
await render(TEMPLATE);
- assert.ok(exists("#my-dropdown.disabled"));
+ assert.dom("#my-dropdown.disabled").exists();
await toggle();
assert.strictEqual(rowById(1), null, "it does not display options");
@@ -275,6 +271,6 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
await render(TEMPLATE);
await toggle();
- assert.ok(exists(".widget-dropdown-item.item-5.disabled"));
+ assert.dom(".widget-dropdown-item.item-5.disabled").exists();
});
});
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.js
index eeab8d250b5..dcaa7fb998f 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, exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { count, 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";
@@ -30,7 +30,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".test").innerText, "Hello Robin");
+ assert.dom(".test").hasText("Hello Robin");
});
test("widget rerenders when args change", async function (assert) {
@@ -43,12 +43,12 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".test").innerText, "Hello Robin");
+ assert.dom(".test").hasText("Hello Robin");
this.set("args", { name: "David" });
await settled();
- assert.strictEqual(query(".test").innerText, "Hello David");
+ assert.dom(".test").hasText("Hello David");
});
test("widget services", async function (assert) {
@@ -62,7 +62,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".base-url-test").innerText, "/");
+ assert.dom(".base-url-test").hasText("/");
});
test("hbs template - no tagName", async function (assert) {
@@ -74,7 +74,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query("div.test").innerText, "Hello Robin");
+ assert.dom("div.test").hasText("Hello Robin");
});
test("hbs template - with tagName", async function (assert) {
@@ -87,7 +87,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query("div.test").innerText, "Hello Robin");
+ assert.dom("div.test").hasText("Hello Robin");
});
test("hbs template - with data attributes", async function (assert) {
@@ -97,7 +97,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query("div.my-div").dataset.myTest, "hello world");
+ assert.dom("div.my-div").hasAttribute("data-my-test", "hello world");
});
test("buildClasses", async function (assert) {
@@ -115,7 +115,7 @@ module("Integration | Component | Widget | base", function (hooks) {
hbs``
);
- assert.ok(exists(".test.static.cool-class"), "it has all the classes");
+ assert.dom(".test.static.cool-class").exists("has all the classes");
});
test("buildAttributes", async function (assert) {
@@ -133,8 +133,8 @@ module("Integration | Component | Widget | base", function (hooks) {
hbs``
);
- assert.ok(exists('.test[data-evil="trout"]'));
- assert.ok(exists('.test[aria-label="accessibility"]'));
+ assert.dom('.test[data-evil="trout"]').exists();
+ assert.dom('.test[aria-label="accessibility"]').exists();
});
test("buildId", async function (assert) {
@@ -148,7 +148,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.ok(exists("#test-1234"));
+ assert.dom("#test-1234").exists();
});
test("widget state", async function (assert) {
@@ -168,11 +168,11 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.ok(exists("button.test"), "it renders the button");
- assert.strictEqual(query("button.test").innerText, "0 clicks");
+ assert.dom("button.test").exists("renders the button");
+ assert.dom("button.test").hasText("0 clicks");
await click(query("button"));
- assert.strictEqual(query("button.test").innerText, "1 clicks");
+ assert.dom("button.test").hasText("1 clicks");
});
test("widget update with promise", async function (assert) {
@@ -199,10 +199,10 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query("button.test").innerText.trim(), "No name");
+ assert.dom("button.test").hasText("No name");
- await click(query("button"));
- assert.strictEqual(query("button.test").innerText.trim(), "Robin");
+ await click("button");
+ assert.dom("button.test").hasText("Robin");
});
test("widget attaching", async function (assert) {
@@ -215,8 +215,8 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.ok(exists(".container"), "renders container");
- assert.ok(exists(".container .embedded"), "renders attached");
+ assert.dom(".container").exists("renders container");
+ assert.dom(".container .embedded").exists("renders attached");
});
test("magic attaching by name", async function (assert) {
@@ -229,8 +229,8 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.ok(exists(".container"), "renders container");
- assert.ok(exists(".container .embedded"), "renders attached");
+ assert.dom(".container").exists("renders container");
+ assert.dom(".container .embedded").exists("renders attached");
});
test("custom attrs to a magic attached widget", async function (assert) {
@@ -246,8 +246,8 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.ok(exists(".container"), "renders container");
- assert.strictEqual(query(".container .value").innerText, "hello world");
+ assert.dom(".container").exists("renders container");
+ assert.dom(".container .value").hasText("hello world");
});
test("using transformed values in a sub-expression", async function (assert) {
@@ -267,7 +267,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
assert.ok(count(".container"), "renders container");
- assert.strictEqual(query(".container .value").innerText, "hello world");
+ assert.dom(".container .value").hasText("hello world");
});
test("handlebars d-icon", async function (assert) {
@@ -305,9 +305,9 @@ module("Integration | Component | Widget | base", function (hooks) {
);
// coming up
- assert.strictEqual(query("span.string").innerText, "evil");
- assert.strictEqual(query("span.var").innerText, "trout");
- assert.strictEqual(query("a").title, "evil");
+ assert.dom("span.string").hasText("evil");
+ assert.dom("span.var").hasText("trout");
+ assert.dom("a").hasAttribute("title", "evil");
});
test("handlebars #each", async function (assert) {
@@ -329,7 +329,7 @@ module("Integration | Component | Widget | base", function (hooks) {
);
assert.strictEqual(count("ul li"), 3);
- assert.strictEqual(query("ul li:nth-of-type(1)").innerText, "one");
+ assert.dom("ul li:nth-of-type(1)").hasText("one");
});
test("widget decorating", async function (assert) {
@@ -350,9 +350,9 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.ok(exists(".decorate"));
- assert.strictEqual(query(".decorate b").innerText, "before");
- assert.strictEqual(query(".decorate i").innerText, "after");
+ assert.dom(".decorate").exists();
+ assert.dom(".decorate b").hasText("before");
+ assert.dom(".decorate i").hasText("after");
});
test("widget settings", async function (assert) {
@@ -364,7 +364,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".settings").innerText, "age is 36");
+ assert.dom(".settings").hasText("age is 36");
});
test("override settings", async function (assert) {
@@ -380,7 +380,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".settings").innerText, "age is 37");
+ assert.dom(".settings").hasText("age is 37");
});
test("get accessor", async function (assert) {
@@ -396,7 +396,7 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.strictEqual(query("div.test").innerText, "Hello eviltrout");
+ assert.dom("div.test").hasText("Hello eviltrout");
});
test("tagName", async function (assert) {
@@ -408,10 +408,9 @@ module("Integration | Component | Widget | base", function (hooks) {
await render(hbs``);
- assert.ok(
- exists("section.override"),
- "renders container with overridden tagName"
- );
+ assert
+ .dom("section.override")
+ .exists("renders container with overridden tagName");
});
test("avoids rerendering on prepend", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/helpers/category-badge-test.js b/app/assets/javascripts/discourse/tests/integration/helpers/category-badge-test.js
index 2ae920de031..28d18673949 100644
--- a/app/assets/javascripts/discourse/tests/integration/helpers/category-badge-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/helpers/category-badge-test.js
@@ -3,7 +3,7 @@ import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import Category from "discourse/models/category";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
-import { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { exists } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Helper | category-badge", function (hooks) {
setupRenderingTest(hooks);
@@ -13,10 +13,7 @@ module("Integration | Helper | category-badge", function (hooks) {
await render(hbs`{{category-badge this.category}}`);
- assert.strictEqual(
- query(".badge-category__name").innerText.trim(),
- this.category.displayName
- );
+ assert.dom(".badge-category__name").hasText(this.category.displayName);
});
test("options.link", async function (assert) {
diff --git a/plugins/chat/test/javascripts/components/channel-name-test.gjs b/plugins/chat/test/javascripts/components/channel-name-test.gjs
index 66c9fba6331..4150da52069 100644
--- a/plugins/chat/test/javascripts/components/channel-name-test.gjs
+++ b/plugins/chat/test/javascripts/components/channel-name-test.gjs
@@ -18,7 +18,7 @@ module("Discourse Chat | Component | ", function (hooks) {
await render();
- assert.strictEqual(query(CHANNEL_NAME_LABEL).innerText, channel.title);
+ assert.dom(CHANNEL_NAME_LABEL).hasText(channel.title);
});
test("category channel - escapes label", async function (assert) {
diff --git a/plugins/chat/test/javascripts/components/chat-channel-card-test.js b/plugins/chat/test/javascripts/components/chat-channel-card-test.js
index f6853c57945..b514f5353f9 100644
--- a/plugins/chat/test/javascripts/components/chat-channel-card-test.js
+++ b/plugins/chat/test/javascripts/components/chat-channel-card-test.js
@@ -95,10 +95,7 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
test("Name", async function (assert) {
await render(hbs``);
- assert.strictEqual(
- query(".chat-channel-card__name").innerText.trim(),
- this.channel.title
- );
+ assert.dom(".chat-channel-card__name").hasText(this.channel.title);
});
test("Read restricted chatable", async function (assert) {
diff --git a/plugins/chat/test/javascripts/components/chat-composer-upload-test.js b/plugins/chat/test/javascripts/components/chat-composer-upload-test.js
index bbb0e50f019..3dc62de572d 100644
--- a/plugins/chat/test/javascripts/components/chat-composer-upload-test.js
+++ b/plugins/chat/test/javascripts/components/chat-composer-upload-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 { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { exists } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
@@ -18,10 +18,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
await render(hbs``);
assert.true(exists(".upload-progress[value=50]"));
- assert.strictEqual(
- query(".uploading").innerText.trim(),
- I18n.t("uploading")
- );
+ assert.dom(".uploading").hasText(I18n.t("uploading"));
});
test("image - uploading in progress", async function (assert) {
@@ -35,10 +32,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
assert.true(exists(".d-icon-far-image"));
assert.true(exists(".upload-progress[value=78]"));
- assert.strictEqual(
- query(".uploading").innerText.trim(),
- I18n.t("uploading")
- );
+ assert.dom(".uploading").hasText(I18n.t("uploading"));
});
test("image - preprocessing upload in progress", async function (assert) {
@@ -51,10 +45,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
await render(hbs``);
- assert.strictEqual(
- query(".processing").innerText.trim(),
- I18n.t("processing")
- );
+ assert.dom(".processing").hasText(I18n.t("processing"));
});
test("file - upload complete", async function (assert) {
@@ -69,8 +60,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
);
assert.true(exists(".d-icon-file-lines"));
- assert.strictEqual(query(".file-name").innerText.trim(), "some file.pdf");
- assert.strictEqual(query(".extension-pill").innerText.trim(), "pdf");
+ assert.dom(".file-name").hasText("some file.pdf");
+ assert.dom(".extension-pill").hasText("pdf");
});
test("image - upload complete", async function (assert) {
diff --git a/plugins/chat/test/javascripts/components/chat-message-avatar-test.js b/plugins/chat/test/javascripts/components/chat-message-avatar-test.js
index 190f34baf7c..b613a1f6df2 100644
--- a/plugins/chat/test/javascripts/components/chat-message-avatar-test.js
+++ b/plugins/chat/test/javascripts/components/chat-message-avatar-test.js
@@ -3,7 +3,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 { exists, query } from "discourse/tests/helpers/qunit-helpers";
+import { exists } from "discourse/tests/helpers/qunit-helpers";
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
@@ -20,7 +20,7 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
await render(hbs``);
- assert.strictEqual(query(".chat-emoji-avatar .emoji").title, "heart");
+ assert.dom(".chat-emoji-avatar .emoji").hasAttribute("title", "heart");
});
test("user", async function (assert) {
diff --git a/plugins/chat/test/javascripts/components/chat-message-info-test.js b/plugins/chat/test/javascripts/components/chat-message-info-test.js
index cba2a9d606a..e42bcc7e494 100644
--- a/plugins/chat/test/javascripts/components/chat-message-info-test.js
+++ b/plugins/chat/test/javascripts/components/chat-message-info-test.js
@@ -23,10 +23,9 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
await render(template);
- assert.strictEqual(
- query(".chat-message-info__username").innerText.trim(),
- this.message.chatWebhookEvent.username
- );
+ assert
+ .dom(".chat-message-info__username")
+ .hasText(this.message.chatWebhookEvent.username);
assert.strictEqual(
query(".chat-message-info__bot-indicator").textContent.trim(),
I18n.t("chat.bot")
@@ -40,10 +39,9 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
await render(template);
- assert.strictEqual(
- query(".chat-message-info__username").innerText.trim(),
- this.message.user.username
- );
+ assert
+ .dom(".chat-message-info__username")
+ .hasText(this.message.user.username);
});
test("date", async function (assert) {
diff --git a/plugins/chat/test/javascripts/components/chat-message-reaction-test.js b/plugins/chat/test/javascripts/components/chat-message-reaction-test.js
index 1dbda5f03c0..ada368019e7 100644
--- a/plugins/chat/test/javascripts/components/chat-message-reaction-test.js
+++ b/plugins/chat/test/javascripts/components/chat-message-reaction-test.js
@@ -24,8 +24,8 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {
test("title/alt attributes", async function (assert) {
await render(hbs``);
- assert.strictEqual(query(".chat-message-reaction").title, ":heart:");
- assert.strictEqual(query(".chat-message-reaction img").alt, ":heart:");
+ assert.dom(".chat-message-reaction").hasAttribute("title", ":heart:");
+ assert.dom(".chat-message-reaction img").hasAttribute("alt", ":heart:");
});
test("count of reactions", async function (assert) {
@@ -38,7 +38,7 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {
assert.false(exists(".chat-message-reaction .count"));
this.set("count", 2);
- assert.strictEqual(query(".chat-message-reaction .count").innerText, "2");
+ assert.dom(".chat-message-reaction .count").hasText("2");
});
test("reaction’s image", async function (assert) {
@@ -61,6 +61,6 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {
assert.false(exists(".chat-message-reaction .count"));
await click(".chat-message-reaction");
- assert.strictEqual(query(".chat-message-reaction .count").innerText, "1");
+ assert.dom(".chat-message-reaction .count").hasText("1");
});
});
diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js
index 35e10cd21a0..3a42ebf48b0 100644
--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js
+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js
@@ -136,8 +136,8 @@ acceptance("Local Dates - composer", function (needs) {
await click(".advanced-mode-btn");
- assert.strictEqual(query("input.format-input").value, "");
+ assert.dom("input.format-input").hasValue("");
await click("ul.formats a.moment-format");
- assert.strictEqual(query("input.format-input").value, "LLL");
+ assert.dom("input.format-input").hasValue("LLL");
});
});
diff --git a/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js b/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js
index 08fd6c085b8..67c10ab659e 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-breakdown-test.js
@@ -3,7 +3,6 @@ import { test } from "qunit";
import {
acceptance,
count,
- exists,
query,
} from "discourse/tests/helpers/qunit-helpers";
@@ -68,14 +67,15 @@ acceptance("Poll breakdown", function (needs) {
await click(".widget-dropdown-header");
- assert.ok(
- exists("button.show-breakdown"),
- "shows the breakdown button when poll_groupable_user_fields is non-empty"
- );
+ assert
+ .dom("button.show-breakdown")
+ .exists(
+ "shows the breakdown button when poll_groupable_user_fields is non-empty"
+ );
await click("button.show-breakdown");
- assert.ok(exists(".poll-breakdown-total-votes"), "displays the vote count");
+ assert.dom(".poll-breakdown-total-votes").exists("displays the vote count");
assert.strictEqual(
count(".poll-breakdown-chart-container"),
diff --git a/plugins/poll/test/javascripts/acceptance/poll-results-test.js b/plugins/poll/test/javascripts/acceptance/poll-results-test.js
index e5b3bfd2ae6..e238c2936c0 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-results-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-results-test.js
@@ -3,7 +3,6 @@ import { test } from "qunit";
import {
acceptance,
count,
- exists,
publishToMessageBus,
query,
} from "discourse/tests/helpers/qunit-helpers";
@@ -1767,6 +1766,6 @@ acceptance("Poll results - no voters", function (needs) {
test("does not show results button", async function (assert) {
await visit("/t/load-more-poll-voters/134");
- assert.ok(!exists(".toggle-results"));
+ assert.dom(".toggle-results").doesNotExist();
});
});
diff --git a/plugins/poll/test/javascripts/component/poll-results-standard-test.js b/plugins/poll/test/javascripts/component/poll-results-standard-test.js
index 7db77e930c3..fdef4486c65 100644
--- a/plugins/poll/test/javascripts/component/poll-results-standard-test.js
+++ b/plugins/poll/test/javascripts/component/poll-results-standard-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 { exists, queryAll } from "discourse/tests/helpers/qunit-helpers";
+import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
const TWO_OPTIONS = [
@@ -64,7 +64,7 @@ module("Poll | Component | poll-results-standard", function (hooks) {
assert.strictEqual(queryAll(".option .percentage")[0].innerText, "56%");
assert.strictEqual(queryAll(".option .percentage")[1].innerText, "44%");
- assert.ok(exists("ul.poll-voters-list"));
+ assert.dom("ul.poll-voters-list").exists();
});
test("Omits voters for private polls", async function (assert) {
@@ -92,7 +92,7 @@ module("Poll | Component | poll-results-standard", function (hooks) {
@fetchVoters={{this.fetchVoters}}
/>`);
- assert.ok(!exists("ul.poll-voters-list"));
+ assert.dom("ul.poll-voters-list").doesNotExist();
});
test("options in ascending order", async function (assert) {
diff --git a/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.js b/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.js
index 0bcf6bcc39e..cb539515261 100644
--- a/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.js
+++ b/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.js
@@ -1,10 +1,6 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
-import {
- acceptance,
- exists,
- 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";
@@ -17,7 +13,7 @@ acceptance("Spoiler Button", function (needs) {
await visit("/");
- assert.ok(exists("#create-topic"), "the create button is visible");
+ assert.dom("#create-topic").exists("the create button is visible");
await click("#create-topic");
const categoryChooser = selectKit(".category-chooser");