DEV: Reduce jQuery usage in acceptance tests (#17406)
This commit is contained in:
parent
06ae9229e8
commit
0f01cc7df2
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, currentRouteName, fillIn, visit } from "@ember/test-helpers";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
|
@ -16,7 +16,7 @@ acceptance("Account Created", function () {
|
|||
|
||||
assert.ok(exists(".account-created"));
|
||||
assert.strictEqual(
|
||||
queryAll(".account-created .ac-message").text().trim(),
|
||||
query(".account-created .ac-message").innerText.trim(),
|
||||
"Hello World",
|
||||
"it displays the message"
|
||||
);
|
||||
|
@ -35,7 +35,7 @@ acceptance("Account Created", function () {
|
|||
|
||||
assert.ok(exists(".account-created"));
|
||||
assert.strictEqual(
|
||||
queryAll(".account-created .ac-message").text().trim(),
|
||||
query(".account-created .ac-message").innerText.trim(),
|
||||
"Hello World",
|
||||
"it displays the message"
|
||||
);
|
||||
|
@ -43,7 +43,7 @@ acceptance("Account Created", function () {
|
|||
await click(".activation-controls .resend");
|
||||
|
||||
assert.strictEqual(currentRouteName(), "account-created.resent");
|
||||
const email = queryAll(".account-created .ac-message b").text();
|
||||
const email = query(".account-created .ac-message b").innerText;
|
||||
assert.strictEqual(email, "eviltrout@example.com");
|
||||
});
|
||||
|
||||
|
@ -88,7 +88,7 @@ acceptance("Account Created", function () {
|
|||
await click(".activation-controls .btn-primary");
|
||||
|
||||
assert.strictEqual(currentRouteName(), "account-created.resent");
|
||||
const email = queryAll(".account-created .ac-message b").text();
|
||||
const email = query(".account-created .ac-message b").innerText;
|
||||
assert.strictEqual(email, "newemail@example.com");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
@ -37,7 +37,7 @@ 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(queryAll(".title h3").text(), "site.test");
|
||||
assert.strictEqual(query(".title h3").innerText, "site.test");
|
||||
assert.ok(!exists(".saved"));
|
||||
assert.ok(!exists(".revert-site-text"));
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import I18n from "I18n";
|
||||
import { test } from "qunit";
|
||||
|
||||
function assertNoSecondary(assert) {
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.email .value a").text(),
|
||||
query(".display-row.email .value a").innerText,
|
||||
"eviltrout@example.com",
|
||||
"it should display the primary email"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.secondary-emails .value").text().trim(),
|
||||
query(".display-row.secondary-emails .value").innerText.trim(),
|
||||
I18n.t("user.email.no_secondary"),
|
||||
"it should not display secondary emails"
|
||||
);
|
||||
|
@ -19,13 +19,13 @@ function assertNoSecondary(assert) {
|
|||
|
||||
function assertMultipleSecondary(assert, firstEmail, secondEmail) {
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.secondary-emails .value li:first-of-type a").text(),
|
||||
query(".display-row.secondary-emails .value li:first-of-type a").innerText,
|
||||
firstEmail,
|
||||
"it should display the first secondary email"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.secondary-emails .value li:last-of-type a").text(),
|
||||
query(".display-row.secondary-emails .value li:last-of-type a").innerText,
|
||||
secondEmail,
|
||||
"it should display the second secondary email"
|
||||
);
|
||||
|
@ -44,7 +44,7 @@ acceptance("Admin - User Emails", function (needs) {
|
|||
await visit("/admin/users/3/markvanlan");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.email .value a").text(),
|
||||
query(".display-row.email .value a").innerText,
|
||||
"markvanlan@example.com",
|
||||
"it should display the user's primary email"
|
||||
);
|
||||
|
|
|
@ -2,7 +2,6 @@ import {
|
|||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
@ -86,7 +85,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
|
||||
server.put("/admin/users/4/grant_admin", () => {
|
||||
return helper.response(403, {
|
||||
second_factor_challenge_nonce: "somenonce",
|
||||
second_factor_challenge_nonce: "some-nonce",
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -104,7 +103,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await visit("/admin/users/2/sam");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.username .value").text().trim(),
|
||||
query(".display-row.username .value").innerText.trim(),
|
||||
"sam"
|
||||
);
|
||||
|
||||
|
@ -113,7 +112,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await fillIn(".display-row.username .value input", "new-sam");
|
||||
await click(".display-row.username a");
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.username .value").text().trim(),
|
||||
query(".display-row.username .value").innerText.trim(),
|
||||
"sam"
|
||||
);
|
||||
|
||||
|
@ -122,7 +121,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await fillIn(".display-row.username .value input", "new-sam");
|
||||
await click(".display-row.username button");
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.username .value").text().trim(),
|
||||
query(".display-row.username .value").innerText.trim(),
|
||||
"new-sam"
|
||||
);
|
||||
});
|
||||
|
@ -130,7 +129,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
test("shows the number of post edits", async function (assert) {
|
||||
await visit("/admin/users/1/eviltrout");
|
||||
|
||||
assert.strictEqual(queryAll(".post-edits-count .value").text().trim(), "6");
|
||||
assert.strictEqual(query(".post-edits-count .value").innerText.trim(), "6");
|
||||
|
||||
assert.ok(
|
||||
exists(".post-edits-count .controls .btn.btn-icon"),
|
||||
|
@ -165,7 +164,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await visit("/admin/users/2/sam");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.username .value").text().trim(),
|
||||
query(".display-row.username .value").innerText.trim(),
|
||||
"sam",
|
||||
"the name should be correct"
|
||||
);
|
||||
|
@ -182,7 +181,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await visit("/admin/users/1/eviltrout");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".display-row.username .value").text().trim(),
|
||||
query(".display-row.username .value").innerText.trim(),
|
||||
"eviltrout",
|
||||
"the name should be correct"
|
||||
);
|
||||
|
@ -209,7 +208,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await click(".grant-admin");
|
||||
assert.equal(
|
||||
currentURL(),
|
||||
"/session/2fa?nonce=somenonce",
|
||||
"/session/2fa?nonce=some-nonce",
|
||||
"user is redirected to the 2FA page"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import I18n from "I18n";
|
||||
|
@ -25,18 +25,18 @@ acceptance("Admin - Users List", function (needs) {
|
|||
await click(".users-list .sortable:nth-child(1)");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes("eviltrout"),
|
||||
query(".users-list .user:nth-child(1) .username").innerText.includes(
|
||||
"eviltrout"
|
||||
),
|
||||
"list should be sorted by username"
|
||||
);
|
||||
|
||||
await click(".users-list .sortable:nth-child(1)");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes("discobot"),
|
||||
query(".users-list .user:nth-child(1) .username").innerText.includes(
|
||||
"discobot"
|
||||
),
|
||||
"list should be sorted ascending by username"
|
||||
);
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ acceptance("Admin - Users List", function (needs) {
|
|||
await click(".show-emails");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".users-list .user:nth-child(1) .email").text(),
|
||||
query(".users-list .user:nth-child(1) .email").innerText,
|
||||
"<small>eviltrout@example.com</small>",
|
||||
"shows the emails"
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ acceptance("Admin - Users List", function (needs) {
|
|||
await click(".hide-emails");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".users-list .user:nth-child(1) .email").text(),
|
||||
query(".users-list .user:nth-child(1) .email").innerText,
|
||||
"",
|
||||
"hides the emails"
|
||||
);
|
||||
|
@ -71,38 +71,38 @@ acceptance("Admin - Users List", function (needs) {
|
|||
|
||||
await visit("/admin/users/list/active");
|
||||
|
||||
assert.strictEqual(queryAll(".admin-title h2").text(), activeTitle);
|
||||
assert.strictEqual(query(".admin-title h2").innerText, activeTitle);
|
||||
assert.ok(
|
||||
queryAll(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes(activeUser)
|
||||
query(".users-list .user:nth-child(1) .username").innerText.includes(
|
||||
activeUser
|
||||
)
|
||||
);
|
||||
|
||||
await click('a[href="/admin/users/list/new"]');
|
||||
|
||||
assert.strictEqual(queryAll(".admin-title h2").text(), suspectTitle);
|
||||
assert.strictEqual(query(".admin-title h2").innerText, suspectTitle);
|
||||
assert.ok(
|
||||
queryAll(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes(suspectUser)
|
||||
query(".users-list .user:nth-child(1) .username").innerText.includes(
|
||||
suspectUser
|
||||
)
|
||||
);
|
||||
|
||||
await click(".users-list .sortable:nth-child(4)");
|
||||
|
||||
assert.strictEqual(queryAll(".admin-title h2").text(), suspectTitle);
|
||||
assert.strictEqual(query(".admin-title h2").innerText, suspectTitle);
|
||||
assert.ok(
|
||||
queryAll(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes(suspectUser)
|
||||
query(".users-list .user:nth-child(1) .username").innerText.includes(
|
||||
suspectUser
|
||||
)
|
||||
);
|
||||
|
||||
await click('a[href="/admin/users/list/active"]');
|
||||
|
||||
assert.strictEqual(queryAll(".admin-title h2").text(), activeTitle);
|
||||
assert.strictEqual(query(".admin-title h2").innerText, activeTitle);
|
||||
assert.ok(
|
||||
queryAll(".users-list .user:nth-child(1) .username")
|
||||
.text()
|
||||
.includes(activeUser)
|
||||
query(".users-list .user:nth-child(1) .username").innerText.includes(
|
||||
activeUser
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -63,8 +63,8 @@ acceptance("Admin - Watched Words", function (needs) {
|
|||
await click(".watched-word-form button");
|
||||
|
||||
let found = [];
|
||||
$.each(queryAll(".watched-words-list .watched-word"), (index, elem) => {
|
||||
if ($(elem).text().trim() === "poutine") {
|
||||
[...queryAll(".watched-words-list .watched-word")].forEach((elem) => {
|
||||
if (elem.innerText.trim() === "poutine") {
|
||||
found.push(true);
|
||||
}
|
||||
});
|
||||
|
@ -75,15 +75,15 @@ acceptance("Admin - Watched Words", function (needs) {
|
|||
await visit("/admin/customize/watched_words/action/block");
|
||||
await click(".show-words-checkbox");
|
||||
|
||||
let word = null;
|
||||
let wordId = null;
|
||||
|
||||
$.each(queryAll(".watched-words-list .watched-word"), (index, elem) => {
|
||||
if ($(elem).text().trim() === "anise") {
|
||||
word = elem;
|
||||
[...queryAll(".watched-words-list .watched-word")].forEach((elem) => {
|
||||
if (elem.innerText.trim() === "anise") {
|
||||
wordId = elem.getAttribute("id");
|
||||
}
|
||||
});
|
||||
|
||||
await click(`#${$(word).attr("id")} .delete-word-record`);
|
||||
await click(`#${wordId} .delete-word-record`);
|
||||
|
||||
assert.strictEqual(count(".watched-words-list .watched-word"), 2);
|
||||
});
|
||||
|
|
|
@ -3,7 +3,6 @@ import {
|
|||
exists,
|
||||
loggedInUser,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import I18n from "I18n";
|
||||
|
@ -218,9 +217,9 @@ acceptance("Bookmarking", function (needs) {
|
|||
|
||||
assert.ok(exists(".bootbox.modal"), "it asks for delete confirmation");
|
||||
assert.ok(
|
||||
queryAll(".bootbox.modal")
|
||||
.text()
|
||||
.includes(I18n.t("bookmarks.confirm_delete")),
|
||||
query(".bootbox.modal").innerText.includes(
|
||||
I18n.t("bookmarks.confirm_delete")
|
||||
),
|
||||
"it shows delete confirmation message"
|
||||
);
|
||||
|
||||
|
@ -252,17 +251,17 @@ acceptance("Bookmarking", function (needs) {
|
|||
|
||||
await openEditBookmarkModal();
|
||||
assert.strictEqual(
|
||||
queryAll("#bookmark-name").val(),
|
||||
query("#bookmark-name").value,
|
||||
"Test name",
|
||||
"it should prefill the bookmark name"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll("#custom-date > input").val(),
|
||||
query("#custom-date > input").value,
|
||||
tomorrow,
|
||||
"it should prefill the bookmark date"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll("#custom-time").val(),
|
||||
query("#custom-time").value,
|
||||
"08:00",
|
||||
"it should prefill the bookmark time"
|
||||
);
|
||||
|
@ -278,17 +277,17 @@ acceptance("Bookmarking", function (needs) {
|
|||
|
||||
await openEditBookmarkModal();
|
||||
assert.strictEqual(
|
||||
queryAll("#bookmark-name").val(),
|
||||
query("#bookmark-name").value,
|
||||
"Test name",
|
||||
"it should prefill the bookmark name"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll("#custom-date > input").val(),
|
||||
query("#custom-date > input").value,
|
||||
postDateFormatted,
|
||||
"it should prefill the bookmark date"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll("#custom-time").val(),
|
||||
query("#custom-time").value,
|
||||
"10:35",
|
||||
"it should prefill the bookmark time"
|
||||
);
|
||||
|
@ -446,9 +445,9 @@ acceptance("Bookmarking", function (needs) {
|
|||
|
||||
assert.ok(exists(".bootbox.modal"), "it asks for delete confirmation");
|
||||
assert.ok(
|
||||
queryAll(".bootbox.modal")
|
||||
.text()
|
||||
.includes(I18n.t("bookmarks.confirm_delete")),
|
||||
query(".bootbox.modal").innerText.includes(
|
||||
I18n.t("bookmarks.confirm_delete")
|
||||
),
|
||||
"it shows delete confirmation message"
|
||||
);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
|
@ -27,16 +27,16 @@ acceptance("Category Edit", function (needs) {
|
|||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".category-breadcrumb .badge-category").text(),
|
||||
query(".category-breadcrumb .badge-category").innerText,
|
||||
"bug"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".category-color-editor .badge-category").text(),
|
||||
query(".category-color-editor .badge-category").innerText,
|
||||
"bug"
|
||||
);
|
||||
await fillIn("input.category-name", "testing");
|
||||
assert.strictEqual(
|
||||
queryAll(".category-color-editor .badge-category").text(),
|
||||
query(".category-color-editor .badge-category").innerText,
|
||||
"testing"
|
||||
);
|
||||
|
||||
|
@ -156,7 +156,7 @@ acceptance("Category Edit", function (needs) {
|
|||
"/c/1-category/edit/general",
|
||||
"it goes to the general tab"
|
||||
);
|
||||
assert.strictEqual(queryAll("input.category-name").val(), "bug");
|
||||
assert.strictEqual(query("input.category-name").value, "bug");
|
||||
});
|
||||
|
||||
test("Error Saving", async function (assert) {
|
||||
|
@ -166,7 +166,7 @@ acceptance("Category Edit", function (needs) {
|
|||
|
||||
assert.ok(visible(".bootbox"));
|
||||
assert.strictEqual(
|
||||
queryAll(".bootbox .modal-body").html(),
|
||||
query(".bootbox .modal-body").innerHTML,
|
||||
"duplicate email"
|
||||
);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
|
@ -15,11 +15,11 @@ acceptance("Category New", function (needs) {
|
|||
test("Creating a new category", async function (assert) {
|
||||
await visit("/new-category");
|
||||
|
||||
assert.ok(queryAll(".badge-category"));
|
||||
assert.ok(exists(".badge-category"));
|
||||
assert.notOk(exists(".category-breadcrumb"));
|
||||
|
||||
await fillIn("input.category-name", "testing");
|
||||
assert.strictEqual(queryAll(".badge-category").text(), "testing");
|
||||
assert.strictEqual(query(".badge-category").innerText, "testing");
|
||||
|
||||
await click("#save-category");
|
||||
|
||||
|
@ -30,7 +30,7 @@ acceptance("Category New", function (needs) {
|
|||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".edit-category-title h2").text(),
|
||||
query(".edit-category-title h2").innerText,
|
||||
I18n.t("category.edit_dialog_title", {
|
||||
categoryName: "testing",
|
||||
})
|
||||
|
@ -38,13 +38,13 @@ acceptance("Category New", function (needs) {
|
|||
|
||||
await click(".edit-category-security a");
|
||||
assert.ok(
|
||||
queryAll("button.edit-permission"),
|
||||
exists(".permission-row button.reply-toggle"),
|
||||
"it can switch to the security tab"
|
||||
);
|
||||
|
||||
await click(".edit-category-settings a");
|
||||
assert.ok(
|
||||
queryAll("#category-search-priority"),
|
||||
exists("#category-search-priority"),
|
||||
"it can switch to the settings tab"
|
||||
);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
selectText,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -69,15 +69,15 @@ acceptance("Composer Actions", function (needs) {
|
|||
await composerActions.selectRowByValue("reply_to_topic");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title .topic-link").text().trim(),
|
||||
query(".action-title .topic-link").innerText.trim(),
|
||||
"Internationalization / localization"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title .topic-link").attr("href"),
|
||||
query(".action-title .topic-link").getAttribute("href"),
|
||||
"/t/internationalization-localization/280"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val(),
|
||||
query(".d-editor-input").value,
|
||||
"test replying to topic when initially replied to post"
|
||||
);
|
||||
});
|
||||
|
@ -141,10 +141,10 @@ acceptance("Composer Actions", function (needs) {
|
|||
|
||||
assert.strictEqual(categoryChooserReplyArea.header().name(), "faq");
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title").text().trim(),
|
||||
query(".action-title").innerText.trim(),
|
||||
I18n.t("topic.create_long")
|
||||
);
|
||||
assert.ok(queryAll(".d-editor-input").val().includes(quote));
|
||||
assert.ok(query(".d-editor-input").value.includes(quote));
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
|
@ -179,10 +179,10 @@ acceptance("Composer Actions", function (needs) {
|
|||
await composerActions.selectRowByValue("reply_to_topic");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title").text().trim(),
|
||||
query(".action-title").innerText.trim(),
|
||||
"Short topic with two posts"
|
||||
);
|
||||
assert.strictEqual(queryAll(".d-editor-input").val(), quote);
|
||||
assert.strictEqual(query(".d-editor-input").value, quote);
|
||||
|
||||
await composerActions.expand();
|
||||
|
||||
|
@ -203,10 +203,10 @@ acceptance("Composer Actions", function (needs) {
|
|||
|
||||
assert.ok(exists(".action-title img.avatar"));
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title .user-link").text().trim(),
|
||||
query(".action-title .user-link").innerText.trim(),
|
||||
"tms"
|
||||
);
|
||||
assert.strictEqual(queryAll(".d-editor-input").val(), quote);
|
||||
assert.strictEqual(query(".d-editor-input").value, quote);
|
||||
assert.strictEqual(
|
||||
composerActions.rowByIndex(0).value(),
|
||||
"reply_as_new_topic"
|
||||
|
@ -223,10 +223,10 @@ acceptance("Composer Actions", function (needs) {
|
|||
await composerActions.expand();
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title").text().trim(),
|
||||
query(".action-title").innerText.trim(),
|
||||
I18n.t("topic.create_long")
|
||||
);
|
||||
assert.ok(queryAll(".d-editor-input").val().includes(quote));
|
||||
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");
|
||||
assert.strictEqual(composerActions.rowByIndex(2).value(), "shared_draft");
|
||||
|
@ -242,7 +242,7 @@ acceptance("Composer Actions", function (needs) {
|
|||
await composerActions.expand();
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title").text().trim(),
|
||||
query(".action-title").innerText.trim(),
|
||||
I18n.t("topic.private_message")
|
||||
);
|
||||
assert.strictEqual(composerActions.rowByIndex(0).value(), "create_topic");
|
||||
|
@ -452,12 +452,12 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
|
|||
assert.strictEqual(tags.header().value(), "monkey", "tags are not reset");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#reply-title").val(),
|
||||
query("#reply-title").value,
|
||||
"This is the new text for the title using 'quotes'"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#reply-control .btn-primary.create .d-button-label").text(),
|
||||
query("#reply-control .btn-primary.create .d-button-label").innerText,
|
||||
I18n.t("composer.create_shared_draft")
|
||||
);
|
||||
assert.strictEqual(
|
||||
|
@ -482,7 +482,7 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
|
|||
stubDraftResponse();
|
||||
await composerActions.selectRowByValue("reply_as_new_topic");
|
||||
assert.strictEqual(
|
||||
queryAll(".bootbox .modal-body").text(),
|
||||
query(".bootbox .modal-body").innerText,
|
||||
I18n.t("composer.composer_actions.reply_as_new_topic.confirm")
|
||||
);
|
||||
await click(".modal-footer .btn.btn-default");
|
||||
|
@ -502,7 +502,7 @@ acceptance("Prioritize Username", function (needs) {
|
|||
await click("article#post_2 button.reply");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title .user-link").text().trim(),
|
||||
query(".action-title .user-link").innerText.trim(),
|
||||
"james_john"
|
||||
);
|
||||
});
|
||||
|
@ -512,7 +512,7 @@ acceptance("Prioritize Username", function (needs) {
|
|||
await selectText("#post_2 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
query(".d-editor-input").value.trim(),
|
||||
'[quote="james_john, post:2, topic:54079, full:true"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
});
|
||||
|
@ -530,7 +530,7 @@ acceptance("Prioritize Full Name", function (needs) {
|
|||
await click("article#post_2 button.reply");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".action-title .user-link").text().trim(),
|
||||
query(".action-title .user-link").innerText.trim(),
|
||||
"james, john, the third"
|
||||
);
|
||||
});
|
||||
|
@ -540,7 +540,7 @@ acceptance("Prioritize Full Name", function (needs) {
|
|||
await selectText("#post_2 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
query(".d-editor-input").value.trim(),
|
||||
'[quote="james, john, the third, post:2, topic:54079, full:true, username:james_john"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
});
|
||||
|
@ -550,7 +550,7 @@ acceptance("Prioritize Full Name", function (needs) {
|
|||
await selectText("#post_4 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
query(".d-editor-input").value.trim(),
|
||||
'[quote="james_john, post:2, topic:54079"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
});
|
||||
|
@ -569,7 +569,7 @@ acceptance("Prioritizing Name fall back", function (needs) {
|
|||
await selectText("#post_1 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
query(".d-editor-input").value.trim(),
|
||||
'[quote="bianca, post:1, topic:130, full:true"]\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a varius ipsum. Nunc euismod, metus non vulputate malesuada, ligula metus pharetra tortor, vel sodales arcu lacus sed mauris. Nam semper, orci vitae fringilla placerat, dui tellus convallis felis, ultricies laoreet sapien mi et metus. Mauris facilisis, mi fermentum rhoncus feugiat, dolor est vehicula leo, id porta leo ex non enim. In a ligula vel tellus commodo scelerisque non in ex. Pellentesque semper leo quam, nec varius est viverra eget. Donec vehicula sem et massa faucibus tempus.\n[/quote]'
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
acceptance,
|
||||
queryAll,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "I18n";
|
||||
|
@ -53,7 +53,7 @@ acceptance("Composer - Tags", function (needs) {
|
|||
await click("#reply-control button.create");
|
||||
assert.strictEqual(currentURL(), "/");
|
||||
assert.strictEqual(
|
||||
queryAll(".popup-tip.bad").text().trim(),
|
||||
query(".popup-tip.bad").innerText.trim(),
|
||||
I18n.t("composer.error.tags_missing", { count: 1 }),
|
||||
"it should display the right alert"
|
||||
);
|
||||
|
@ -86,7 +86,7 @@ acceptance("Composer - Tags", function (needs) {
|
|||
await click("#reply-control button.create");
|
||||
assert.strictEqual(currentURL(), "/");
|
||||
assert.strictEqual(
|
||||
queryAll(".popup-tip.bad").text().trim(),
|
||||
query(".popup-tip.bad").innerText.trim(),
|
||||
I18n.t("composer.error.tags_missing", { count: 1 }),
|
||||
"it should display the right alert"
|
||||
);
|
||||
|
|
|
@ -15,7 +15,6 @@ import {
|
|||
exists,
|
||||
invisible,
|
||||
query,
|
||||
queryAll,
|
||||
updateCurrentUser,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -100,7 +99,7 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await fillIn(".d-editor-input", "this is the *content* of a post");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-preview").html().trim(),
|
||||
query(".d-editor-preview").innerHTML.trim(),
|
||||
"<p>this is the <em>content</em> of a post</p>",
|
||||
"it previews content"
|
||||
);
|
||||
|
@ -126,7 +125,7 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
const example = I18n.t(`composer.bold_text`);
|
||||
assert.strictEqual(
|
||||
queryAll("#reply-control .d-editor-input").val().trim(),
|
||||
query("#reply-control .d-editor-input").value.trim(),
|
||||
`this is the *content* of a post**${example}**`,
|
||||
"it supports keyboard shortcuts"
|
||||
);
|
||||
|
@ -186,7 +185,7 @@ acceptance("Composer", function (needs) {
|
|||
await fillIn(".d-editor-input", "custom message");
|
||||
await click("#reply-control button.create");
|
||||
assert.strictEqual(
|
||||
queryAll(".bootbox .modal-body").text(),
|
||||
query(".bootbox .modal-body").innerText,
|
||||
"This is a custom response"
|
||||
);
|
||||
assert.strictEqual(currentURL(), "/", "it doesn't change routes");
|
||||
|
@ -217,7 +216,7 @@ acceptance("Composer", function (needs) {
|
|||
await fillIn(".d-editor-input", "this is the content of my reply");
|
||||
await click("#reply-control button.create");
|
||||
assert.strictEqual(
|
||||
queryAll(".cooked:last p").text(),
|
||||
query(".topic-post:last-of-type .cooked p").innerText,
|
||||
"this is the content of my reply"
|
||||
);
|
||||
});
|
||||
|
@ -234,7 +233,7 @@ acceptance("Composer", function (needs) {
|
|||
await click(".modal-footer button.keep-editing");
|
||||
assert.ok(invisible(".discard-draft-modal.modal"));
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val(),
|
||||
query(".d-editor-input").value,
|
||||
"this is the content of my reply",
|
||||
"composer does not switch when using Keep Editing button"
|
||||
);
|
||||
|
@ -244,8 +243,8 @@ acceptance("Composer", function (needs) {
|
|||
assert.ok(invisible(".discard-draft-modal.modal"));
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val(),
|
||||
queryAll(".topic-post:nth-of-type(1) .cooked > p").text(),
|
||||
query(".d-editor-input").value,
|
||||
query(".topic-post:nth-of-type(1) .cooked > p").innerText,
|
||||
"composer has contents of post to be edited"
|
||||
);
|
||||
});
|
||||
|
@ -268,7 +267,7 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click(".btn-reply-here");
|
||||
assert.strictEqual(
|
||||
queryAll(".cooked:last p").text(),
|
||||
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."
|
||||
);
|
||||
});
|
||||
|
@ -298,7 +297,7 @@ acceptance("Composer", function (needs) {
|
|||
await click(".modal-footer button.discard-draft");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val(),
|
||||
query(".d-editor-input").value,
|
||||
"",
|
||||
"discards draft and reset composer textarea"
|
||||
);
|
||||
|
@ -319,7 +318,8 @@ acceptance("Composer", function (needs) {
|
|||
await fillIn(".d-editor-input", "enqueue this content please");
|
||||
await click("#reply-control button.create");
|
||||
assert.ok(
|
||||
queryAll(".cooked:last p").text() !== "enqueue this content please",
|
||||
query(".topic-post:last-of-type .cooked p").innerText !==
|
||||
"enqueue this content please",
|
||||
"it doesn't insert the post"
|
||||
);
|
||||
|
||||
|
@ -342,7 +342,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(
|
||||
queryAll(".d-editor-input").val().indexOf("Any plans to support"),
|
||||
query(".d-editor-input").value.indexOf("Any plans to support"),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
|
@ -356,15 +356,15 @@ acceptance("Composer", function (needs) {
|
|||
"it has the edits icon"
|
||||
);
|
||||
assert.ok(
|
||||
queryAll("#topic-title h1")
|
||||
.text()
|
||||
.indexOf("This is the new text for the title") !== -1,
|
||||
query("#topic-title h1").innerText.indexOf(
|
||||
"This is the new text for the title"
|
||||
) !== -1,
|
||||
"it shows the new title"
|
||||
);
|
||||
assert.ok(
|
||||
queryAll(".topic-post:nth-of-type(1) .cooked")
|
||||
.text()
|
||||
.indexOf("This is the new text for the post") !== -1,
|
||||
query(".topic-post:nth-of-type(1) .cooked").innerText.indexOf(
|
||||
"This is the new text for the post"
|
||||
) !== -1,
|
||||
"it updates the post"
|
||||
);
|
||||
});
|
||||
|
@ -407,13 +407,13 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().indexOf("This is the first post."),
|
||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
await click(".topic-post:nth-of-type(2) button.edit");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().indexOf("This is the second post."),
|
||||
query(".d-editor-input").value.indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
|
@ -432,7 +432,7 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click(".modal-footer button.discard-draft");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().indexOf("This is the second post."),
|
||||
query(".d-editor-input").value.indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
|
@ -443,19 +443,19 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().indexOf("This is the first post."),
|
||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
await click(".topic-post:nth-of-type(1) button.reply");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val(),
|
||||
query(".d-editor-input").value,
|
||||
"",
|
||||
"it clears the input"
|
||||
);
|
||||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().indexOf("This is the first post."),
|
||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
|
@ -628,7 +628,7 @@ acceptance("Composer", function (needs) {
|
|||
);
|
||||
await click(".modal-footer button.discard-draft");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().indexOf("This is the first post."),
|
||||
query(".d-editor-input").value.indexOf("This is the first post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
|
@ -646,18 +646,18 @@ acceptance("Composer", function (needs) {
|
|||
"it pops up a confirmation dialog"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-footer button.save-draft").text().trim(),
|
||||
query(".modal-footer button.save-draft").innerText.trim(),
|
||||
I18n.t("post.cancel_composer.save_draft"),
|
||||
"has save draft button"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-footer button.keep-editing").text().trim(),
|
||||
query(".modal-footer button.keep-editing").innerText.trim(),
|
||||
I18n.t("post.cancel_composer.keep_editing"),
|
||||
"has keep editing button"
|
||||
);
|
||||
await click(".modal-footer button.save-draft");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().indexOf("This is the second post."),
|
||||
query(".d-editor-input").value.indexOf("This is the second post."),
|
||||
0,
|
||||
"it populates the input with the post text"
|
||||
);
|
||||
|
@ -677,18 +677,18 @@ acceptance("Composer", function (needs) {
|
|||
"it pops up a confirmation dialog"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-footer button.save-draft").text().trim(),
|
||||
query(".modal-footer button.save-draft").innerText.trim(),
|
||||
I18n.t("post.cancel_composer.save_draft"),
|
||||
"has save draft button"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-footer button.keep-editing").text().trim(),
|
||||
query(".modal-footer button.keep-editing").innerText.trim(),
|
||||
I18n.t("post.cancel_composer.keep_editing"),
|
||||
"has keep editing button"
|
||||
);
|
||||
await click(".modal-footer button.save-draft");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val(),
|
||||
query(".d-editor-input").value,
|
||||
"",
|
||||
"it clears the composer input"
|
||||
);
|
||||
|
@ -704,7 +704,7 @@ acceptance("Composer", function (needs) {
|
|||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-body").text(),
|
||||
query(".modal-body").innerText,
|
||||
I18n.t("drafts.abandon.confirm")
|
||||
);
|
||||
|
||||
|
@ -749,7 +749,7 @@ acceptance("Composer", function (needs) {
|
|||
assert.ok(!exists(".modal-body"), "abandon popup shouldn't come");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".d-editor-input").val().includes(longText),
|
||||
query(".d-editor-input").value.includes(longText),
|
||||
"entered text should still be there"
|
||||
);
|
||||
|
||||
|
@ -802,7 +802,7 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await visit("/latest");
|
||||
assert.strictEqual(
|
||||
queryAll("#create-topic").text().trim(),
|
||||
query("#create-topic").innerText.trim(),
|
||||
I18n.t("topic.open_draft")
|
||||
);
|
||||
|
||||
|
@ -818,13 +818,11 @@ acceptance("Composer", function (needs) {
|
|||
await visit("/t/34");
|
||||
|
||||
await click("#post_1 .d-icon-ellipsis-h");
|
||||
|
||||
await click("#post_1 .d-icon-pencil-alt");
|
||||
|
||||
await fillIn(".d-editor-input", "");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-container textarea").attr("placeholder"),
|
||||
query(".d-editor-container textarea").getAttribute("placeholder"),
|
||||
I18n.t("composer.reply_placeholder"),
|
||||
"it should not block because of missing category"
|
||||
);
|
||||
|
@ -834,7 +832,7 @@ acceptance("Composer", function (needs) {
|
|||
await visit("/t/34");
|
||||
await click("article#post_3 button.reply");
|
||||
assert.strictEqual(
|
||||
queryAll(".save-or-cancel button.create").text().trim(),
|
||||
query(".save-or-cancel button.create").innerText.trim(),
|
||||
I18n.t("composer.create_pm"),
|
||||
"reply button says Message"
|
||||
);
|
||||
|
@ -851,7 +849,7 @@ acceptance("Composer", function (needs) {
|
|||
await click("article#post_3 button.edit");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".save-or-cancel button.create").text().trim(),
|
||||
query(".save-or-cancel button.create").innerText.trim(),
|
||||
I18n.t("composer.save_edit"),
|
||||
"save button says Save Edit"
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
import { setCustomHTML } from "discourse/helpers/custom-html";
|
||||
|
@ -19,7 +19,7 @@ acceptance("CustomHTML set", function () {
|
|||
|
||||
await visit("/static/faq");
|
||||
assert.strictEqual(
|
||||
queryAll("span.custom-html-test").text(),
|
||||
query("span.custom-html-test").innerText,
|
||||
"HTML",
|
||||
"it inserted the markup"
|
||||
);
|
||||
|
@ -32,7 +32,7 @@ acceptance("CustomHTML set", function () {
|
|||
|
||||
await visit("/static/faq");
|
||||
assert.strictEqual(
|
||||
queryAll("span.cookie").text(),
|
||||
query("span.cookie").innerText,
|
||||
"monster",
|
||||
"it inserted the markup"
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { test } from "qunit";
|
||||
import { visit } from "@ember/test-helpers";
|
||||
|
@ -17,7 +17,7 @@ acceptance("CustomHTML template", function (needs) {
|
|||
test("renders custom template", async function (assert) {
|
||||
await visit("/static/faq");
|
||||
assert.strictEqual(
|
||||
queryAll("span.top-span").text(),
|
||||
query("span.top-span").innerText,
|
||||
"TOP",
|
||||
"it inserted the template"
|
||||
);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
acceptance,
|
||||
queryAll,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, settled, visit } from "@ember/test-helpers";
|
||||
import { click, currentRouteName, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
||||
async function catchAbortedTransition() {
|
||||
|
@ -14,7 +13,6 @@ async function catchAbortedTransition() {
|
|||
throw e;
|
||||
}
|
||||
}
|
||||
await settled();
|
||||
}
|
||||
|
||||
acceptance("Enforce Second Factor", function (needs) {
|
||||
|
@ -35,8 +33,8 @@ acceptance("Enforce Second Factor", function (needs) {
|
|||
await catchAbortedTransition();
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".control-label").text(),
|
||||
"Password",
|
||||
currentRouteName(),
|
||||
"preferences.second-factor",
|
||||
"it will not transition from second-factor preferences"
|
||||
);
|
||||
|
||||
|
@ -44,8 +42,8 @@ acceptance("Enforce Second Factor", function (needs) {
|
|||
await click("a.admin-link");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".control-label").text(),
|
||||
"Password",
|
||||
currentRouteName(),
|
||||
"preferences.second-factor",
|
||||
"it stays at second-factor preferences"
|
||||
);
|
||||
});
|
||||
|
@ -59,8 +57,8 @@ acceptance("Enforce Second Factor", function (needs) {
|
|||
await catchAbortedTransition();
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".control-label").text(),
|
||||
"Password",
|
||||
currentRouteName(),
|
||||
"preferences.second-factor",
|
||||
"it will not transition from second-factor preferences"
|
||||
);
|
||||
|
||||
|
@ -68,8 +66,8 @@ acceptance("Enforce Second Factor", function (needs) {
|
|||
await click("a.about-link");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".control-label").text(),
|
||||
"Password",
|
||||
currentRouteName(),
|
||||
"preferences.second-factor",
|
||||
"it stays at second-factor preferences"
|
||||
);
|
||||
});
|
||||
|
@ -83,18 +81,18 @@ acceptance("Enforce Second Factor", function (needs) {
|
|||
|
||||
await catchAbortedTransition();
|
||||
|
||||
assert.notStrictEqual(
|
||||
queryAll(".control-label").text(),
|
||||
"Password",
|
||||
assert.strictEqual(
|
||||
currentRouteName(),
|
||||
"user.summary",
|
||||
"it will transition from second-factor preferences"
|
||||
);
|
||||
|
||||
await click("#toggle-hamburger-menu");
|
||||
await click("a.about-link");
|
||||
|
||||
assert.notStrictEqual(
|
||||
queryAll(".control-label").text(),
|
||||
"Password",
|
||||
assert.strictEqual(
|
||||
currentRouteName(),
|
||||
"about",
|
||||
"it is possible to navigate to other pages"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
@ -91,37 +91,35 @@ acceptance("Group Requests", function (needs) {
|
|||
|
||||
assert.strictEqual(count(".group-members tr"), 2);
|
||||
assert.strictEqual(
|
||||
queryAll(".group-members tr:first-child td:nth-child(1)")
|
||||
.text()
|
||||
.trim()
|
||||
query(".group-members tr:first-child td:nth-child(1)")
|
||||
.innerText.trim()
|
||||
.replace(/\s+/g, " "),
|
||||
"Robin Ward eviltrout"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".group-members tr:first-child td:nth-child(3)").text().trim(),
|
||||
query(".group-members tr:first-child td:nth-child(3)").innerText.trim(),
|
||||
"Please accept my membership request."
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".group-members tr:first-child .btn-primary").text().trim(),
|
||||
query(".group-members tr:first-child .btn-primary").innerText.trim(),
|
||||
"Accept"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".group-members tr:first-child .btn-danger").text().trim(),
|
||||
query(".group-members tr:first-child .btn-danger").innerText.trim(),
|
||||
"Deny"
|
||||
);
|
||||
|
||||
await click(".group-members tr:first-child .btn-primary");
|
||||
assert.ok(
|
||||
queryAll(".group-members tr:first-child td:nth-child(4)")
|
||||
.text()
|
||||
.trim()
|
||||
.indexOf("accepted") === 0
|
||||
query(".group-members tr:first-child td:nth-child(4)")
|
||||
.innerText.trim()
|
||||
.startsWith("accepted")
|
||||
);
|
||||
assert.deepEqual(requests, [["19", "true"]]);
|
||||
|
||||
await click(".group-members tr:last-child .btn-danger");
|
||||
assert.strictEqual(
|
||||
queryAll(".group-members tr:last-child td:nth-child(4)").text().trim(),
|
||||
query(".group-members tr:last-child td:nth-child(4)").innerText.trim(),
|
||||
"denied"
|
||||
);
|
||||
assert.deepEqual(requests, [
|
||||
|
|
|
@ -3,7 +3,6 @@ import {
|
|||
count,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import I18n from "I18n";
|
||||
|
@ -40,7 +39,7 @@ acceptance("Group - Anonymous", function (needs) {
|
|||
|
||||
await click(".activity-nav li a[href='/g/discourse/activity/topics']");
|
||||
|
||||
assert.ok(queryAll(".topic-list"), "it shows the topic list");
|
||||
assert.ok(query(".topic-list"), "it shows the topic list");
|
||||
assert.strictEqual(count(".topic-list-item"), 2, "it lists stream items");
|
||||
|
||||
await click(".activity-nav li a[href='/g/discourse/activity/mentions']");
|
||||
|
@ -192,19 +191,19 @@ acceptance("Group - Authenticated", function (needs) {
|
|||
await click(".group-index-request");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-header .title").text().trim(),
|
||||
query(".modal-header .title").innerText.trim(),
|
||||
I18n.t("groups.membership_request.title", { group_name: "Macdonald" })
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".request-group-membership-form textarea").val(),
|
||||
query(".request-group-membership-form textarea").value,
|
||||
"Please add me"
|
||||
);
|
||||
|
||||
await click(".modal-footer .btn-primary");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".fancy-title").text().trim(),
|
||||
query(".fancy-title").innerText.trim(),
|
||||
"Internationalization / localization"
|
||||
);
|
||||
|
||||
|
@ -239,13 +238,13 @@ acceptance("Group - Authenticated", function (needs) {
|
|||
await click(".nav-pills li a[title='Messages']");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".topic-list-item .link-top-line").text().trim(),
|
||||
query(".topic-list-item .link-top-line").innerText.trim(),
|
||||
"This is a private message 1",
|
||||
"it should display the list of group topics"
|
||||
);
|
||||
|
||||
await click("#search-button");
|
||||
await fillIn("#search-term", "smth");
|
||||
await fillIn("#search-term", "something");
|
||||
|
||||
assert.ok(
|
||||
query(".search-menu .btn.search-context"),
|
||||
|
@ -268,7 +267,7 @@ acceptance("Group - Authenticated", function (needs) {
|
|||
"it displays show group message button"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".group-info-name").text(),
|
||||
query(".group-info-name").innerText,
|
||||
"Awesome Team",
|
||||
"it should display the group name"
|
||||
);
|
||||
|
@ -276,7 +275,7 @@ acceptance("Group - Authenticated", function (needs) {
|
|||
await click(".group-details-button button.btn-danger");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".bootbox .modal-body").html(),
|
||||
query(".bootbox .modal-body").innerHTML,
|
||||
I18n.t("admin.groups.delete_with_messages_confirm", {
|
||||
count: 2,
|
||||
}),
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
count,
|
||||
exists,
|
||||
invisible,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
@ -11,11 +11,9 @@ import { test } from "qunit";
|
|||
acceptance("Groups", function () {
|
||||
test("Browsing Groups", async function (assert) {
|
||||
await visit("/g?username=eviltrout");
|
||||
|
||||
assert.strictEqual(count(".group-box"), 1, "it displays user's groups");
|
||||
|
||||
await visit("/g");
|
||||
|
||||
assert.strictEqual(count(".group-box"), 2, "it displays visible groups");
|
||||
assert.strictEqual(
|
||||
count(".group-index-join"),
|
||||
|
@ -29,27 +27,22 @@ acceptance("Groups", function () {
|
|||
);
|
||||
|
||||
await click(".group-index-join");
|
||||
|
||||
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
||||
|
||||
await click(".login-modal .close");
|
||||
|
||||
assert.ok(invisible(".modal.login-modal"), "it closes the login modal");
|
||||
|
||||
await click(".group-index-request");
|
||||
|
||||
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
||||
|
||||
await click("a[href='/g/discourse/members']");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".group-info-name").text().trim(),
|
||||
query(".group-info-name").innerText.trim(),
|
||||
"Awesome Team",
|
||||
"it displays the group page"
|
||||
);
|
||||
|
||||
await click(".group-index-join");
|
||||
|
||||
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import I18n from "I18n";
|
||||
|
@ -21,6 +21,7 @@ acceptance("New Group - Anonymous", function () {
|
|||
|
||||
acceptance("New Group - Authenticated", function (needs) {
|
||||
needs.user();
|
||||
|
||||
test("Creating a new group", async function (assert) {
|
||||
await visit("/g");
|
||||
await click(".groups-header-new");
|
||||
|
@ -34,7 +35,7 @@ acceptance("New Group - Authenticated", function (needs) {
|
|||
await fillIn("input[name='name']", "1");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".tip.bad").text().trim(),
|
||||
query(".tip.bad").innerText.trim(),
|
||||
I18n.t("admin.groups.new.name.too_short"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
|
@ -51,7 +52,7 @@ acceptance("New Group - Authenticated", function (needs) {
|
|||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".tip.bad").text().trim(),
|
||||
query(".tip.bad").innerText.trim(),
|
||||
I18n.t("admin.groups.new.name.too_long"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
|
@ -59,15 +60,15 @@ acceptance("New Group - Authenticated", function (needs) {
|
|||
await fillIn("input[name='name']", "");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".tip.bad").text().trim(),
|
||||
query(".tip.bad").innerText.trim(),
|
||||
I18n.t("admin.groups.new.name.blank"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
|
||||
await fillIn("input[name='name']", "goodusername");
|
||||
await fillIn("input[name='name']", "good-username");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".tip.good").text().trim(),
|
||||
query(".tip.good").innerText.trim(),
|
||||
I18n.t("admin.groups.new.name.available"),
|
||||
"it should show the right validation tooltip"
|
||||
);
|
||||
|
@ -79,10 +80,11 @@ acceptance("New Group - Authenticated", function (needs) {
|
|||
"it should disable the membership requests checkbox"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
queryAll(".groups-form-default-notification-level .selected-name .name")
|
||||
.text()
|
||||
.trim() === I18n.t("groups.notifications.watching.title"),
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".groups-form-default-notification-level .selected-name .name"
|
||||
).innerText.trim(),
|
||||
I18n.t("groups.notifications.watching.title"),
|
||||
"it has a default selection for notification level"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
acceptance,
|
||||
queryAll,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
|
@ -20,7 +20,7 @@ acceptance(
|
|||
await click(".hamburger-dropdown");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".review .badge-notification.reviewables").text(),
|
||||
query(".review .badge-notification.reviewables").innerText,
|
||||
"3"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
||||
|
@ -32,8 +36,9 @@ category vs tag: #bug vs #bug::tag
|
|||
uppercase hashtag works too #BUG, #BUG::tag`
|
||||
);
|
||||
|
||||
assert.ok(visible(".d-editor-preview"));
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-preview:visible").html().trim(),
|
||||
query(".d-editor-preview").innerHTML.trim(),
|
||||
`<p>this is a category hashtag <a href="/c/bugs" class="hashtag" tabindex=\"-1\">#<span>bug</span></a></p>
|
||||
<p>this is a tag hashtag <a href="/tag/monkey" class="hashtag" tabindex=\"-1\">#<span>monkey</span></a></p>
|
||||
<p>category vs tag: <a href="/c/bugs" class="hashtag" tabindex=\"-1\">#<span>bug</span></a> vs <a href="/tag/bug" class="hashtag" tabindex=\"-1\">#<span>bug</span></a></p>
|
||||
|
|
|
@ -2,7 +2,6 @@ import {
|
|||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { fillIn, visit } from "@ember/test-helpers";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
|
@ -71,12 +70,12 @@ acceptance("Invite accept", function (needs) {
|
|||
is_invite_link: false,
|
||||
});
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".col-form")
|
||||
.text()
|
||||
.includes(I18n.t("invites.social_login_available")),
|
||||
query(".col-form").innerText.includes(
|
||||
I18n.t("invites.social_login_available")
|
||||
),
|
||||
"shows social login hint"
|
||||
);
|
||||
|
||||
|
@ -97,11 +96,11 @@ acceptance("Invite accept", function (needs) {
|
|||
is_invite_link: true,
|
||||
});
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
assert.ok(exists("#new-account-email"), "shows the email input");
|
||||
assert.ok(exists("#new-account-username"), "shows the username input");
|
||||
assert.strictEqual(
|
||||
queryAll("#new-account-username").val(),
|
||||
query("#new-account-username").value,
|
||||
"invited",
|
||||
"username is prefilled"
|
||||
);
|
||||
|
@ -151,7 +150,7 @@ acceptance("Invite accept", function (needs) {
|
|||
"submit is disabled"
|
||||
);
|
||||
|
||||
await fillIn("#new-account-username", "validname");
|
||||
await fillIn("#new-account-username", "valid-name");
|
||||
await fillIn("#new-account-password", "secur3ty4Y0uAndMe");
|
||||
await fillIn("#new-account-email", "john.doe@example.com");
|
||||
assert.ok(exists(".username-input .good"), "username is valid");
|
||||
|
@ -165,7 +164,7 @@ acceptance("Invite accept", function (needs) {
|
|||
|
||||
test("invite name is required only if full name is required", async function (assert) {
|
||||
preloadInvite();
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
assert.ok(exists(".name-input .required"), "Full name is required");
|
||||
});
|
||||
});
|
||||
|
@ -176,7 +175,7 @@ acceptance("Invite accept when local login is disabled", function (needs) {
|
|||
test("invite link", async function (assert) {
|
||||
preloadInvite({ link: true });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(exists(".btn-social.facebook"), "shows Facebook login button");
|
||||
assert.ok(!exists("form"), "does not display the form");
|
||||
|
@ -184,7 +183,7 @@ acceptance("Invite accept when local login is disabled", function (needs) {
|
|||
|
||||
test("email invite link", async function (assert) {
|
||||
preloadInvite();
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(exists(".btn-social.facebook"), "shows Facebook login button");
|
||||
assert.ok(!exists("form"), "does not display the form");
|
||||
|
@ -202,7 +201,7 @@ acceptance(
|
|||
test("invite link", async function (assert) {
|
||||
preloadInvite({ link: true });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(
|
||||
!exists(".btn-social.facebook"),
|
||||
|
@ -219,7 +218,7 @@ acceptance(
|
|||
test("email invite link", async function (assert) {
|
||||
preloadInvite();
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(
|
||||
!exists(".btn-social.facebook"),
|
||||
|
@ -232,7 +231,7 @@ acceptance(
|
|||
);
|
||||
assert.ok(exists(".discourse-connect"), "shows the Continue button");
|
||||
assert.ok(
|
||||
queryAll(".email-message").text().includes("foobar@example.com")
|
||||
query(".email-message").innerText.includes("foobar@example.com")
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -249,7 +248,7 @@ acceptance(
|
|||
test("invite link", async function (assert) {
|
||||
preloadInvite({ link: true });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
assert.ok(!exists("form"), "does not display the form");
|
||||
});
|
||||
}
|
||||
|
@ -269,7 +268,7 @@ acceptance("Invite link with authentication data", function (needs) {
|
|||
test("form elements and buttons are correct ", async function (assert) {
|
||||
preloadInvite({ link: true });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(
|
||||
!exists(".btn-social.facebook"),
|
||||
|
@ -284,18 +283,18 @@ acceptance("Invite link with authentication data", function (needs) {
|
|||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#account-email-validation").text().trim(),
|
||||
query("#account-email-validation").innerText.trim(),
|
||||
I18n.t("user.email.authenticated", { provider: "Facebook" })
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#new-account-username").val(),
|
||||
query("#new-account-username").value,
|
||||
"foobar",
|
||||
"username is prefilled"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#new-account-name").val(),
|
||||
query("#new-account-name").value,
|
||||
"barfoo",
|
||||
"name is prefilled"
|
||||
);
|
||||
|
@ -316,10 +315,10 @@ acceptance("Email Invite link with authentication data", function (needs) {
|
|||
test("email invite link with authentication data when email does not match", async function (assert) {
|
||||
preloadInvite();
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#account-email-validation").text().trim(),
|
||||
query("#account-email-validation").innerText.trim(),
|
||||
I18n.t("user.email.invite_auth_email_invalid", { provider: "Facebook" })
|
||||
);
|
||||
|
||||
|
@ -343,7 +342,7 @@ acceptance(
|
|||
test("confirm form and buttons", async function (assert) {
|
||||
preloadInvite();
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(
|
||||
!exists(".btn-social.facebook"),
|
||||
|
@ -357,18 +356,18 @@ acceptance(
|
|||
assert.ok(!exists("#new-account-email"), "does not show email field");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#account-email-validation").text().trim(),
|
||||
query("#account-email-validation").innerText.trim(),
|
||||
I18n.t("user.email.authenticated", { provider: "Facebook" })
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#new-account-username").val(),
|
||||
query("#new-account-username").value,
|
||||
"foobar",
|
||||
"username is prefilled"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#new-account-name").val(),
|
||||
query("#new-account-name").value,
|
||||
"barfoo",
|
||||
"name is prefilled"
|
||||
);
|
||||
|
@ -392,7 +391,7 @@ acceptance(
|
|||
test("display information that email is invalid", async function (assert) {
|
||||
preloadInvite({ different_external_email: true, hidden_email: true });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".bad").textContent.trim(),
|
||||
|
@ -418,12 +417,12 @@ acceptance(
|
|||
test("confirm form and buttons", async function (assert) {
|
||||
preloadInvite({ email_verified_by_link: true });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(!exists("#new-account-email"), "does not show email field");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#account-email-validation").text().trim(),
|
||||
query("#account-email-validation").innerText.trim(),
|
||||
I18n.t("user.email.authenticated_by_invite")
|
||||
);
|
||||
});
|
||||
|
@ -446,12 +445,12 @@ acceptance(
|
|||
test("confirm form and buttons", async function (assert) {
|
||||
preloadInvite({ email_verified_by_link: false });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(!exists("#new-account-email"), "does not show email field");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#account-email-validation").text().trim(),
|
||||
query("#account-email-validation").innerText.trim(),
|
||||
I18n.t("user.email.ok")
|
||||
);
|
||||
});
|
||||
|
@ -475,7 +474,7 @@ acceptance(
|
|||
test("shows the associate link", async function (assert) {
|
||||
preloadInvite({ link: true });
|
||||
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
await visit("/invites/my-valid-invite-token");
|
||||
|
||||
assert.ok(
|
||||
exists(".create-account-associate-link"),
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
controllerFor,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, settled, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
@ -90,7 +90,7 @@ acceptance("Modal", function (needs) {
|
|||
await settled();
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".d-modal .modal-tab:first-child").text().trim(),
|
||||
query(".d-modal .modal-tab:first-child").innerText.trim(),
|
||||
"Test 1",
|
||||
"it should display the raw title"
|
||||
);
|
||||
|
@ -109,7 +109,7 @@ acceptance("Modal", function (needs) {
|
|||
showModal("test-title", { title: "test_title" });
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
queryAll(".d-modal .title").text().trim(),
|
||||
query(".d-modal .title").innerText.trim(),
|
||||
"Test title",
|
||||
"it should display the title"
|
||||
);
|
||||
|
@ -119,7 +119,7 @@ acceptance("Modal", function (needs) {
|
|||
showModal("test-title-with-body", { title: "test_title" });
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
queryAll(".d-modal .title").text().trim(),
|
||||
query(".d-modal .title").innerText.trim(),
|
||||
"Test title",
|
||||
"it should display the title when used with d-modal-body"
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "I18n";
|
||||
import { test } from "qunit";
|
||||
|
@ -23,7 +23,7 @@ acceptance("Personal Message", function (needs) {
|
|||
await visit("/t/pm-for-testing/12");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll("#suggested-topics .suggested-topics-title").text().trim(),
|
||||
query("#suggested-topics .suggested-topics-title").innerText.trim(),
|
||||
I18n.t("suggested_topics.pm_title")
|
||||
);
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { action } from "@ember/object";
|
||||
|
@ -88,14 +88,14 @@ acceptance("Plugin Outlet - Connector Class", function (needs) {
|
|||
|
||||
await click(".say-hello");
|
||||
assert.strictEqual(
|
||||
queryAll(".hello-result").text(),
|
||||
query(".hello-result").innerText,
|
||||
"hello!",
|
||||
"actions delegate properly"
|
||||
);
|
||||
|
||||
await click(".say-hi");
|
||||
assert.strictEqual(
|
||||
queryAll(".hi-result").text(),
|
||||
query(".hi-result").innerText,
|
||||
"hi!",
|
||||
"actions delegate properly"
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { clearCache } from "discourse/lib/plugin-connectors";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
|
@ -42,12 +42,12 @@ acceptance("Plugin Outlet - Multi Template", function (needs) {
|
|||
"it has class names"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".hello-span").text(),
|
||||
query(".hello-span").innerText,
|
||||
"Hello",
|
||||
"it renders into the outlet"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".bye-span").text(),
|
||||
query(".bye-span").innerText,
|
||||
"Goodbye",
|
||||
"it renders into the outlet"
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
count,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { test } from "qunit";
|
||||
|
@ -31,7 +31,7 @@ acceptance("Plugin Outlet - Single Template", function (needs) {
|
|||
"it has class names"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(".hello-username").text(),
|
||||
query(".hello-username").innerText,
|
||||
"eviltrout",
|
||||
"it renders into the outlet"
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
|
@ -81,7 +81,10 @@ acceptance("User Preferences", function (needs) {
|
|||
test("update some fields", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
|
||||
assert.ok($("body.user-preferences-page").length, "has the body class");
|
||||
assert.ok(
|
||||
document.body.classList.contains("user-preferences-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.strictEqual(
|
||||
currentURL(),
|
||||
"/u/eviltrout/preferences/account",
|
||||
|
@ -93,7 +96,7 @@ acceptance("User Preferences", function (needs) {
|
|||
assert.ok(!exists(".saved"), "it hasn't been saved yet");
|
||||
await click(".save-changes");
|
||||
assert.ok(exists(".saved"), "it displays the saved message");
|
||||
queryAll(".saved").remove();
|
||||
query(".saved").remove();
|
||||
};
|
||||
|
||||
await fillIn(".pref-name input[type=text]", "Jon Snow");
|
||||
|
@ -149,10 +152,10 @@ acceptance("User Preferences", function (needs) {
|
|||
|
||||
assert.ok(exists("#change-email"), "it has the input element");
|
||||
|
||||
await fillIn("#change-email", "invalidemail");
|
||||
await fillIn("#change-email", "invalid-email");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".tip.bad").text().trim(),
|
||||
query(".tip.bad").innerText.trim(),
|
||||
I18n.t("user.email.invalid"),
|
||||
"it should display invalid email tip"
|
||||
);
|
||||
|
@ -180,11 +183,9 @@ acceptance("User Preferences", function (needs) {
|
|||
"it has the connected accounts section"
|
||||
);
|
||||
assert.ok(
|
||||
queryAll(
|
||||
query(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:nth-of-type(1)"
|
||||
)
|
||||
.html()
|
||||
.indexOf("Facebook") > -1,
|
||||
).innerHTML.includes("Facebook"),
|
||||
"it lists facebook"
|
||||
);
|
||||
|
||||
|
@ -192,9 +193,11 @@ acceptance("User Preferences", function (needs) {
|
|||
".pref-associated-accounts table tr:nth-of-type(1) td:last-child button"
|
||||
);
|
||||
|
||||
queryAll(".pref-associated-accounts table tr:nth-of-type(1) td:last button")
|
||||
.html()
|
||||
.indexOf("Connect") > -1;
|
||||
assert.ok(
|
||||
query(
|
||||
".pref-associated-accounts table tr:nth-of-type(1) td:last-of-type"
|
||||
).innerHTML.includes("Connect")
|
||||
);
|
||||
});
|
||||
|
||||
test("second factor totp", async function (assert) {
|
||||
|
@ -212,8 +215,7 @@ acceptance("User Preferences", function (needs) {
|
|||
await click(".add-totp");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".alert-error").html().indexOf("provide a name and the code") >
|
||||
-1,
|
||||
query(".alert-error").innerHTML.includes("provide a name and the code"),
|
||||
"shows name/token missing error message"
|
||||
);
|
||||
});
|
||||
|
@ -238,7 +240,7 @@ acceptance("User Preferences", function (needs) {
|
|||
await click(".add-security-key");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".alert-error").html().indexOf("provide a name") > -1,
|
||||
query(".alert-error").innerHTML.indexOf("provide a name") > -1,
|
||||
"shows name missing error message"
|
||||
);
|
||||
}
|
||||
|
@ -356,7 +358,7 @@ acceptance(
|
|||
)
|
||||
);
|
||||
});
|
||||
test("disallow nonstaff", async function (assert) {
|
||||
test("disallow non-staff", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
await updateCurrentUser({
|
||||
trust_level: 3,
|
||||
|
@ -454,7 +456,10 @@ acceptance("User Preferences when badges are disabled", function (needs) {
|
|||
|
||||
test("visit my preferences", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences");
|
||||
assert.ok($("body.user-preferences-page").length, "has the body class");
|
||||
assert.ok(
|
||||
document.body.classList.contains("user-preferences-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.strictEqual(
|
||||
currentURL(),
|
||||
"/u/eviltrout/preferences/account",
|
||||
|
@ -489,9 +494,9 @@ acceptance(
|
|||
"clear button not present"
|
||||
);
|
||||
|
||||
const selectTopicBtn = queryAll(
|
||||
const selectTopicBtn = query(
|
||||
".feature-topic-on-profile-btn:nth-of-type(1)"
|
||||
)[0];
|
||||
);
|
||||
assert.ok(exists(selectTopicBtn), "feature topic button is present");
|
||||
|
||||
await click(selectTopicBtn);
|
||||
|
@ -501,9 +506,9 @@ acceptance(
|
|||
"topic picker modal is open"
|
||||
);
|
||||
|
||||
const topicRadioBtn = queryAll(
|
||||
const topicRadioBtn = query(
|
||||
'input[name="choose_topic_id"]:nth-of-type(1)'
|
||||
)[0];
|
||||
);
|
||||
assert.ok(exists(topicRadioBtn), "Topic options are prefilled");
|
||||
await click(topicRadioBtn);
|
||||
|
||||
|
@ -616,15 +621,15 @@ acceptance("Security", function (needs) {
|
|||
await visit("/u/eviltrout/preferences/security");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".auth-tokens > .auth-token:nth-of-type(1) .auth-token-device")
|
||||
.text()
|
||||
.trim(),
|
||||
query(
|
||||
".auth-tokens > .auth-token:nth-of-type(1) .auth-token-device"
|
||||
).innerText.trim(),
|
||||
"Linux Computer",
|
||||
"it should display active token first"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".pref-auth-tokens > a:nth-of-type(1)").text().trim(),
|
||||
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"
|
||||
);
|
||||
|
@ -670,7 +675,10 @@ acceptance(
|
|||
test("staged user doesn't show category and tag preferences", async function (assert) {
|
||||
await visit("/u/staged/preferences");
|
||||
|
||||
assert.ok($("body.user-preferences-page").length, "has the body class");
|
||||
assert.ok(
|
||||
document.body.classList.contains("user-preferences-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.strictEqual(
|
||||
currentURL(),
|
||||
"/u/staged/preferences/account",
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
exists,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
queryAll,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import I18n from "I18n";
|
||||
|
@ -67,10 +67,11 @@ acceptance("Review", function (needs) {
|
|||
await reviewableActionDropdown.expand();
|
||||
await reviewableActionDropdown.selectRowByValue("reject_user_delete");
|
||||
|
||||
assert.ok(visible(".reject-reason-reviewable-modal"));
|
||||
assert.ok(
|
||||
queryAll(".reject-reason-reviewable-modal:visible .title")
|
||||
.html()
|
||||
.includes(I18n.t("review.reject_reason.title")),
|
||||
query(".reject-reason-reviewable-modal .title").innerHTML.includes(
|
||||
I18n.t("review.reject_reason.title")
|
||||
),
|
||||
"it opens reject reason modal when user is rejected"
|
||||
);
|
||||
|
||||
|
@ -78,10 +79,11 @@ acceptance("Review", function (needs) {
|
|||
await reviewableActionDropdown.expand();
|
||||
await reviewableActionDropdown.selectRowByValue("reject_user_block");
|
||||
|
||||
assert.ok(visible(".reject-reason-reviewable-modal"));
|
||||
assert.ok(
|
||||
queryAll(".reject-reason-reviewable-modal:visible .title")
|
||||
.html()
|
||||
.includes(I18n.t("review.reject_reason.title")),
|
||||
query(".reject-reason-reviewable-modal .title").innerHTML.includes(
|
||||
I18n.t("review.reject_reason.title")
|
||||
),
|
||||
"it opens reject reason modal when user is rejected and blocked"
|
||||
);
|
||||
});
|
||||
|
@ -110,7 +112,7 @@ acceptance("Review", function (needs) {
|
|||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".reviewable-flagged-post .post-body").html().trim(),
|
||||
query(".reviewable-flagged-post .post-body").innerHTML.trim(),
|
||||
"<b>cooked content</b>"
|
||||
);
|
||||
|
||||
|
@ -135,16 +137,16 @@ acceptance("Review", function (needs) {
|
|||
assert.ok(exists(`${topic} .reviewable-action.approve`));
|
||||
assert.ok(!exists(`${topic} .category-name`));
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .discourse-tag:nth-of-type(1)`).text(),
|
||||
query(`${topic} .discourse-tag:nth-of-type(1)`).innerText,
|
||||
"hello"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .discourse-tag:nth-of-type(2)`).text(),
|
||||
query(`${topic} .discourse-tag:nth-of-type(2)`).innerText,
|
||||
"world"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .post-body`).text().trim(),
|
||||
query(`${topic} .post-body`).innerText.trim(),
|
||||
"existing body"
|
||||
);
|
||||
|
||||
|
@ -164,7 +166,7 @@ acceptance("Review", function (needs) {
|
|||
await fillIn(".editable-field.payload-raw textarea", "new raw contents");
|
||||
await click(`${topic} .reviewable-action.cancel-edit`);
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .post-body`).text().trim(),
|
||||
query(`${topic} .post-body`).innerText.trim(),
|
||||
"existing body",
|
||||
"cancelling does not update the value"
|
||||
);
|
||||
|
@ -186,24 +188,24 @@ acceptance("Review", function (needs) {
|
|||
await click(`${topic} .reviewable-action.save-edit`);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .discourse-tag:nth-of-type(1)`).text(),
|
||||
query(`${topic} .discourse-tag:nth-of-type(1)`).innerText,
|
||||
"hello"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .discourse-tag:nth-of-type(2)`).text(),
|
||||
query(`${topic} .discourse-tag:nth-of-type(2)`).innerText,
|
||||
"world"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .discourse-tag:nth-of-type(3)`).text(),
|
||||
query(`${topic} .discourse-tag:nth-of-type(3)`).innerText,
|
||||
"monkey"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .post-body`).text().trim(),
|
||||
query(`${topic} .post-body`).innerText.trim(),
|
||||
"new raw contents"
|
||||
);
|
||||
assert.strictEqual(
|
||||
queryAll(`${topic} .category-name`).text().trim(),
|
||||
query(`${topic} .category-name`).innerText.trim(),
|
||||
"support"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
@ -41,14 +41,14 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-account-password", "not-activated");
|
||||
await click(".modal-footer .btn-primary");
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-body b").text(),
|
||||
query(".modal-body b").innerText,
|
||||
"<small>eviltrout@example.com</small>"
|
||||
);
|
||||
assert.ok(!exists(".modal-body small"), "it escapes the email address");
|
||||
|
||||
await click(".modal-footer button.resend");
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-body b").text(),
|
||||
query(".modal-body b").innerText,
|
||||
"<small>current@example.com</small>"
|
||||
);
|
||||
assert.ok(!exists(".modal-body small"), "it escapes the email address");
|
||||
|
@ -64,7 +64,7 @@ acceptance("Signing In", function () {
|
|||
await click(".modal-footer .btn-primary");
|
||||
await click(".modal-footer button.edit-email");
|
||||
assert.strictEqual(
|
||||
queryAll(".activate-new-email").val(),
|
||||
query(".activate-new-email").value,
|
||||
"current@example.com"
|
||||
);
|
||||
assert.strictEqual(
|
||||
|
@ -76,7 +76,7 @@ acceptance("Signing In", function () {
|
|||
assert.ok(!exists(".modal-footer .btn-primary:disabled"));
|
||||
await click(".modal-footer .btn-primary");
|
||||
assert.strictEqual(
|
||||
queryAll(".modal-body b").text(),
|
||||
query(".modal-body b").innerText,
|
||||
"different@example.com"
|
||||
);
|
||||
});
|
||||
|
@ -160,7 +160,7 @@ acceptance("Signing In", function () {
|
|||
);
|
||||
await click(".modal-footer .btn-primary");
|
||||
|
||||
await fillIn("#new-account-username", "goodtuna");
|
||||
await fillIn("#new-account-username", "good-tuna");
|
||||
assert.ok(
|
||||
exists("#username-validation.good"),
|
||||
"the username validation is good"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
||||
|
@ -36,7 +40,7 @@ acceptance("Tags intersection", function (needs) {
|
|||
|
||||
assert.ok(exists(".mini-tag-chooser"), "The tag selector appears");
|
||||
assert.strictEqual(
|
||||
$(".composer-fields .mini-tag-chooser").text().trim(),
|
||||
query(".composer-fields .mini-tag-chooser").innerText.trim(),
|
||||
"first, second",
|
||||
"populates the tags when clicking 'New topic'"
|
||||
);
|
||||
|
|
|
@ -107,11 +107,11 @@ acceptance("Tags", function (needs) {
|
|||
test("list the tags", async function (assert) {
|
||||
await visit("/tags");
|
||||
|
||||
assert.ok($("body.tags-page").length, "has the body class");
|
||||
assert.ok(
|
||||
$('*[data-tag-name="eviltrout"]').length,
|
||||
"shows the eviltrout tag"
|
||||
document.body.classList.contains("tags-page"),
|
||||
"has the body class"
|
||||
);
|
||||
assert.ok(exists(`[data-tag-name="eviltrout"]`), "shows the eviltrout tag");
|
||||
});
|
||||
|
||||
test("dismiss notifications", async function (assert) {
|
||||
|
@ -193,40 +193,33 @@ acceptance("Tags listed by group", function (needs) {
|
|||
|
||||
test("list the tags in groups", async function (assert) {
|
||||
await visit("/tags");
|
||||
|
||||
assert.strictEqual(
|
||||
$(".tag-list").length,
|
||||
count(".tag-list"),
|
||||
4,
|
||||
"shows separate lists for the 3 groups and the ungrouped tags"
|
||||
);
|
||||
assert.deepEqual(
|
||||
$(".tag-list h3")
|
||||
.toArray()
|
||||
.map((i) => {
|
||||
return $(i).text();
|
||||
}),
|
||||
[...queryAll(".tag-list h3")].map((el) => el.innerText),
|
||||
["Ford Cars", "Honda Cars", "Makes", "Other Tags"],
|
||||
"shown in given order and with tags that are not in a group"
|
||||
);
|
||||
assert.deepEqual(
|
||||
$(".tag-list:nth-of-type(1) .discourse-tag")
|
||||
.toArray()
|
||||
.map((i) => {
|
||||
return $(i).text();
|
||||
}),
|
||||
[...queryAll(".tag-list:nth-of-type(1) .discourse-tag")].map(
|
||||
(el) => el.innerText
|
||||
),
|
||||
["focus", "Escort"],
|
||||
"shows the tags in default sort (by count)"
|
||||
);
|
||||
assert.deepEqual(
|
||||
$(".tag-list:nth-of-type(1) .discourse-tag")
|
||||
.toArray()
|
||||
.map((i) => {
|
||||
return $(i).attr("href");
|
||||
}),
|
||||
[...queryAll(".tag-list:nth-of-type(1) .discourse-tag")].map((el) =>
|
||||
el.getAttribute("href")
|
||||
),
|
||||
["/tag/focus", "/tag/escort"],
|
||||
"always uses lowercase URLs for mixed case tags"
|
||||
);
|
||||
assert.strictEqual(
|
||||
$("a[data-tag-name='private']").attr("href"),
|
||||
query(`a[data-tag-name="private"]`).getAttribute("href"),
|
||||
"/u/eviltrout/messages/tags/private",
|
||||
"links to private messages"
|
||||
);
|
||||
|
@ -402,7 +395,7 @@ acceptance("Tag info", function (needs) {
|
|||
await click("#show-tag-info");
|
||||
assert.ok(exists(".tag-info .tag-name"), "show tag");
|
||||
assert.ok(
|
||||
queryAll(".tag-info .tag-associations").text().indexOf("Gardening") >= 0,
|
||||
query(".tag-info .tag-associations").innerText.includes("Gardening"),
|
||||
"show tag group names"
|
||||
);
|
||||
assert.strictEqual(
|
||||
|
@ -485,7 +478,7 @@ acceptance("Tag info", function (needs) {
|
|||
await visit("/tag/planters");
|
||||
|
||||
await click(".category-breadcrumb .category-drop-header");
|
||||
await click('.category-breadcrumb .category-row[data-name="faq"]');
|
||||
await click(`.category-breadcrumb .category-row[data-name="faq"]`);
|
||||
|
||||
assert.strictEqual(currentURL(), "/tags/c/faq/4/planters");
|
||||
});
|
||||
|
@ -494,12 +487,12 @@ acceptance("Tag info", function (needs) {
|
|||
await visit("/tag/planters");
|
||||
|
||||
await click(".category-breadcrumb .category-drop-header");
|
||||
await click('.category-breadcrumb .category-row[data-name="feature"]');
|
||||
await click(`.category-breadcrumb .category-row[data-name="feature"]`);
|
||||
assert.strictEqual(currentURL(), "/tags/c/feature/2/planters");
|
||||
|
||||
await click(".category-breadcrumb li:nth-of-type(2) .category-drop-header");
|
||||
await click(
|
||||
'.category-breadcrumb li:nth-of-type(2) .category-row[data-value="no-categories"]'
|
||||
`.category-breadcrumb li:nth-of-type(2) .category-row[data-value="no-categories"]`
|
||||
);
|
||||
assert.strictEqual(currentURL(), "/tags/c/feature/2/none/planters");
|
||||
});
|
||||
|
|
|
@ -3,6 +3,7 @@ import {
|
|||
exists,
|
||||
fakeTime,
|
||||
loggedInUser,
|
||||
query,
|
||||
queryAll,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -48,9 +49,9 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
await click("#tap_tile_start_of_next_business_week");
|
||||
|
||||
const regex = /will automatically close in/g;
|
||||
const html = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.html()
|
||||
.trim();
|
||||
const html = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerHTML.trim();
|
||||
assert.ok(regex.test(html));
|
||||
});
|
||||
|
||||
|
@ -64,18 +65,18 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
await click("#tap_tile_start_of_next_business_week");
|
||||
|
||||
const regex1 = /will automatically close in/g;
|
||||
const html1 = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.html()
|
||||
.trim();
|
||||
const html1 = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerHTML.trim();
|
||||
assert.ok(regex1.test(html1));
|
||||
|
||||
await click("#tap_tile_custom");
|
||||
await fillIn(".tap-tile-date-input .date-picker", "2100-11-24");
|
||||
|
||||
const regex2 = /will automatically close in/g;
|
||||
const html2 = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.html()
|
||||
.trim();
|
||||
const html2 = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerHTML.trim();
|
||||
assert.ok(regex2.test(html2));
|
||||
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
|
@ -88,7 +89,7 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
await fillIn(".relative-time-duration", "2");
|
||||
|
||||
const regex3 = /last post in the topic is already/g;
|
||||
const html3 = queryAll(".edit-topic-timer-modal .warning").html().trim();
|
||||
const html3 = query(".edit-topic-timer-modal .warning").innerHTML.trim();
|
||||
assert.ok(regex3.test(html3));
|
||||
});
|
||||
|
||||
|
@ -106,18 +107,18 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
await click("#tap_tile_start_of_next_business_week");
|
||||
|
||||
const regex1 = /will automatically open in/g;
|
||||
const html1 = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.html()
|
||||
.trim();
|
||||
const html1 = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerHTML.trim();
|
||||
assert.ok(regex1.test(html1));
|
||||
|
||||
await click("#tap_tile_custom");
|
||||
await fillIn(".tap-tile-date-input .date-picker", "2100-11-24");
|
||||
|
||||
const regex2 = /will automatically open in/g;
|
||||
const html2 = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.html()
|
||||
.trim();
|
||||
const html2 = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerHTML.trim();
|
||||
assert.ok(regex2.test(html2));
|
||||
});
|
||||
|
||||
|
@ -141,9 +142,9 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
|
||||
await click("#tap_tile_start_of_next_business_week");
|
||||
|
||||
const text = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.text()
|
||||
.trim();
|
||||
const text = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerText.trim();
|
||||
|
||||
// this needs to be done because there is no simple way to get the
|
||||
// plain text version of a translation with HTML
|
||||
|
@ -181,9 +182,9 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
|
||||
await click("#tap_tile_start_of_next_business_week");
|
||||
|
||||
const text = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.text()
|
||||
.trim();
|
||||
const text = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerText.trim();
|
||||
|
||||
// this needs to be done because there is no simple way to get the
|
||||
// plain text version of a translation with HTML
|
||||
|
@ -225,9 +226,9 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
|
||||
await click("#tap_tile_start_of_next_business_week");
|
||||
|
||||
const text = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.text()
|
||||
.trim();
|
||||
const text = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerText.trim();
|
||||
|
||||
// this needs to be done because there is no simple way to get the
|
||||
// plain text version of a translation with HTML
|
||||
|
@ -274,7 +275,7 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
exists("#tap_tile_last_custom"),
|
||||
"it show last custom because the custom date and time was valid"
|
||||
);
|
||||
const text = queryAll("#tap_tile_last_custom").text().trim();
|
||||
const text = query("#tap_tile_last_custom").innerText.trim();
|
||||
const regex = /Nov 24, 10:30 am/g;
|
||||
assert.ok(regex.test(text));
|
||||
});
|
||||
|
@ -322,9 +323,9 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
await click("#tap_tile_two_weeks");
|
||||
|
||||
const regex = /will be automatically deleted/g;
|
||||
const html = queryAll(".edit-topic-timer-modal .topic-timer-info")
|
||||
.html()
|
||||
.trim();
|
||||
const html = query(
|
||||
".edit-topic-timer-modal .topic-timer-info"
|
||||
).innerHTML.trim();
|
||||
assert.ok(regex.test(html));
|
||||
});
|
||||
|
||||
|
@ -337,12 +338,11 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
await click("#tap_tile_start_of_next_business_week");
|
||||
await click(".edit-topic-timer-buttons button.btn-primary");
|
||||
|
||||
const removeTimerButton = queryAll(".topic-timer-info .topic-timer-remove");
|
||||
assert.strictEqual(removeTimerButton.attr("title"), "remove timer");
|
||||
const removeTimerButton = query(".topic-timer-info .topic-timer-remove");
|
||||
assert.strictEqual(removeTimerButton.getAttribute("title"), "remove timer");
|
||||
|
||||
await click(".topic-timer-info .topic-timer-remove");
|
||||
const topicTimerInfo = queryAll(".topic-timer-info .topic-timer-remove");
|
||||
assert.strictEqual(topicTimerInfo.length, 0);
|
||||
assert.ok(!exists(".topic-timer-info .topic-timer-remove"));
|
||||
});
|
||||
|
||||
test("Shows correct time frame options", async function (assert) {
|
||||
|
@ -353,23 +353,20 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
await click(".toggle-admin-menu");
|
||||
await click(".admin-topic-timer-update button");
|
||||
|
||||
const expected = [
|
||||
I18n.t("time_shortcut.tomorrow"),
|
||||
I18n.t("time_shortcut.this_weekend"),
|
||||
I18n.t("time_shortcut.start_of_next_business_week"),
|
||||
I18n.t("time_shortcut.two_weeks"),
|
||||
I18n.t("time_shortcut.next_month"),
|
||||
I18n.t("time_shortcut.six_months"),
|
||||
I18n.t("time_shortcut.custom"),
|
||||
];
|
||||
|
||||
const options = Array.from(
|
||||
queryAll("div.tap-tile-grid div.tap-tile-title").map((_, div) =>
|
||||
div.innerText.trim()
|
||||
)
|
||||
assert.deepEqual(
|
||||
[...queryAll("div.tap-tile-grid div.tap-tile-title")].map((el) =>
|
||||
el.innerText.trim()
|
||||
),
|
||||
[
|
||||
I18n.t("time_shortcut.tomorrow"),
|
||||
I18n.t("time_shortcut.this_weekend"),
|
||||
I18n.t("time_shortcut.start_of_next_business_week"),
|
||||
I18n.t("time_shortcut.two_weeks"),
|
||||
I18n.t("time_shortcut.next_month"),
|
||||
I18n.t("time_shortcut.six_months"),
|
||||
I18n.t("time_shortcut.custom"),
|
||||
]
|
||||
);
|
||||
|
||||
assert.deepEqual(options, expected);
|
||||
});
|
||||
|
||||
test("Does not show timer notice unless timer set", async function (assert) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import I18n from "I18n";
|
||||
import { test } from "qunit";
|
||||
|
@ -13,7 +13,7 @@ acceptance("Topic move posts", function (needs) {
|
|||
await click("#post_11 .select-below");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".selected-posts .move-to-topic").text().trim(),
|
||||
query(".selected-posts .move-to-topic").innerText.trim(),
|
||||
I18n.t("topic.move_to.action"),
|
||||
"it should show the move to button"
|
||||
);
|
||||
|
@ -21,30 +21,30 @@ acceptance("Topic move posts", function (needs) {
|
|||
await click(".selected-posts .move-to-topic");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .title")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to.title")),
|
||||
query(".choose-topic-modal .title").innerHTML.includes(
|
||||
I18n.t("topic.move_to.title")
|
||||
),
|
||||
"it opens move to modal"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.split_topic.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.split_topic.radio_label")
|
||||
),
|
||||
"it shows an option to move to new topic"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.merge_topic.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.merge_topic.radio_label")
|
||||
),
|
||||
"it shows an option to move to existing topic"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to_new_message.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.move_to_new_message.radio_label")
|
||||
),
|
||||
"it shows an option to move to new message"
|
||||
);
|
||||
});
|
||||
|
@ -57,30 +57,30 @@ acceptance("Topic move posts", function (needs) {
|
|||
await click(".selected-posts .move-to-topic");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .title")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to.title")),
|
||||
query(".choose-topic-modal .title").innerHTML.includes(
|
||||
I18n.t("topic.move_to.title")
|
||||
),
|
||||
"it opens move to modal"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.split_topic.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.split_topic.radio_label")
|
||||
),
|
||||
"it does not show an option to move to new topic"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.merge_topic.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.merge_topic.radio_label")
|
||||
),
|
||||
"it shows an option to move to existing topic"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to_new_message.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.move_to_new_message.radio_label")
|
||||
),
|
||||
"it does not show an option to move to new message"
|
||||
);
|
||||
});
|
||||
|
@ -92,7 +92,7 @@ acceptance("Topic move posts", function (needs) {
|
|||
await click("#post_1 .select-post");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".selected-posts .move-to-topic").text().trim(),
|
||||
query(".selected-posts .move-to-topic").innerText.trim(),
|
||||
I18n.t("topic.move_to.action"),
|
||||
"it should show the move to button"
|
||||
);
|
||||
|
@ -100,23 +100,23 @@ acceptance("Topic move posts", function (needs) {
|
|||
await click(".selected-posts .move-to-topic");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .title")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to.title")),
|
||||
query(".choose-topic-modal .title").innerHTML.includes(
|
||||
I18n.t("topic.move_to.title")
|
||||
),
|
||||
"it opens move to modal"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to_new_message.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.move_to_new_message.radio_label")
|
||||
),
|
||||
"it shows an option to move to new message"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .radios")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to_existing_message.radio_label")),
|
||||
query(".choose-topic-modal .radios").innerHTML.includes(
|
||||
I18n.t("topic.move_to_existing_message.radio_label")
|
||||
),
|
||||
"it shows an option to move to existing message"
|
||||
);
|
||||
});
|
||||
|
@ -128,7 +128,7 @@ acceptance("Topic move posts", function (needs) {
|
|||
await click("#post_2 .select-below");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".selected-posts .move-to-topic").text().trim(),
|
||||
query(".selected-posts .move-to-topic").innerText.trim(),
|
||||
I18n.t("topic.move_to.action"),
|
||||
"it should show the move to button"
|
||||
);
|
||||
|
@ -136,9 +136,9 @@ acceptance("Topic move posts", function (needs) {
|
|||
await click(".selected-posts .move-to-topic");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".choose-topic-modal .title")
|
||||
.html()
|
||||
.includes(I18n.t("topic.move_to.title")),
|
||||
query(".choose-topic-modal .title").innerHTML.includes(
|
||||
I18n.t("topic.move_to.title")
|
||||
),
|
||||
"it opens move to modal"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
acceptance,
|
||||
count,
|
||||
exists,
|
||||
queryAll,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
|
@ -116,8 +116,8 @@ acceptance("Discourse Presence Plugin", function (needs) {
|
|||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val(),
|
||||
queryAll(".topic-post:nth-of-type(1) .cooked > p").text(),
|
||||
query(".d-editor-input").value,
|
||||
query(".topic-post:nth-of-type(1) .cooked > p").innerText,
|
||||
"composer has contents of post to be edited"
|
||||
);
|
||||
|
||||
|
@ -162,7 +162,7 @@ acceptance("Discourse Presence Plugin", function (needs) {
|
|||
await joinChannel("/discourse-presence/reply/280", {
|
||||
id: 123,
|
||||
avatar_template: "/a/b/c.jpg",
|
||||
username: "myusername",
|
||||
username: "my-username",
|
||||
});
|
||||
|
||||
assert.strictEqual(count(avatarSelector), 1, "avatar displayed");
|
||||
|
@ -170,7 +170,7 @@ acceptance("Discourse Presence Plugin", function (needs) {
|
|||
await joinChannel("/discourse-presence/whisper/280", {
|
||||
id: 124,
|
||||
avatar_template: "/a/b/c.jpg",
|
||||
username: "myusername2",
|
||||
username: "my-username2",
|
||||
});
|
||||
|
||||
assert.strictEqual(count(avatarSelector), 2, "whisper avatar displayed");
|
||||
|
@ -199,7 +199,7 @@ acceptance("Discourse Presence Plugin", function (needs) {
|
|||
await joinChannel("/discourse-presence/reply/280", {
|
||||
id: 123,
|
||||
avatar_template: "/a/b/c.jpg",
|
||||
username: "myusername",
|
||||
username: "my-username",
|
||||
});
|
||||
|
||||
assert.strictEqual(count(avatarSelector), 1, "avatar displayed");
|
||||
|
@ -207,7 +207,7 @@ acceptance("Discourse Presence Plugin", function (needs) {
|
|||
await joinChannel("/discourse-presence/whisper/280", {
|
||||
id: 124,
|
||||
avatar_template: "/a/b/c.jpg",
|
||||
username: "myusername2",
|
||||
username: "my-username2",
|
||||
});
|
||||
|
||||
assert.strictEqual(count(avatarSelector), 2, "whisper avatar displayed");
|
||||
|
|
Loading…
Reference in New Issue