mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 05:59:39 +08:00
DEV: Convert more test assertions to qunit-dom (#29214)
the PR is sponsored by vscode's regex support in find-and-replace 😉
This commit is contained in:
parent
387f2c52e6
commit
688f65a39d
|
@ -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");
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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,
|
||||
"<small>eviltrout@example.com</small>",
|
||||
"shows the emails"
|
||||
);
|
||||
assert
|
||||
.dom(".users-list .user:nth-child(1) .email")
|
||||
.hasText("<small>eviltrout@example.com</small>", "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
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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",
|
||||
})
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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"));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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", '<span class="custom-html-test">HTML</span>');
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
"<small>eviltrout@example.com</small>"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal__body b")
|
||||
.hasText("<small>eviltrout@example.com</small>");
|
||||
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,
|
||||
"<small>current@example.com</small>"
|
||||
);
|
||||
assert
|
||||
.dom(".d-modal__body b")
|
||||
.hasText("<small>current@example.com</small>");
|
||||
assert.ok(!exists(".d-modal__body small"), "it escapes the email address");
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
|
|
@ -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`<ActivationControls />`);
|
||||
|
||||
assert.ok(!exists("button.edit-email"));
|
||||
assert.dom("button.edit-email").doesNotExist();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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`<AdminReport @dataSourceName="signups" />`);
|
||||
|
||||
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`<AdminReport @dataSourceName="signups" @reportOptions={{this.options}} />`
|
||||
);
|
||||
|
||||
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`<AdminReport @dataSourceName="signups_timeout" />`);
|
||||
|
||||
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`<AdminReport @dataSourceName="posts" />`);
|
||||
|
||||
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`<AdminReport @dataSourceName="signups_exception" />`);
|
||||
|
||||
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`<AdminReport @dataSourceName="signups_rate_limited" />`);
|
||||
|
||||
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`<AdminReport @dataSourceName="post_edits" />`);
|
||||
|
||||
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`<AdminReport @dataSourceName="not_found" />`);
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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`<BadgeButton @badge={{this.badge}} />`);
|
||||
|
||||
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`<BadgeButton @badge={{this.badge}} />`);
|
||||
|
||||
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`<BadgeButton @badge={{this.badge}} />`);
|
||||
|
||||
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`<BadgeButton @badge={{this.badge}} />`);
|
||||
|
||||
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) {
|
|||
</BadgeButton>
|
||||
`);
|
||||
|
||||
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`<BadgeButton @badge={{this.badge}} />`);
|
||||
|
||||
assert.ok(exists(".user-badge.foo"));
|
||||
assert.dom(".user-badge.foo").exists();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -48,7 +48,7 @@ module("Integration | Component | bookmark-icon", function (hooks) {
|
|||
|
||||
await render(hbs`<BookmarkIcon @bookmark={{this.bookmark}} />`);
|
||||
|
||||
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`<BookmarkIcon @bookmark={{this.bookmark}} />`);
|
||||
|
||||
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")
|
||||
|
|
|
@ -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`<DButton @ariaExpanded={{this.ariaExpanded}} />`);
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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`<DEditor @value={{this.value}} />`);
|
||||
|
||||
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`<DEditor/>`);
|
||||
|
||||
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) {
|
||||
|
|
|
@ -36,7 +36,7 @@ module("Integration | Component | d-toggle-switch", function (hooks) {
|
|||
this.set("state", true);
|
||||
|
||||
await render(hbs`<DToggleSwitch @state={{this.state}}/>`);
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,11 +23,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
|
|||
test("basics", async function (assert) {
|
||||
await render(hbs`<DialogHolder />`);
|
||||
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`<DialogHolder />`);
|
||||
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,
|
||||
}),
|
||||
|
|
|
@ -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`<EmptyState @title="title" @body="body" />`);
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -45,7 +45,7 @@ module("Integration | Component | sidebar | section-link", function (hooks) {
|
|||
const template = hbs`<Sidebar::SectionLink @linkName="test" @href="https://discourse.org" />`;
|
||||
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`<Sidebar::SectionLink @linkName="test" @href="https://discourse.org" />`;
|
||||
await render(template);
|
||||
|
||||
assert.strictEqual(query("a").target, "_blank");
|
||||
assert.dom("a").hasAttribute("target", "_blank");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ module("Integration | Component | site-setting", function (hooks) {
|
|||
|
||||
await render(hbs`<SiteSetting @setting={{this.setting}} />`);
|
||||
|
||||
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`<SiteSetting @setting={{this.setting}} />`);
|
||||
|
||||
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
|
||||
|
|
|
@ -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`<TextField />`);
|
||||
|
||||
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`<TextField @placeholderKey="placeholder.i18n.key" />`);
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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`<ThemesList @themes={{this.themes}} @components={{(array)}} @currentTab={{this.currentTab}} />`
|
||||
);
|
||||
|
||||
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`<ThemesList @themes={{this.themes}} @components={{(array)}} @currentTab={{this.currentTab}} />`
|
||||
);
|
||||
|
||||
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",
|
||||
|
|
|
@ -130,8 +130,8 @@ module("Integration | Component | time-shortcut-picker", function (hooks) {
|
|||
await render(hbs`<TimeShortcutPicker @_itsatrap={{this.itsatrap}} />`);
|
||||
|
||||
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`<TimeShortcutPicker @_itsatrap={{this.itsatrap}} />`);
|
||||
|
||||
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`<TimeShortcutPicker @_itsatrap={{this.itsatrap}} />`);
|
||||
|
||||
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`<TimeShortcutPicker @_itsatrap={{this.itsatrap}} />`);
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,8 +13,8 @@ module("Integration | Component | user-info", function (hooks) {
|
|||
|
||||
await render(hbs`<UserInfo @user={{this.currentUser}} />`);
|
||||
|
||||
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`<UserInfo @user={{this.currentUser}} />`);
|
||||
|
||||
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`<UserInfo @user={{this.currentUser}} @showStatus={{true}} />`
|
||||
);
|
||||
|
||||
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`<UserInfo @user={{this.currentUser}} @showStatus={{true}} />`
|
||||
);
|
||||
|
||||
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`<UserInfo @user={{this.currentUser}} @showStatus={{false}} />`
|
||||
);
|
||||
|
||||
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`<UserInfo @user={{this.currentUser}} />`);
|
||||
|
||||
assert.notOk(exists(".user-status-message"));
|
||||
assert.dom(".user-status-message").doesNotExist();
|
||||
});
|
||||
|
||||
test("doesn't show status description by default", async function (assert) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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`<MountWidget @widget="button" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="button" @args={{this.args}} />`);
|
||||
|
||||
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) {
|
||||
|
|
|
@ -18,9 +18,9 @@ module(
|
|||
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
|
||||
);
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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`<MountWidget @widget="post" @model={{this.post}} @args={{this.args}} />`
|
||||
);
|
||||
|
||||
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) {
|
|||
<MountWidget @widget="post-menu" @args={{this.args}} @toggleLike={{this.toggleLike}} />
|
||||
`);
|
||||
|
||||
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) {
|
|||
<MountWidget @widget="post-menu" @args={{this.args}} @showLogin={{this.showLogin}} />
|
||||
`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
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`<MountWidget @widget="post" @args={{this.args}} />`);
|
||||
|
||||
assert.notOk(exists(".user-status-message"));
|
||||
assert.dom(".user-status-message").doesNotExist();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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`<MountWidget @widget="poster-name" @args={{this.args}} />`
|
||||
);
|
||||
|
||||
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`<MountWidget @widget="poster-name" @args={{this.args}} />`
|
||||
);
|
||||
|
||||
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`<MountWidget @widget="poster-name" @args={{this.args}} />`
|
||||
);
|
||||
|
||||
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`<MountWidget @widget="poster-name" @args={{this.args}} />`
|
||||
);
|
||||
|
||||
assert.ok(!exists(".second"));
|
||||
assert.dom(".second").doesNotExist();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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`<MountWidget @widget="toggle-demo-widget" />`);
|
||||
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) {
|
||||
|
|
|
@ -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`<MountWidget @widget="small-user-list" @args={{this.args}} />`
|
||||
);
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user