DEV: Finish qunit-dom hasText migration
This commit is contained in:
parent
dfb74d90c3
commit
0cf9412291
|
@ -1,20 +1,22 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
acceptance("Admin - Badges - Mass Award", function (needs) {
|
||||
needs.user();
|
||||
|
||||
test("when the badge can be granted multiple times", async function (assert) {
|
||||
await visit("/admin/badges/award/new");
|
||||
await click(
|
||||
'.admin-badge-list-item span[data-badge-name="Both image and icon"]'
|
||||
);
|
||||
assert.strictEqual(
|
||||
query("label.grant-existing-holders").textContent.trim(),
|
||||
i18n("admin.badges.mass_award.grant_existing_holders"),
|
||||
"checkbox for granting existing holders is displayed"
|
||||
);
|
||||
assert
|
||||
.dom("label.grant-existing-holders")
|
||||
.hasText(
|
||||
i18n("admin.badges.mass_award.grant_existing_holders"),
|
||||
"checkbox for granting existing holders is displayed"
|
||||
);
|
||||
});
|
||||
|
||||
test("when the badge can not be granted multiple times", async function (assert) {
|
||||
|
|
|
@ -80,11 +80,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
|
|||
test("modal can be auto-opened with the right query params", async function (assert) {
|
||||
await visit("/admin/customize/themes?repoUrl=testUrl&repoName=testName");
|
||||
assert.dom(".admin-install-theme-modal").exists("modal is visible");
|
||||
assert.strictEqual(
|
||||
query(".install-theme code").textContent.trim(),
|
||||
"testUrl",
|
||||
"repo url is visible"
|
||||
);
|
||||
assert.dom(".install-theme code").hasText("testUrl", "repo url is visible");
|
||||
|
||||
await click(".d-modal-cancel");
|
||||
assert.strictEqual(
|
||||
|
@ -103,12 +99,9 @@ acceptance("Admin - Themes - Install modal", function (needs) {
|
|||
'.popular-theme-item[data-name="Graceful"] .popular-theme-buttons button'
|
||||
)
|
||||
.doesNotExist("no install button is shown for installed themes");
|
||||
assert.strictEqual(
|
||||
query(
|
||||
'.popular-theme-item[data-name="Graceful"] .popular-theme-buttons'
|
||||
).textContent.trim(),
|
||||
i18n("admin.customize.theme.installed")
|
||||
);
|
||||
assert
|
||||
.dom('.popular-theme-item[data-name="Graceful"] .popular-theme-buttons')
|
||||
.hasText(i18n("admin.customize.theme.installed"));
|
||||
|
||||
assert
|
||||
.dom(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { SECOND_FACTOR_METHODS } from "discourse/models/user";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -245,10 +245,7 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await visit("/admin/users/3/user1");
|
||||
await click(".grant-admin");
|
||||
assert.dom(".dialog-content").exists();
|
||||
assert.strictEqual(
|
||||
i18n("admin.user.grant_admin_confirm"),
|
||||
query(".dialog-body").textContent.trim()
|
||||
);
|
||||
assert.dom(".dialog-body").hasText(i18n("admin.user.grant_admin_confirm"));
|
||||
|
||||
await click(".dialog-footer .btn-primary");
|
||||
});
|
||||
|
@ -277,10 +274,9 @@ acceptance("Admin - User Index", function (needs) {
|
|||
await visit("/admin/users/7/jimmy");
|
||||
await click(".disable-second-factor");
|
||||
assert.dom(".dialog-content").exists();
|
||||
assert.strictEqual(
|
||||
i18n("admin.user.disable_second_factor_confirm"),
|
||||
query(".dialog-body").textContent.trim()
|
||||
);
|
||||
assert
|
||||
.dom(".dialog-body")
|
||||
.hasText(i18n("admin.user.disable_second_factor_confirm"));
|
||||
|
||||
await click(".dialog-footer .btn-primary");
|
||||
});
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
acceptance("Admin - Watched Words", function (needs) {
|
||||
|
@ -177,9 +173,9 @@ acceptance("Admin - Watched Words - Emoji Replacement", function (needs) {
|
|||
await click("button.reply-to-post");
|
||||
await fillIn(".d-editor-input", "betis betis betis");
|
||||
|
||||
const cooked = query(".d-editor-preview p");
|
||||
const cookedChildren = Array.from(cooked.children);
|
||||
const emojis = cookedChildren.filter((child) => child.nodeName === "IMG");
|
||||
const emojis = [
|
||||
...document.querySelector(".d-editor-preview p").children,
|
||||
].filter((child) => child.nodeName === "IMG");
|
||||
|
||||
assert.strictEqual(emojis.length, 3, "three emojis have been rendered");
|
||||
assert.true(
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -52,14 +48,13 @@ acceptance("Category Edit - Security", function (needs) {
|
|||
await availableGroups.expand();
|
||||
await availableGroups.selectRowByValue("staff");
|
||||
|
||||
const addedRow = [...queryAll(".row-body")].at(-1);
|
||||
|
||||
assert.dom(".group-name-link", addedRow).hasText("staff");
|
||||
assert.strictEqual(
|
||||
addedRow.querySelectorAll(".d-icon-square-check").length,
|
||||
3,
|
||||
"new row permissions match default 'everyone' permissions"
|
||||
);
|
||||
assert.dom("[data-group-name='staff'] .group-name-link").hasText("staff");
|
||||
assert
|
||||
.dom("[data-group-name='staff'] .d-icon-square-check")
|
||||
.exists(
|
||||
{ count: 3 },
|
||||
"new row permissions match default 'everyone' permissions"
|
||||
);
|
||||
});
|
||||
|
||||
test("adding a previously removed permission", async function (assert) {
|
||||
|
@ -77,14 +72,12 @@ acceptance("Category Edit - Security", function (needs) {
|
|||
|
||||
assert.dom(".row-body").exists("adds back the permission tp the list");
|
||||
|
||||
const firstRow = query(".row-body");
|
||||
|
||||
assert.dom(".group-name-label", firstRow).hasText("everyone");
|
||||
assert.strictEqual(
|
||||
firstRow.querySelectorAll(".d-icon-square-check").length,
|
||||
1,
|
||||
"adds only 'See' permission for a new row"
|
||||
);
|
||||
assert
|
||||
.dom(".row-body[data-group-name='everyone'] .group-name-label")
|
||||
.hasText("everyone");
|
||||
assert
|
||||
.dom(".row-body[data-group-name='everyone'] .d-icon-square-check")
|
||||
.exists({ count: 1 }, "adds only 'See' permission for a new row");
|
||||
});
|
||||
|
||||
test("editing permissions", async function (assert) {
|
||||
|
@ -92,71 +85,66 @@ acceptance("Category Edit - Security", function (needs) {
|
|||
|
||||
await visit("/c/bug/edit/security");
|
||||
|
||||
const everyoneRow = query(".row-body");
|
||||
|
||||
assert.strictEqual(
|
||||
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||
2,
|
||||
"everyone has full permissions by default"
|
||||
);
|
||||
assert
|
||||
.dom(
|
||||
"[data-group-name='everyone'] .reply-granted, [data-group-name='everyone'] .create-granted"
|
||||
)
|
||||
.exists({ count: 2 }, "everyone has full permissions by default");
|
||||
|
||||
await availableGroups.expand();
|
||||
await availableGroups.selectRowByValue("staff");
|
||||
|
||||
const staffRow = [...queryAll(".row-body")].at(-1);
|
||||
assert
|
||||
.dom(
|
||||
"[data-group-name='staff'] .reply-granted, [data-group-name='staff'] .create-granted"
|
||||
)
|
||||
.exists({ count: 2 }, "staff group also has full permissions");
|
||||
|
||||
assert.strictEqual(
|
||||
staffRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||
2,
|
||||
"staff group also has full permissions"
|
||||
);
|
||||
await click("[data-group-name='everyone'] .reply-toggle");
|
||||
|
||||
await click(everyoneRow.querySelector(".reply-toggle"));
|
||||
assert
|
||||
.dom(
|
||||
"[data-group-name='everyone'] .reply-granted, [data-group-name='everyone'] .create-granted"
|
||||
)
|
||||
.doesNotExist("everyone does not have reply or create");
|
||||
|
||||
assert.strictEqual(
|
||||
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||
0,
|
||||
"everyone does not have reply or create"
|
||||
);
|
||||
assert
|
||||
.dom(
|
||||
"[data-group-name='staff'] .reply-granted, [data-group-name='staff'] .create-granted"
|
||||
)
|
||||
.exists({ count: 2 }, "staff group still has full permissions");
|
||||
|
||||
assert.strictEqual(
|
||||
staffRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||
2,
|
||||
"staff group still has full permissions"
|
||||
);
|
||||
await click("[data-group-name='staff'] .reply-toggle");
|
||||
|
||||
await click(staffRow.querySelector(".reply-toggle"));
|
||||
assert
|
||||
.dom(
|
||||
"[data-group-name='everyone'] .reply-granted, [data-group-name='everyone'] .create-granted"
|
||||
)
|
||||
.doesNotExist("everyone permission unchanged");
|
||||
|
||||
assert.strictEqual(
|
||||
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||
0,
|
||||
"everyone permission unchanged"
|
||||
);
|
||||
assert
|
||||
.dom("[data-group-name='staff'] .reply-granted")
|
||||
.doesNotExist("staff does not have reply permission");
|
||||
|
||||
assert.strictEqual(
|
||||
staffRow.querySelectorAll(".reply-granted").length,
|
||||
0,
|
||||
"staff does not have reply permission"
|
||||
);
|
||||
assert
|
||||
.dom("[data-group-name='staff'] .create-granted")
|
||||
.doesNotExist("staff does not have create permission");
|
||||
|
||||
assert.strictEqual(
|
||||
staffRow.querySelectorAll(".create-granted").length,
|
||||
0,
|
||||
"staff does not have create permission"
|
||||
);
|
||||
await click("[data-group-name='everyone'] .create-toggle");
|
||||
|
||||
await click(everyoneRow.querySelector(".create-toggle"));
|
||||
assert
|
||||
.dom(
|
||||
"[data-group-name='everyone'] .reply-granted, [data-group-name='everyone'] .create-granted"
|
||||
)
|
||||
.exists({ count: 2 }, "everyone has full permissions");
|
||||
|
||||
assert.strictEqual(
|
||||
everyoneRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||
2,
|
||||
"everyone has full permissions"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
staffRow.querySelectorAll(".reply-granted, .create-granted").length,
|
||||
2,
|
||||
"staff group has full permissions (inherited from everyone)"
|
||||
);
|
||||
assert
|
||||
.dom(
|
||||
"[data-group-name='staff'] .reply-granted, [data-group-name='staff'] .create-granted"
|
||||
)
|
||||
.exists(
|
||||
{ count: 2 },
|
||||
"staff group has full permissions (inherited from everyone)"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ import { test } from "qunit";
|
|||
import sinon from "sinon";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -184,8 +184,7 @@ acceptance("Category Edit", function (needs) {
|
|||
await fillIn(".email-in", "duplicate@example.com");
|
||||
await click("#save-category");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".dialog-body").textContent.trim(),
|
||||
assert.dom(".dialog-body").hasText(
|
||||
i18n("generic_error_with_reason", {
|
||||
error: "duplicate email",
|
||||
})
|
||||
|
@ -204,8 +203,7 @@ acceptance("Category Edit", function (needs) {
|
|||
|
||||
await click("#save-category");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".dialog-body").textContent.trim(),
|
||||
assert.dom(".dialog-body").hasText(
|
||||
i18n("generic_error_with_reason", {
|
||||
error: "subcategory nested under another subcategory",
|
||||
})
|
||||
|
|
|
@ -70,10 +70,9 @@ acceptance("Composer Actions", function (needs) {
|
|||
assert
|
||||
.dom(".action-title .topic-link")
|
||||
.hasAttribute("href", "/t/internationalization-localization/280");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"test replying to topic when initially replied to post"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("test replying to topic when initially replied to post");
|
||||
});
|
||||
|
||||
test("replying to post - toggle_whisper for whisperers", async function (assert) {
|
||||
|
@ -409,10 +408,9 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
|
|||
await composerActions.selectRowByValue("shared_draft");
|
||||
|
||||
assert.strictEqual(tags.header().value(), "monkey", "tags are not reset");
|
||||
assert.strictEqual(
|
||||
query("#reply-title").value,
|
||||
"This is the new text for the title using 'quotes'"
|
||||
);
|
||||
assert
|
||||
.dom("#reply-title")
|
||||
.hasValue("This is the new text for the title using 'quotes'");
|
||||
|
||||
assert
|
||||
.dom("#reply-control .btn-primary.create .d-button-label")
|
||||
|
@ -437,11 +435,7 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
|
|||
.hasText(i18n("composer.composer_actions.reply_as_new_topic.confirm"));
|
||||
await click(".dialog-footer .btn-primary");
|
||||
|
||||
assert.true(
|
||||
query(".d-editor-input").value.startsWith(
|
||||
"Continuing the discussion from"
|
||||
)
|
||||
);
|
||||
assert.dom(".d-editor-input").hasValue(/^Continuing the discussion from/);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -463,10 +457,11 @@ acceptance("Prioritize Username", function (needs) {
|
|||
await visit("/t/short-topic-with-two-posts/54079");
|
||||
await selectText("#post_2 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
'[quote="james_john, post:2, topic:54079, full:true"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
'[quote="james_john, post:2, topic:54079, full:true"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -490,20 +485,22 @@ acceptance("Prioritize Full Name", function (needs) {
|
|||
await visit("/t/short-topic-with-two-posts/54079");
|
||||
await selectText("#post_2 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
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]'
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
'[quote="james, john, the third, post:2, topic:54079, full:true, username:james_john"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
});
|
||||
|
||||
test("Quoting a nested quote returns the correct username", async function (assert) {
|
||||
await visit("/t/short-topic-with-two-posts/54079");
|
||||
await selectText("#post_4 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
'[quote="james_john, post:2, topic:54079"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
'[quote="james_john, post:2, topic:54079"]\nThis is a short topic.\n[/quote]'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -519,9 +516,10 @@ acceptance("Prioritizing Name fall back", function (needs) {
|
|||
// select a user with no name
|
||||
await selectText("#post_1 p");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
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]'
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
'[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 { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Composer - Hyperlink", function (needs) {
|
||||
needs.user();
|
||||
|
@ -50,7 +50,7 @@ acceptance("Composer - Hyperlink", function (needs) {
|
|||
.dom(".insert-link.d-modal__body")
|
||||
.doesNotExist("modal dismissed after cancelling");
|
||||
|
||||
const textarea = query("#reply-control .d-editor-input");
|
||||
const textarea = document.querySelector("#reply-control .d-editor-input");
|
||||
textarea.selectionStart = 0;
|
||||
textarea.selectionEnd = 6;
|
||||
await click(".d-editor button.link");
|
||||
|
|
|
@ -194,12 +194,11 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
const done = assert.async();
|
||||
appEvents.on("composer:uploads-aborted", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".dialog-body").textContent.trim(),
|
||||
assert.dom(".dialog-body").hasText(
|
||||
i18n("post.errors.too_many_dragged_and_dropped_files", {
|
||||
count: 2,
|
||||
}),
|
||||
"it should warn about too many files added"
|
||||
"warns about too many files added"
|
||||
);
|
||||
|
||||
await click(".dialog-footer .btn-primary");
|
||||
|
@ -219,15 +218,14 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
|
||||
appEvents.on("composer:uploads-aborted", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".dialog-body").textContent.trim(),
|
||||
assert.dom(".dialog-body").hasText(
|
||||
i18n("post.errors.upload_not_authorized", {
|
||||
authorized_extensions: authorizedExtensions(
|
||||
false,
|
||||
this.siteSettings
|
||||
).join(", "),
|
||||
}),
|
||||
"it should warn about unauthorized extensions"
|
||||
"warns about unauthorized extensions"
|
||||
);
|
||||
|
||||
await click(".dialog-footer .btn-primary");
|
||||
|
@ -502,11 +500,12 @@ acceptance("Uppy Composer Attachment - Upload Error", function (needs) {
|
|||
|
||||
appEvents.on("composer:upload-error", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".dialog-body").textContent.trim(),
|
||||
"There was an error uploading the file, the gif was way too cool.",
|
||||
"it should show the error message from the server"
|
||||
);
|
||||
assert
|
||||
.dom(".dialog-body")
|
||||
.hasText(
|
||||
"There was an error uploading the file, the gif was way too cool.",
|
||||
"shows the error message from the server"
|
||||
);
|
||||
|
||||
await click(".dialog-footer .btn-primary");
|
||||
done();
|
||||
|
@ -591,11 +590,12 @@ acceptance("Uppy Composer Attachment - Upload Handler", function (needs) {
|
|||
|
||||
appEvents.on("composer:uploads-aborted", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".dialog-body").textContent.trim(),
|
||||
"This is an upload handler test for handler-test.png. The file WAS a native file object.",
|
||||
"it should show the dialog triggered by the upload handler"
|
||||
);
|
||||
assert
|
||||
.dom(".dialog-body")
|
||||
.hasText(
|
||||
"This is an upload handler test for handler-test.png. The file WAS a native file object.",
|
||||
"shows the dialog triggered by the upload handler"
|
||||
);
|
||||
await click(".dialog-footer .btn-primary");
|
||||
done();
|
||||
});
|
||||
|
|
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
|||
import DoNotDisturb from "discourse/lib/do-not-disturb";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -88,11 +87,12 @@ acceptance("Do not disturb", function (needs) {
|
|||
|
||||
await click(".header-dropdown-toggle.current-user button");
|
||||
await click("#user-menu-button-profile");
|
||||
assert.strictEqual(
|
||||
query(".do-not-disturb .relative-date").textContent.trim(),
|
||||
"1h",
|
||||
"the Do Not Disturb button shows how much time is left for DND mode"
|
||||
);
|
||||
assert
|
||||
.dom(".do-not-disturb .relative-date")
|
||||
.hasText(
|
||||
"1h",
|
||||
"the Do Not Disturb button shows how much time is left for DND mode"
|
||||
);
|
||||
assert
|
||||
.dom(".do-not-disturb .d-icon-toggle-on")
|
||||
.exists("the Do Not Disturb button has the toggle-on icon");
|
||||
|
|
|
@ -55,17 +55,19 @@ acceptance(
|
|||
await click(".notification.edited a");
|
||||
const [v1, v2] = queryAll(".history-modal .revision-content");
|
||||
|
||||
assert.strictEqual(
|
||||
v1.textContent.trim(),
|
||||
"Hello world this is a test",
|
||||
"history modal for the edited post is shown"
|
||||
);
|
||||
assert
|
||||
.dom(v1)
|
||||
.hasText(
|
||||
"Hello world this is a test",
|
||||
"history modal for the edited post is shown"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
v2.textContent.trim(),
|
||||
"Hello world this is a testThis is an edit!",
|
||||
"history modal for the edited post is shown"
|
||||
);
|
||||
assert
|
||||
.dom(v2)
|
||||
.hasText(
|
||||
"Hello world this is a testThis is an edit!",
|
||||
"history modal for the edited post is shown"
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -257,12 +257,11 @@ acceptance("Group - Authenticated", function (needs) {
|
|||
|
||||
await click(".group-details-button button.btn-danger");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".dialog-body p:nth-of-type(2)").textContent.trim(),
|
||||
assert.dom(".dialog-body p:nth-of-type(2)").hasText(
|
||||
i18n("admin.groups.delete_with_messages_confirm", {
|
||||
count: 2,
|
||||
}),
|
||||
"should warn about orphan messages"
|
||||
"warns about orphan messages"
|
||||
);
|
||||
|
||||
await click(".dialog-footer .btn-default");
|
||||
|
|
|
@ -148,38 +148,28 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await visit("/tag/important");
|
||||
await click("#search-button");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".search-link .label-suffix").textContent.trim(),
|
||||
i18n("search.in"),
|
||||
"first option includes suffix"
|
||||
);
|
||||
assert
|
||||
.dom(".search-link .label-suffix")
|
||||
.hasText(i18n("search.in"), "first option includes suffix");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".search-link .search-item-tag").textContent.trim(),
|
||||
"important",
|
||||
"first option includes tag"
|
||||
);
|
||||
assert
|
||||
.dom(".search-link .search-item-tag")
|
||||
.hasText("important", "first option includes tag");
|
||||
|
||||
await fillIn("#search-term", "smth");
|
||||
const secondOption = queryAll(contextSelector)[1];
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".search-item-prefix").textContent.trim(),
|
||||
"smth",
|
||||
"second option includes term"
|
||||
);
|
||||
assert
|
||||
.dom(".search-item-prefix", secondOption)
|
||||
.hasText("smth", "second option includes term");
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".label-suffix").textContent.trim(),
|
||||
i18n("search.in"),
|
||||
"second option includes suffix"
|
||||
);
|
||||
assert
|
||||
.dom(".label-suffix", secondOption)
|
||||
.hasText(i18n("search.in"), "second option includes suffix");
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".search-item-tag").textContent.trim(),
|
||||
"important",
|
||||
"second option includes tag"
|
||||
);
|
||||
assert
|
||||
.dom(".search-item-tag", secondOption)
|
||||
.hasText("important", "second option includes tag");
|
||||
});
|
||||
|
||||
test("initial options - category search scope", async function (assert) {
|
||||
|
@ -189,23 +179,17 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await fillIn("#search-term", "smth");
|
||||
const secondOption = queryAll(contextSelector)[1];
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".search-item-prefix").textContent.trim(),
|
||||
"smth",
|
||||
"second option includes term"
|
||||
);
|
||||
assert
|
||||
.dom(".search-item-prefix", secondOption)
|
||||
.hasText("smth", "second option includes term");
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".label-suffix").textContent.trim(),
|
||||
i18n("search.in"),
|
||||
"second option includes suffix"
|
||||
);
|
||||
assert
|
||||
.dom(".label-suffix", secondOption)
|
||||
.hasText(i18n("search.in"), "second option includes suffix");
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".badge-category__name").textContent.trim(),
|
||||
"bug",
|
||||
"second option includes category slug"
|
||||
);
|
||||
assert
|
||||
.dom(".badge-category__name", secondOption)
|
||||
.hasText("bug", "second option includes category slug");
|
||||
|
||||
assert
|
||||
.dom(`${contextSelector} span.badge-category__wrapper`)
|
||||
|
@ -219,17 +203,13 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await fillIn("#search-term", "smth");
|
||||
const secondOption = queryAll(contextSelector)[1];
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".search-item-prefix").textContent.trim(),
|
||||
"smth",
|
||||
"second option includes term"
|
||||
);
|
||||
assert
|
||||
.dom(secondOption, ".search-item-prefix")
|
||||
.hasText("smth", "second option includes term");
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".label-suffix").textContent.trim(),
|
||||
i18n("search.in_this_topic"),
|
||||
"second option includes suffix"
|
||||
);
|
||||
assert
|
||||
.dom(secondOption, ".label-suffix")
|
||||
.hasText(i18n("search.in_this_topic"), "second option includes suffix");
|
||||
});
|
||||
|
||||
test("initial options - topic search scope - 'in all topics' searches in all topics", async function (assert) {
|
||||
|
@ -284,21 +264,23 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await fillIn("#search-term", "@admin");
|
||||
|
||||
assert.dom(".search-menu-assistant-item").exists({ count: 2 });
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".search-menu-assistant-item:first-child .search-item-slug .label-suffix"
|
||||
).textContent.trim(),
|
||||
i18n("search.in_topics_posts"),
|
||||
"first result hints at global search"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("search.in_topics_posts"),
|
||||
"first result hints at global search"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".search-menu-assistant-item:nth-child(2) .search-item-slug .label-suffix"
|
||||
).textContent.trim(),
|
||||
i18n("search.in_this_topic"),
|
||||
"second result hints at search within current topic"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("search.in_this_topic"),
|
||||
"second result hints at search within current topic"
|
||||
);
|
||||
});
|
||||
|
||||
test("initial options - user search scope", async function (assert) {
|
||||
|
@ -308,17 +290,16 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await fillIn("#search-term", "smth");
|
||||
const secondOption = queryAll(contextSelector)[1];
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".search-item-prefix").textContent.trim(),
|
||||
"smth",
|
||||
"second option includes term for user-scoped search"
|
||||
);
|
||||
assert
|
||||
.dom(".search-item-prefix", secondOption)
|
||||
.hasText("smth", "second option includes term for user-scoped search");
|
||||
|
||||
assert.strictEqual(
|
||||
secondOption.querySelector(".label-suffix").textContent.trim(),
|
||||
i18n("search.in_posts_by", { username: "eviltrout" }),
|
||||
"second option includes suffix for user-scoped search"
|
||||
);
|
||||
assert
|
||||
.dom(".label-suffix", secondOption)
|
||||
.hasText(
|
||||
i18n("search.in_posts_by", { username: "eviltrout" }),
|
||||
"second option includes suffix for user-scoped search"
|
||||
);
|
||||
});
|
||||
|
||||
test("topic results", async function (assert) {
|
||||
|
@ -349,22 +330,16 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
.dom(".search-menu .search-result-post ul li")
|
||||
.exists("clicking second option scopes search to current topic");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#post_7 span.highlighted").textContent.trim(),
|
||||
"a proper",
|
||||
"highlights the post correctly"
|
||||
);
|
||||
assert
|
||||
.dom("#post_7 span.highlighted")
|
||||
.hasText("a proper", "highlights the post correctly");
|
||||
|
||||
assert
|
||||
.dom(".search-menu .search-context")
|
||||
.exists("search context indicator is visible");
|
||||
|
||||
await click(".clear-search");
|
||||
assert.strictEqual(
|
||||
query("#search-term").textContent.trim(),
|
||||
"",
|
||||
"clear button works"
|
||||
);
|
||||
assert.dom("#search-term").hasNoText("clear button works");
|
||||
|
||||
await click(".search-context");
|
||||
assert
|
||||
|
@ -688,21 +663,13 @@ acceptance("Search - Authenticated", function (needs) {
|
|||
await visit("/");
|
||||
await click("#search-button");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".search-menu .search-menu-recent li:nth-of-type(1) .search-link"
|
||||
).textContent.trim(),
|
||||
"yellow",
|
||||
"shows first recent search"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-menu-recent li:nth-of-type(1) .search-link")
|
||||
.hasText("yellow", "shows first recent search");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".search-menu .search-menu-recent li:nth-of-type(2) .search-link"
|
||||
).textContent.trim(),
|
||||
"blue",
|
||||
"shows second recent search"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .search-menu-recent li:nth-of-type(2) .search-link")
|
||||
.hasText("blue", "shows second recent search");
|
||||
|
||||
await click(
|
||||
".search-menu .search-menu-recent li:nth-of-type(1) .search-link"
|
||||
|
@ -818,13 +785,9 @@ acceptance("Search - with tagging enabled", function (needs) {
|
|||
await fillIn("#search-term", "dev");
|
||||
await triggerKeyEvent("#search-term", "keyup", 13);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".search-menu .results ul li:nth-of-type(1) .discourse-tags"
|
||||
).textContent.trim(),
|
||||
"devslow",
|
||||
"tags displayed in search results"
|
||||
);
|
||||
assert
|
||||
.dom(".search-menu .results ul li:nth-of-type(1) .discourse-tags")
|
||||
.hasText("devslow", "tags displayed in search results");
|
||||
});
|
||||
|
||||
test("initial options - topic search scope - selecting a tag defaults to searching 'in all topics'", async function (assert) {
|
||||
|
@ -847,9 +810,7 @@ acceptance("Search - with tagging enabled", function (needs) {
|
|||
".search-menu .results ul.search-menu-assistant .search-link";
|
||||
|
||||
assert.dom(firstItem).exists();
|
||||
|
||||
const firstTag = query(`${firstItem} .search-item-tag`).textContent.trim();
|
||||
assert.strictEqual(firstTag, "monkey");
|
||||
assert.dom(`${firstItem} .search-item-tag`).hasText("monkey");
|
||||
});
|
||||
|
||||
test("initial options - search history - tag context", async function (assert) {
|
||||
|
|
|
@ -22,31 +22,11 @@ acceptance("Sidebar - Anonymous - Categories Section", function (needs) {
|
|||
.sort((a, b) => b.topic_count - a.topic_count);
|
||||
|
||||
assert.strictEqual(categorySectionLinks.length, 6);
|
||||
|
||||
assert.strictEqual(
|
||||
categorySectionLinks[0].textContent.trim(),
|
||||
sidebarCategories[0].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categorySectionLinks[1].textContent.trim(),
|
||||
sidebarCategories[1].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categorySectionLinks[2].textContent.trim(),
|
||||
sidebarCategories[2].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categorySectionLinks[3].textContent.trim(),
|
||||
sidebarCategories[3].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categorySectionLinks[4].textContent.trim(),
|
||||
sidebarCategories[4].name
|
||||
);
|
||||
assert.dom(categorySectionLinks[0]).hasText(sidebarCategories[0].name);
|
||||
assert.dom(categorySectionLinks[1]).hasText(sidebarCategories[1].name);
|
||||
assert.dom(categorySectionLinks[2]).hasText(sidebarCategories[2].name);
|
||||
assert.dom(categorySectionLinks[3]).hasText(sidebarCategories[3].name);
|
||||
assert.dom(categorySectionLinks[4]).hasText(sidebarCategories[4].name);
|
||||
|
||||
assert
|
||||
.dom("a.sidebar-section-link[data-link-name='all-categories']")
|
||||
|
@ -65,31 +45,11 @@ acceptance("Sidebar - Anonymous - Categories Section", function (needs) {
|
|||
const siteCategories = Site.current().categories;
|
||||
|
||||
assert.strictEqual(categories.length, 6);
|
||||
|
||||
assert.strictEqual(
|
||||
categories[0].textContent.trim(),
|
||||
siteCategories[0].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categories[1].textContent.trim(),
|
||||
siteCategories[1].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categories[2].textContent.trim(),
|
||||
siteCategories[3].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categories[3].textContent.trim(),
|
||||
siteCategories[4].name
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
categories[4].textContent.trim(),
|
||||
siteCategories[5].name
|
||||
);
|
||||
assert.dom(categories[0]).hasText(siteCategories[0].name);
|
||||
assert.dom(categories[1]).hasText(siteCategories[1].name);
|
||||
assert.dom(categories[2]).hasText(siteCategories[3].name);
|
||||
assert.dom(categories[3]).hasText(siteCategories[4].name);
|
||||
assert.dom(categories[4]).hasText(siteCategories[5].name);
|
||||
|
||||
assert
|
||||
.dom("a.sidebar-section-link[data-link-name='all-categories']")
|
||||
|
@ -107,9 +67,9 @@ acceptance("Sidebar - Anonymous - Categories Section", function (needs) {
|
|||
);
|
||||
|
||||
assert.strictEqual(categories.length, 4);
|
||||
assert.strictEqual(categories[0].textContent.trim(), "meta");
|
||||
assert.strictEqual(categories[1].textContent.trim(), "blog");
|
||||
assert.strictEqual(categories[2].textContent.trim(), "bug");
|
||||
assert.dom(categories[0]).hasText("meta");
|
||||
assert.dom(categories[1]).hasText("blog");
|
||||
assert.dom(categories[2]).hasText("bug");
|
||||
|
||||
assert
|
||||
.dom("a.sidebar-section-link[data-link-name='all-categories']")
|
||||
|
|
|
@ -14,15 +14,14 @@ acceptance("Sidebar - Anonymous user - Community Section", function (needs) {
|
|||
test("topics section link is shown by default ", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
const sectionLinks = queryAll(
|
||||
".sidebar-section[data-section-name='community'] .sidebar-section-link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
sectionLinks[0].textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.topics.content"),
|
||||
"displays the topics section link first"
|
||||
);
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='community'] .sidebar-section-link"
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.topics.content"),
|
||||
"displays the topics section link first"
|
||||
);
|
||||
});
|
||||
|
||||
test("users section link is not shown when hide_user_profiles_from_public site setting is enabled", async function (assert) {
|
||||
|
@ -48,34 +47,39 @@ acceptance("Sidebar - Anonymous user - Community Section", function (needs) {
|
|||
".sidebar-more-section-links-details-content-main .sidebar-section-link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
sectionLinks[0].textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.users.content"),
|
||||
"displays the users section link second"
|
||||
);
|
||||
assert
|
||||
.dom(sectionLinks[0])
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.users.content"),
|
||||
"displays the users section link second"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
sectionLinks[1].textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.about.content"),
|
||||
"displays the about section link third"
|
||||
);
|
||||
assert
|
||||
.dom(sectionLinks[1])
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.about.content"),
|
||||
"displays the about section link third"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
sectionLinks[2].textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.faq.content"),
|
||||
"displays the FAQ section link last"
|
||||
);
|
||||
assert
|
||||
.dom(sectionLinks[2])
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.faq.content"),
|
||||
"displays the FAQ section link last"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
sectionLinks[3].textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.groups.content"),
|
||||
"displays the groups section link first"
|
||||
);
|
||||
assert
|
||||
.dom(sectionLinks[3])
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.groups.content"),
|
||||
"displays the groups section link first"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
sectionLinks[4].textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.badges.content"),
|
||||
"displays the badges section link second"
|
||||
);
|
||||
assert
|
||||
.dom(sectionLinks[4])
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.badges.content"),
|
||||
"displays the badges section link second"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,7 +8,6 @@ import discoveryFixture from "discourse/tests/fixtures/discovery-fixtures";
|
|||
import {
|
||||
acceptance,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
queryAll,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -433,13 +432,9 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
|||
"category1 section link is rendered with solid prefix icon color"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category1.id}"]`
|
||||
).textContent.trim(),
|
||||
category1.name,
|
||||
"displays category1's name for the link text"
|
||||
);
|
||||
assert
|
||||
.dom(`.sidebar-section-link-wrapper[data-category-id="${category1.id}"]`)
|
||||
.hasText(category1.name, "displays category1's name for the link text");
|
||||
|
||||
await click(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category1.id}"] a`
|
||||
|
@ -890,21 +885,23 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category1.id}"] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for ${category1.slug} section link`
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for ${category1.slug} section link`
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category2.id}"] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.unread_count", { count: 2 }),
|
||||
`displays 2 unread count for ${category2.slug} section link`
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.unread_count", { count: 2 }),
|
||||
`displays 2 unread count for ${category2.slug} section link`
|
||||
);
|
||||
|
||||
await publishToMessageBus("/unread", {
|
||||
topic_id: 2,
|
||||
|
@ -915,13 +912,14 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category1.id}"] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.new_count", { count: 1 }),
|
||||
`displays 1 new count for ${category1.slug} section link`
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.new_count", { count: 1 }),
|
||||
`displays 1 new count for ${category1.slug} section link`
|
||||
);
|
||||
|
||||
await publishToMessageBus("/unread", {
|
||||
topic_id: 1,
|
||||
|
@ -949,13 +947,14 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category2.id}"] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for ${category2.slug} section link`
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for ${category2.slug} section link`
|
||||
);
|
||||
});
|
||||
|
||||
test("clean up topic tracking state state changed callbacks when Sidebar is collapsed", async function (assert) {
|
||||
|
@ -1081,29 +1080,26 @@ acceptance(
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category1.id}"] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
"2",
|
||||
"count for category1 is 2 because it has 1 unread topic and 1 new topic"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
"2",
|
||||
"count for category1 is 2 because it has 1 unread topic and 1 new topic"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category2.id}"] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
"1",
|
||||
"count for category2 is 1 because it has 1 new topic"
|
||||
);
|
||||
)
|
||||
.hasText("1", "count for category2 is 1 because it has 1 new topic");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-category-id="${category3.id}"] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
"1",
|
||||
"count for category3 is 1 because it has 1 unread topic"
|
||||
);
|
||||
)
|
||||
.hasText("1", "count for category3 is 1 because it has 1 unread topic");
|
||||
});
|
||||
|
||||
test("dot shown next to category link when sidebar_show_count_of_new_items is false", async function (assert) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
acceptance,
|
||||
loggedInUser,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
|
@ -278,13 +277,14 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
)
|
||||
.exists("the users link is marked as active");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='community'] .sidebar-more-section-links-details-summary .sidebar-section-link-content-text"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.more"),
|
||||
"displays the right count as users link is currently active"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.more"),
|
||||
"displays the right count as users link is currently active"
|
||||
);
|
||||
|
||||
await visit("/u");
|
||||
|
||||
|
@ -382,13 +382,14 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
)
|
||||
.exists("the groups link is marked as active");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='community'] .sidebar-more-section-links-details-summary .sidebar-section-link-content-text"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.more"),
|
||||
"displays the right count as groups link is currently active"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.more"),
|
||||
"displays the right count as groups link is currently active"
|
||||
);
|
||||
|
||||
await visit("/g");
|
||||
|
||||
|
@ -608,32 +609,30 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
});
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".sidebar-section-link[data-link-name='my-posts']"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.my_posts.content"),
|
||||
"displays the default text when no drafts are present"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link[data-link-name='my-posts']")
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.my_posts.content"),
|
||||
"displays the default text when no drafts are present"
|
||||
);
|
||||
|
||||
await publishToMessageBus(`/user-drafts/${loggedInUser().id}`, {
|
||||
draft_count: 1,
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section-link[data-link-name='my-posts'] .sidebar-section-link-content-text"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.community.links.my_posts.content_drafts"),
|
||||
"displays the text that's appropriate for when drafts are present"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query(
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.community.links.my_posts.content_drafts"),
|
||||
"displays the text that's appropriate for when drafts are present"
|
||||
);
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section-link[data-link-name='my-posts'] .sidebar-section-link-content-badge"
|
||||
).textContent.trim(),
|
||||
"1",
|
||||
"displays the draft count with no text"
|
||||
);
|
||||
)
|
||||
.hasText("1", "displays the draft count with no text");
|
||||
});
|
||||
|
||||
test("the invite section link is not visible to people who cannot invite to the forum", async function (assert) {
|
||||
|
@ -847,13 +846,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section-link[data-link-name='everything'] .sidebar-section-link-content-badge"
|
||||
).textContent.trim(),
|
||||
"3 unread",
|
||||
"displays the right unread count"
|
||||
);
|
||||
)
|
||||
.hasText("3 unread", "displays the right unread count");
|
||||
|
||||
// simulate reading topic 2
|
||||
await publishToMessageBus("/unread", {
|
||||
|
@ -866,13 +863,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section-link[data-link-name='everything'] .sidebar-section-link-content-badge"
|
||||
).textContent.trim(),
|
||||
"2 unread",
|
||||
"updates the unread count"
|
||||
);
|
||||
)
|
||||
.hasText("2 unread", "updates the unread count");
|
||||
|
||||
// simulate reading topic 3
|
||||
await publishToMessageBus("/unread", {
|
||||
|
@ -896,13 +891,14 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section-link[data-link-name='everything'] .sidebar-section-link-content-badge"
|
||||
).textContent.trim(),
|
||||
"1 new",
|
||||
"displays the new count once there are no unread topics"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
"1 new",
|
||||
"displays the new count once there are no unread topics"
|
||||
);
|
||||
|
||||
await publishToMessageBus("/unread", {
|
||||
topic_id: 1,
|
||||
|
@ -989,13 +985,11 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
)
|
||||
.exists("review link is shown as part of the main section links");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='community'] .sidebar-section-link[data-link-name='review'] .sidebar-section-link-content-badge"
|
||||
).textContent.trim(),
|
||||
"34 pending",
|
||||
"displays the pending reviewable count"
|
||||
);
|
||||
)
|
||||
.hasText("34 pending", "displays the pending reviewable count");
|
||||
|
||||
await click(
|
||||
".sidebar-section[data-section-name='community'] .sidebar-more-section-links-details-summary"
|
||||
|
@ -1025,13 +1019,9 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
".sidebar-section[data-section-name='community'] .sidebar-more-section-links-details-summary"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".sidebar-section-link[data-link-name='unread']"
|
||||
).textContent.trim(),
|
||||
"unread topics",
|
||||
"displays the right text for the link"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link[data-link-name='unread']")
|
||||
.hasText("unread topics", "displays the right text for the link");
|
||||
|
||||
assert
|
||||
.dom(".sidebar-section-link[data-link-name='unread']")
|
||||
|
@ -1099,13 +1089,9 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
"links to the right URL"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".sidebar-section-link[data-link-name='user-summary']"
|
||||
).textContent.trim(),
|
||||
"my summary",
|
||||
"displays the right text for the link"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link[data-link-name='user-summary']")
|
||||
.hasText("my summary", "displays the right text for the link");
|
||||
|
||||
assert
|
||||
.dom(".sidebar-section-link[data-link-name='user-summary']")
|
||||
|
@ -1179,13 +1165,14 @@ acceptance(
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section-link[data-link-name='everything'] .sidebar-section-link-content-badge"
|
||||
).textContent.trim(),
|
||||
"2",
|
||||
"count is 2 because there's 1 unread topic and 1 new topic"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
"2",
|
||||
"count is 2 because there's 1 unread topic and 1 new topic"
|
||||
);
|
||||
});
|
||||
|
||||
test("dot is shown next to the everything link when sidebar_show_count_of_new_items is false", async function (assert) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { NotificationLevels } from "discourse/lib/notification-levels";
|
|||
import {
|
||||
acceptance,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
queryAll,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -413,25 +412,27 @@ acceptance(
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='group-messages-unread'].group1"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.messages.links.unread_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for group1 unread inbox filter link"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.messages.links.unread_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for group1 unread inbox filter link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='group-messages-new'].group1"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.messages.links.new_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for group1 new inbox filter link"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.messages.links.new_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for group1 new inbox filter link"
|
||||
);
|
||||
|
||||
await publishToMessageBus(pmTopicTrackingState.groupChannel(1), {
|
||||
topic_id: 2,
|
||||
|
@ -444,13 +445,14 @@ acceptance(
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='group-messages-new'].group1"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.messages.links.new"),
|
||||
"removes count for group1 new inbox filter link"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.messages.links.new"),
|
||||
"removes count for group1 new inbox filter link"
|
||||
);
|
||||
});
|
||||
|
||||
test("new and unread counts for personal messages", async function (assert) {
|
||||
|
@ -475,15 +477,16 @@ acceptance(
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-unread']"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.messages.links.unread_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for the unread inbox filter link"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.messages.links.unread_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for the unread inbox filter link"
|
||||
);
|
||||
|
||||
await publishToMessageBus(pmTopicTrackingState.userChannel(), {
|
||||
topic_id: 2,
|
||||
|
@ -496,15 +499,16 @@ acceptance(
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-unread']"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.messages.links.unread_with_count", {
|
||||
count: 2,
|
||||
}),
|
||||
"displays 2 count for the unread inbox filter link"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.messages.links.unread_with_count", {
|
||||
count: 2,
|
||||
}),
|
||||
"displays 2 count for the unread inbox filter link"
|
||||
);
|
||||
|
||||
await publishToMessageBus(pmTopicTrackingState.userChannel(), {
|
||||
topic_id: 3,
|
||||
|
@ -517,15 +521,16 @@ acceptance(
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-new']"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.messages.links.new_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for the new inbox filter link"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.messages.links.new_with_count", {
|
||||
count: 1,
|
||||
}),
|
||||
"displays 1 count for the new inbox filter link"
|
||||
);
|
||||
|
||||
await publishToMessageBus(pmTopicTrackingState.userChannel(), {
|
||||
topic_id: 3,
|
||||
|
@ -538,13 +543,14 @@ acceptance(
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-new']"
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.sections.messages.links.new"),
|
||||
"removes the count from the new inbox filter link"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.sections.messages.links.new"),
|
||||
"removes the count from the new inbox filter link"
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -5,7 +5,6 @@ import discoveryFixture from "discourse/tests/fixtures/discovery-fixtures";
|
|||
import {
|
||||
acceptance,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
|
@ -76,29 +75,17 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
)
|
||||
.exists({ count: 4 }, "4 section links under the section");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".sidebar-section-link-wrapper[data-tag-name=tag1]"
|
||||
).textContent.trim(),
|
||||
"tag1",
|
||||
"displays the tag1 name for the link text"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link-wrapper[data-tag-name=tag1]")
|
||||
.hasText("tag1", "displays the tag1 name for the link text");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".sidebar-section-link-wrapper[data-tag-name=tag2]"
|
||||
).textContent.trim(),
|
||||
"tag2",
|
||||
"displays the tag2 name for the link text"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link-wrapper[data-tag-name=tag2]")
|
||||
.hasText("tag2", "displays the tag2 name for the link text");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".sidebar-section-link-wrapper[data-tag-name=tag3]"
|
||||
).textContent.trim(),
|
||||
"tag3",
|
||||
"displays the tag3 name for the link text"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-section-link-wrapper[data-tag-name=tag3]")
|
||||
.hasText("tag3", "displays the tag3 name for the link text");
|
||||
|
||||
await click(".sidebar-section-link-wrapper[data-tag-name=tag1] a");
|
||||
|
||||
|
@ -462,21 +449,23 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-tag-name=tag1] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for tag1 section link`
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for tag1 section link`
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-tag-name=tag2] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for tag2 section link`
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.unread_count", { count: 1 }),
|
||||
`displays 1 unread count for tag2 section link`
|
||||
);
|
||||
|
||||
assert
|
||||
.dom(
|
||||
|
@ -493,13 +482,14 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
`.sidebar-section-link-wrapper[data-tag-name=tag1] .sidebar-section-link-content-badge`
|
||||
).textContent.trim(),
|
||||
i18n("sidebar.new_count", { count: 1 }),
|
||||
`displays 1 new count for tag1 section link`
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
i18n("sidebar.new_count", { count: 1 }),
|
||||
`displays 1 new count for tag1 section link`
|
||||
);
|
||||
|
||||
await publishToMessageBus("/unread", {
|
||||
topic_id: 1,
|
||||
|
@ -626,29 +616,26 @@ acceptance(
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
'.sidebar-section-link-wrapper[data-tag-name="tag1"] .sidebar-section-link-content-badge'
|
||||
).textContent.trim(),
|
||||
"2",
|
||||
"count for tag1 is 2 because it has 1 unread topic and 1 new topic"
|
||||
);
|
||||
)
|
||||
.hasText(
|
||||
"2",
|
||||
"count for tag1 is 2 because it has 1 unread topic and 1 new topic"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
'.sidebar-section-link-wrapper[data-tag-name="tag2"] .sidebar-section-link-content-badge'
|
||||
).textContent.trim(),
|
||||
"1",
|
||||
"count for tag2 is 1 because it has 1 unread topic"
|
||||
);
|
||||
)
|
||||
.hasText("1", "count for tag2 is 1 because it has 1 unread topic");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
assert
|
||||
.dom(
|
||||
'.sidebar-section-link-wrapper[data-tag-name="tag3"] .sidebar-section-link-content-badge'
|
||||
).textContent.trim(),
|
||||
"1",
|
||||
"count for tag3 is 1 because it has 1 new topic"
|
||||
);
|
||||
)
|
||||
.hasText("1", "count for tag3 is 1 because it has 1 new topic");
|
||||
});
|
||||
|
||||
test("dot shown next to tag link when sidebar_show_count_of_new_items is false", async function (assert) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import topicFixtures from "discourse/tests/fixtures/discovery-fixtures";
|
|||
import {
|
||||
acceptance,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
@ -183,31 +182,35 @@ acceptance("Topic Discovery Tracked", function (needs) {
|
|||
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.unread").textContent.trim(),
|
||||
i18n("filters.unread.title_with_count", { count: 4 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.unread")
|
||||
.hasText(
|
||||
i18n("filters.unread.title_with_count", { count: 4 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.new").textContent.trim(),
|
||||
i18n("filters.new.title_with_count", { count: 2 }),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.new")
|
||||
.hasText(
|
||||
i18n("filters.new.title_with_count", { count: 2 }),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
|
||||
await visit("/?f=tracked");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.unread").textContent.trim(),
|
||||
i18n("filters.unread.title_with_count", { count: 3 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.unread")
|
||||
.hasText(
|
||||
i18n("filters.unread.title_with_count", { count: 3 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.new").textContent.trim(),
|
||||
i18n("filters.new.title_with_count", { count: 1 }),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.new")
|
||||
.hasText(
|
||||
i18n("filters.new.title_with_count", { count: 1 }),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
|
||||
// simulate reading topic id 1
|
||||
await publishToMessageBus("/unread", {
|
||||
|
@ -229,17 +232,19 @@ acceptance("Topic Discovery Tracked", function (needs) {
|
|||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.unread").textContent.trim(),
|
||||
i18n("filters.unread.title_with_count", { count: 2 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.unread")
|
||||
.hasText(
|
||||
i18n("filters.unread.title_with_count", { count: 2 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.new").textContent.trim(),
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.new")
|
||||
.hasText(
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
});
|
||||
|
||||
test("visit discovery page filtered by tag with tracked filter", async function (assert) {
|
||||
|
@ -259,31 +264,35 @@ acceptance("Topic Discovery Tracked", function (needs) {
|
|||
|
||||
await visit("/tag/some-other-tag");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.unread").textContent.trim(),
|
||||
i18n("filters.unread.title"),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.unread")
|
||||
.hasText(
|
||||
i18n("filters.unread.title"),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.new").textContent.trim(),
|
||||
i18n("filters.new.title_with_count", { count: 1 }),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.new")
|
||||
.hasText(
|
||||
i18n("filters.new.title_with_count", { count: 1 }),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
|
||||
await visit("/tag/some-other-tag?f=tracked");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.unread").textContent.trim(),
|
||||
i18n("filters.unread.title"),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.unread")
|
||||
.hasText(
|
||||
i18n("filters.unread.title"),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.new").textContent.trim(),
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.new")
|
||||
.hasText(
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
});
|
||||
|
||||
test("visit discovery page filtered by category with tracked filter", async function (assert) {
|
||||
|
@ -337,30 +346,34 @@ acceptance("Topic Discovery Tracked", function (needs) {
|
|||
|
||||
await visit(`/c/3`);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.unread").textContent.trim(),
|
||||
i18n("filters.unread.title_with_count", { count: 1 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.unread")
|
||||
.hasText(
|
||||
i18n("filters.unread.title_with_count", { count: 1 }),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.new").textContent.trim(),
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.new")
|
||||
.hasText(
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
|
||||
await visit(`/c/3?f=tracked`);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.unread").textContent.trim(),
|
||||
i18n("filters.unread.title"),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.unread")
|
||||
.hasText(
|
||||
i18n("filters.unread.title"),
|
||||
"displays the right content on unread link"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#navigation-bar li.new").textContent.trim(),
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
assert
|
||||
.dom("#navigation-bar li.new")
|
||||
.hasText(
|
||||
i18n("filters.new.title"),
|
||||
"displays the right content on new link"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -624,9 +624,9 @@ acceptance("Topic stats update automatically", function () {
|
|||
test("Likes count updates automatically", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
const likesCountSelectors =
|
||||
"#post_1 .topic-map .topic-map__likes-trigger .number";
|
||||
const oldLikesCount = query(likesCountSelectors).textContent;
|
||||
const oldLikesCount = document.querySelector(
|
||||
"#post_1 .topic-map .topic-map__likes-trigger .number"
|
||||
).textContent;
|
||||
const likesChangedFixture = {
|
||||
id: 280,
|
||||
type: "stats",
|
||||
|
@ -637,7 +637,9 @@ acceptance("Topic stats update automatically", function () {
|
|||
// simulate the topic like_count being changed
|
||||
await publishToMessageBus("/topic/280", likesChangedFixture);
|
||||
|
||||
assert.dom(likesCountSelectors).hasText(expectedLikesCount);
|
||||
assert
|
||||
.dom("#post_1 .topic-map .topic-map__likes-trigger .number")
|
||||
.hasText(expectedLikesCount);
|
||||
assert.notStrictEqual(
|
||||
oldLikesCount,
|
||||
expectedLikesCount,
|
||||
|
|
|
@ -39,10 +39,7 @@ acceptance("User Drafts", function (needs) {
|
|||
test("Stream - has excerpt", async function (assert) {
|
||||
await visit("/u/eviltrout/activity/drafts");
|
||||
assert.dom(".user-stream-item").exists("has drafts");
|
||||
assert.strictEqual(
|
||||
query(".user-stream-item:nth-child(3) .category").textContent,
|
||||
"meta"
|
||||
);
|
||||
assert.dom(".user-stream-item:nth-child(3) .category").hasText("meta");
|
||||
assert
|
||||
.dom(".user-stream-item:nth-child(3) .excerpt")
|
||||
.hasHtml(
|
||||
|
|
|
@ -96,14 +96,9 @@ acceptance("User menu", function (needs) {
|
|||
await visit("/");
|
||||
await click(".d-header-icons .current-user button");
|
||||
|
||||
let repliesBadgeNotification = query(
|
||||
"#user-menu-button-replies .badge-notification"
|
||||
);
|
||||
assert.strictEqual(
|
||||
repliesBadgeNotification.textContent.trim(),
|
||||
"2",
|
||||
"badge shows the right count"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-replies .badge-notification")
|
||||
.hasText("2", "badge shows the right count");
|
||||
|
||||
await click(".user-menu ul li.replied a");
|
||||
|
||||
|
@ -114,14 +109,9 @@ acceptance("User menu", function (needs) {
|
|||
);
|
||||
|
||||
await click(".d-header-icons .current-user button");
|
||||
repliesBadgeNotification = query(
|
||||
"#user-menu-button-replies .badge-notification"
|
||||
);
|
||||
assert.strictEqual(
|
||||
repliesBadgeNotification.textContent.trim(),
|
||||
"1",
|
||||
"badge shows count reduced by one"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-replies .badge-notification")
|
||||
.hasText("1", "badge shows count reduced by one");
|
||||
});
|
||||
|
||||
test("clicking on user menu items", async function (assert) {
|
||||
|
@ -131,13 +121,12 @@ acceptance("User menu", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-review-queue");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
"#user-menu-button-review-queue .badge-notification"
|
||||
).textContent.trim(),
|
||||
"8",
|
||||
"updates user's reviewable count based on request's response"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-review-queue .badge-notification")
|
||||
.hasText(
|
||||
"8",
|
||||
"updates user's reviewable count based on request's response"
|
||||
);
|
||||
|
||||
await click("#quick-access-review-queue li.reviewable.pending a");
|
||||
|
||||
|
@ -317,21 +306,13 @@ acceptance("User menu", function (needs) {
|
|||
"#user-menu-button-custom-tab-1 .badge-notification"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
customTab1Bubble.textContent.trim(),
|
||||
"73",
|
||||
"bubble shows the right count"
|
||||
);
|
||||
assert.dom(customTab1Bubble).hasText("73", "bubble shows the right count");
|
||||
|
||||
const customTab2Bubble = query(
|
||||
"#user-menu-button-custom-tab-2 .badge-notification"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
customTab2Bubble.textContent.trim(),
|
||||
"29",
|
||||
"bubble shows the right count"
|
||||
);
|
||||
assert.dom(customTab2Bubble).hasText("29", "bubble shows the right count");
|
||||
|
||||
await publishToMessageBus(`/notification/${loggedInUser().id}`, {
|
||||
unread_high_priority_notifications: 18,
|
||||
|
@ -341,11 +322,12 @@ acceptance("User menu", function (needs) {
|
|||
"#user-menu-button-custom-tab-1 .badge-notification"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
customTab1Bubble.textContent.trim(),
|
||||
"18",
|
||||
"displayed bubble count updates when the value is changed"
|
||||
);
|
||||
assert
|
||||
.dom(customTab1Bubble)
|
||||
.hasText(
|
||||
"18",
|
||||
"displayed bubble count updates when the value is changed"
|
||||
);
|
||||
|
||||
await click("#user-menu-button-custom-tab-1");
|
||||
|
||||
|
@ -375,14 +357,12 @@ acceptance("User menu", function (needs) {
|
|||
const notifications = queryAll(
|
||||
"#quick-access-all-notifications ul li.notification"
|
||||
);
|
||||
assert.strictEqual(
|
||||
notifications[0].textContent.replace(/\s+/g, " ").trim(),
|
||||
"velesin pluginNotificationTransformer 0 edited topic 443"
|
||||
);
|
||||
assert.strictEqual(
|
||||
notifications[1].textContent.replace(/\s+/g, " ").trim(),
|
||||
"velesin pluginNotificationTransformer 1 some title"
|
||||
);
|
||||
assert
|
||||
.dom(notifications[0])
|
||||
.hasText("velesin pluginNotificationTransformer 0 edited topic 443");
|
||||
assert
|
||||
.dom(notifications[1])
|
||||
.hasText("velesin pluginNotificationTransformer 1 some title");
|
||||
});
|
||||
|
||||
test("bookmarks tab applies model transformations registered by plugins", async function (assert) {
|
||||
|
@ -400,11 +380,9 @@ acceptance("User menu", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-bookmarks");
|
||||
|
||||
const bookmarks = queryAll("#quick-access-bookmarks ul li.bookmark");
|
||||
assert.strictEqual(
|
||||
bookmarks[0].textContent.replace(/\s+/g, " ").trim(),
|
||||
"osama pluginBookmarkTransformer Test poll topic hello world"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-bookmarks ul li.bookmark")
|
||||
.hasText("osama pluginBookmarkTransformer Test poll topic hello world");
|
||||
});
|
||||
|
||||
test("messages tab applies model transformations registered by plugins", async function (assert) {
|
||||
|
@ -427,11 +405,11 @@ acceptance("User menu", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
await click("#user-menu-button-messages");
|
||||
|
||||
const messages = queryAll("#quick-access-messages ul li.message");
|
||||
assert.strictEqual(
|
||||
messages[0].textContent.replace(/\s+/g, " ").trim(),
|
||||
"mixtape pluginTransformer#2 pluginTransformer#1 BUG: Can not render emoji properly"
|
||||
);
|
||||
assert
|
||||
.dom("#quick-access-messages ul li.message")
|
||||
.hasText(
|
||||
"mixtape pluginTransformer#2 pluginTransformer#1 BUG: Can not render emoji properly"
|
||||
);
|
||||
});
|
||||
|
||||
test("the profile tab", async function (assert) {
|
||||
|
@ -448,11 +426,9 @@ acceptance("User menu", function (needs) {
|
|||
summaryLink.href.endsWith("/u/eviltrout/summary"),
|
||||
"has a link to the summary page of the user"
|
||||
);
|
||||
assert.strictEqual(
|
||||
summaryLink.textContent.trim(),
|
||||
i18n("user.summary.title"),
|
||||
"summary link has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(summaryLink)
|
||||
.hasText(i18n("user.summary.title"), "summary link has the right label");
|
||||
assert
|
||||
.dom(".d-icon-user", summaryLink)
|
||||
.exists("summary link has the right icon");
|
||||
|
@ -462,11 +438,12 @@ acceptance("User menu", function (needs) {
|
|||
activityLink.href.endsWith("/u/eviltrout/activity"),
|
||||
"has a link to the activity page of the user"
|
||||
);
|
||||
assert.strictEqual(
|
||||
activityLink.textContent.trim(),
|
||||
i18n("user.activity_stream"),
|
||||
"activity link has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(activityLink)
|
||||
.hasText(
|
||||
i18n("user.activity_stream"),
|
||||
"activity link has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(".d-icon-bars-staggered", activityLink)
|
||||
.exists("activity link has the right icon");
|
||||
|
@ -476,11 +453,9 @@ acceptance("User menu", function (needs) {
|
|||
invitesLink.href.endsWith("/u/eviltrout/invited"),
|
||||
"has a link to the invites page of the user"
|
||||
);
|
||||
assert.strictEqual(
|
||||
invitesLink.textContent.trim(),
|
||||
i18n("user.invited.title"),
|
||||
"invites link has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(invitesLink)
|
||||
.hasText(i18n("user.invited.title"), "invites link has the right label");
|
||||
assert
|
||||
.dom(".d-icon-user-plus", invitesLink)
|
||||
.exists("invites link has the right icon");
|
||||
|
@ -500,11 +475,12 @@ acceptance("User menu", function (needs) {
|
|||
draftsLink.href.endsWith("/u/eviltrout/activity/drafts"),
|
||||
"has a link to the drafts page of the user"
|
||||
);
|
||||
assert.strictEqual(
|
||||
draftsLink.textContent.trim(),
|
||||
i18n("drafts.label_with_count", { count: 13 }),
|
||||
"drafts link has the right label with count of the user's drafts"
|
||||
);
|
||||
assert
|
||||
.dom(draftsLink)
|
||||
.hasText(
|
||||
i18n("drafts.label_with_count", { count: 13 }),
|
||||
"drafts link has the right label with count of the user's drafts"
|
||||
);
|
||||
assert
|
||||
.dom(".d-icon-user_menu\\.drafts", draftsLink)
|
||||
.exists("drafts link has the right icon");
|
||||
|
@ -514,11 +490,12 @@ acceptance("User menu", function (needs) {
|
|||
preferencesLink.href.endsWith("/u/eviltrout/preferences"),
|
||||
"has a link to the preferences page of the user"
|
||||
);
|
||||
assert.strictEqual(
|
||||
preferencesLink.textContent.trim(),
|
||||
i18n("user.preferences.title"),
|
||||
"preferences link has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(preferencesLink)
|
||||
.hasText(
|
||||
i18n("user.preferences.title"),
|
||||
"preferences link has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(".d-icon-gear", preferencesLink)
|
||||
.exists("preferences link has the right icon");
|
||||
|
@ -526,14 +503,12 @@ acceptance("User menu", function (needs) {
|
|||
let doNotDisturbButton = query(
|
||||
"#quick-access-profile ul li.do-not-disturb .btn"
|
||||
);
|
||||
assert.strictEqual(
|
||||
doNotDisturbButton.textContent
|
||||
.replaceAll(/\s+/g, " ")
|
||||
.replaceAll(/\u200B/g, "")
|
||||
.trim(),
|
||||
i18n("pause_notifications.label"),
|
||||
"Do Not Disturb button has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(doNotDisturbButton)
|
||||
.hasText(
|
||||
i18n("pause_notifications.label"),
|
||||
"Do Not Disturb button has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(".d-icon-toggle-off", doNotDisturbButton)
|
||||
.exists("Do Not Disturb button has the right icon");
|
||||
|
@ -548,14 +523,12 @@ acceptance("User menu", function (needs) {
|
|||
doNotDisturbButton = query(
|
||||
"#quick-access-profile ul li.do-not-disturb .btn"
|
||||
);
|
||||
assert.strictEqual(
|
||||
doNotDisturbButton.textContent
|
||||
.replaceAll(/\s+/g, " ")
|
||||
.replaceAll(/\u200B/g, "")
|
||||
.trim(),
|
||||
`${i18n("pause_notifications.label")} 2h`,
|
||||
"Do Not Disturb button has the right label when Do Not Disturb is enabled"
|
||||
);
|
||||
assert
|
||||
.dom(doNotDisturbButton)
|
||||
.hasText(
|
||||
`${i18n("pause_notifications.label")} 2h`,
|
||||
"Do Not Disturb button has the right label when Do Not Disturb is enabled"
|
||||
);
|
||||
assert
|
||||
.dom(".d-icon-toggle-on", doNotDisturbButton)
|
||||
.exists(
|
||||
|
@ -568,14 +541,12 @@ acceptance("User menu", function (needs) {
|
|||
let toggleAnonButton = query(
|
||||
"#quick-access-profile ul li.enable-anonymous .btn"
|
||||
);
|
||||
assert.strictEqual(
|
||||
toggleAnonButton.textContent
|
||||
.replaceAll(/\s+/g, " ")
|
||||
.replaceAll(/\u200B/g, "")
|
||||
.trim(),
|
||||
i18n("switch_to_anon"),
|
||||
"toggle anonymous button has the right label when the user isn't anonymous"
|
||||
);
|
||||
assert
|
||||
.dom(toggleAnonButton)
|
||||
.hasText(
|
||||
i18n("switch_to_anon"),
|
||||
"toggle anonymous button has the right label when the user isn't anonymous"
|
||||
);
|
||||
assert
|
||||
.dom(".d-icon-user-secret", toggleAnonButton)
|
||||
.exists(
|
||||
|
@ -590,14 +561,12 @@ acceptance("User menu", function (needs) {
|
|||
toggleAnonButton = query(
|
||||
"#quick-access-profile ul li.disable-anonymous .btn"
|
||||
);
|
||||
assert.strictEqual(
|
||||
toggleAnonButton.textContent
|
||||
.replaceAll(/\s+/g, " ")
|
||||
.replaceAll(/\u200B/g, "")
|
||||
.trim(),
|
||||
i18n("switch_from_anon"),
|
||||
"toggle anonymous button has the right label when the user is anonymous"
|
||||
);
|
||||
assert
|
||||
.dom(toggleAnonButton)
|
||||
.hasText(
|
||||
i18n("switch_from_anon"),
|
||||
"toggle anonymous button has the right label when the user is anonymous"
|
||||
);
|
||||
assert
|
||||
.dom(".d-icon-ban", toggleAnonButton)
|
||||
.exists(
|
||||
|
@ -690,14 +659,9 @@ acceptance("User menu", function (needs) {
|
|||
);
|
||||
|
||||
const logoutButton = query("#quick-access-profile ul li.logout .btn");
|
||||
assert.strictEqual(
|
||||
logoutButton.textContent
|
||||
.replaceAll(/\s+/g, " ")
|
||||
.replaceAll(/\u200B/g, "")
|
||||
.trim(),
|
||||
i18n("user.log_out"),
|
||||
"logout button has the right label"
|
||||
);
|
||||
assert
|
||||
.dom(logoutButton)
|
||||
.hasText(i18n("user.log_out"), "logout button has the right label");
|
||||
assert
|
||||
.dom(".d-icon-right-from-bracket", logoutButton)
|
||||
.exists("logout button has the right icon");
|
||||
|
@ -943,13 +907,12 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
await click(".d-header-icons .current-user button");
|
||||
|
||||
await click(".user-menu .notifications-dismiss");
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".dismiss-notification-confirmation .d-modal__body"
|
||||
).textContent.trim(),
|
||||
i18n("notifications.dismiss_confirmation.body.default", { count: 10 }),
|
||||
"confirmation modal is shown when there are unread high pri notifications"
|
||||
);
|
||||
assert
|
||||
.dom(".dismiss-notification-confirmation .d-modal__body")
|
||||
.hasText(
|
||||
i18n("notifications.dismiss_confirmation.body.default", { count: 10 }),
|
||||
"confirmation modal is shown when there are unread high pri notifications"
|
||||
);
|
||||
|
||||
await click(".d-modal__footer .btn-default"); // click cancel on the dismiss modal
|
||||
assert.false(markRead, "mark-read request isn't sent");
|
||||
|
@ -963,11 +926,9 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
await visit("/");
|
||||
await click(".d-header-icons .current-user button");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#user-menu-button-bookmarks .badge-notification").textContent,
|
||||
"103",
|
||||
"bookmarks tab has bubble with count"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-bookmarks .badge-notification")
|
||||
.hasText("103", "bookmarks tab has bubble with count");
|
||||
|
||||
await click("#user-menu-button-bookmarks");
|
||||
assert
|
||||
|
@ -979,10 +940,7 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
|
||||
await click(".user-menu .notifications-dismiss");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".dismiss-notification-confirmation .d-modal__body"
|
||||
).textContent.trim(),
|
||||
assert.dom(".dismiss-notification-confirmation .d-modal__body").hasText(
|
||||
i18n("notifications.dismiss_confirmation.body.bookmarks", {
|
||||
count: 103,
|
||||
}),
|
||||
|
@ -1014,11 +972,9 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
await visit("/");
|
||||
await click(".d-header-icons .current-user button");
|
||||
|
||||
assert.strictEqual(
|
||||
query("#user-menu-button-messages .badge-notification").textContent,
|
||||
"89",
|
||||
"messages tab has bubble with count"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-messages .badge-notification")
|
||||
.hasText("89", "messages tab has bubble with count");
|
||||
|
||||
await click("#user-menu-button-messages");
|
||||
assert
|
||||
|
@ -1030,10 +986,7 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
|
||||
await click(".user-menu .notifications-dismiss");
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".dismiss-notification-confirmation .d-modal__body"
|
||||
).textContent.trim(),
|
||||
assert.dom(".dismiss-notification-confirmation .d-modal__body").hasText(
|
||||
i18n("notifications.dismiss_confirmation.body.messages", {
|
||||
count: 89,
|
||||
}),
|
||||
|
@ -1081,11 +1034,9 @@ acceptance("User menu - Dismiss button", function (needs) {
|
|||
let othersBadgeNotification = query(
|
||||
"#user-menu-button-other-notifications .badge-notification"
|
||||
);
|
||||
assert.strictEqual(
|
||||
othersBadgeNotification.textContent.trim(),
|
||||
"4",
|
||||
"badge shows the right count"
|
||||
);
|
||||
assert
|
||||
.dom(othersBadgeNotification)
|
||||
.hasText("4", "badge shows the right count");
|
||||
|
||||
await click(".user-menu .notifications-dismiss");
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import pretender, {
|
|||
fixturesByUrl,
|
||||
response,
|
||||
} from "discourse/tests/helpers/create-pretender";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -100,11 +100,9 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await click(".delete-account .btn-danger");
|
||||
await click(".dialog-footer .btn-danger");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".dialog-body").textContent.trim(),
|
||||
i18n("user.deleted_yourself"),
|
||||
"confirmation dialog is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".dialog-body")
|
||||
.hasText(i18n("user.deleted_yourself"), "confirmation dialog is shown");
|
||||
|
||||
await click(".dialog-footer .btn-primary");
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
|
|||
import {
|
||||
acceptance,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
|
@ -567,11 +566,9 @@ acceptance(
|
|||
|
||||
await visit("/u/charlie/messages");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".topic-post-badges").textContent.trim(),
|
||||
"",
|
||||
"does not display unread posts count badge"
|
||||
);
|
||||
assert
|
||||
.dom(".topic-post-badges")
|
||||
.hasText("", "does not display unread posts count badge");
|
||||
} finally {
|
||||
resetHighestReadCache();
|
||||
}
|
||||
|
@ -584,11 +581,9 @@ acceptance(
|
|||
.dom(".topic-list-item")
|
||||
.exists({ count: 3 }, "displays the right topic list");
|
||||
|
||||
assert.strictEqual(
|
||||
query(`tr[data-topic-id="1"] .topic-post-badges`).textContent.trim(),
|
||||
"1",
|
||||
"displays the right unread posts count badge"
|
||||
);
|
||||
assert
|
||||
.dom(`tr[data-topic-id="1"] .topic-post-badges`)
|
||||
.hasText("1", "displays the right unread posts count badge");
|
||||
|
||||
await visit("/u/charlie/messages/group/awesome_group");
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
|||
import {
|
||||
acceptance,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
@ -131,16 +130,14 @@ acceptance(
|
|||
|
||||
test("Periods in current user's username don't act like wildcards", async function (assert) {
|
||||
await visit("/u/eviltrout");
|
||||
assert.strictEqual(
|
||||
query(".user-profile-names .username").textContent.trim(),
|
||||
assert.dom(".user-profile-names .username").hasText(
|
||||
`eviltrout
|
||||
Robin Ward is an admin`,
|
||||
"eviltrout profile is shown"
|
||||
);
|
||||
|
||||
await visit("/u/e.il.rout");
|
||||
assert.strictEqual(
|
||||
query(".user-profile-names .username").textContent.trim(),
|
||||
assert.dom(".user-profile-names .username").hasText(
|
||||
`e.il.rout
|
||||
Robin Ward is an admin`,
|
||||
"e.il.rout profile is shown"
|
||||
|
|
|
@ -2,11 +2,7 @@ import { click, triggerKeyEvent, visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import directoryFixtures from "discourse/tests/fixtures/directory-fixtures";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -91,11 +87,11 @@ acceptance("User Directory", function () {
|
|||
test("Custom user fields are present", async function (assert) {
|
||||
await visit("/u");
|
||||
|
||||
const firstRowUserField = query(
|
||||
".directory .directory-table__body .directory-table__row:first-child .directory-table__value--user-field"
|
||||
);
|
||||
|
||||
assert.strictEqual(firstRowUserField.textContent.trim(), "Blue");
|
||||
assert
|
||||
.dom(
|
||||
".directory .directory-table__body .directory-table__row:first-child .directory-table__value--user-field"
|
||||
)
|
||||
.hasText("Blue");
|
||||
});
|
||||
|
||||
test("Can sort table via keyboard", async function (assert) {
|
||||
|
@ -185,27 +181,15 @@ acceptance("User directory - Editing columns", function (needs) {
|
|||
|
||||
let columns;
|
||||
columns = fetchColumns();
|
||||
assert.strictEqual(
|
||||
columns[3].querySelector(".column-name").textContent.trim(),
|
||||
"Replies Posted"
|
||||
);
|
||||
assert.strictEqual(
|
||||
columns[4].querySelector(".column-name").textContent.trim(),
|
||||
"Topics Viewed"
|
||||
);
|
||||
assert.dom(".column-name", columns[3]).hasText("Replies Posted");
|
||||
assert.dom(".column-name", columns[4]).hasText("Topics Viewed");
|
||||
|
||||
// Click on row 4 and see if they are swapped
|
||||
await click(columns[4].querySelector(".move-column-up"));
|
||||
|
||||
columns = fetchColumns();
|
||||
assert.strictEqual(
|
||||
columns[3].querySelector(".column-name").textContent.trim(),
|
||||
"Topics Viewed"
|
||||
);
|
||||
assert.strictEqual(
|
||||
columns[4].querySelector(".column-name").textContent.trim(),
|
||||
"Replies Posted"
|
||||
);
|
||||
assert.dom(".column-name", columns[3]).hasText("Topics Viewed");
|
||||
assert.dom(".column-name", columns[4]).hasText("Replies Posted");
|
||||
|
||||
const moveUserFieldColumnUpBtn =
|
||||
columns[columns.length - 1].querySelector(".move-column-up");
|
||||
|
@ -215,14 +199,8 @@ acceptance("User directory - Editing columns", function (needs) {
|
|||
await click(moveUserFieldColumnUpBtn);
|
||||
|
||||
columns = fetchColumns();
|
||||
assert.strictEqual(
|
||||
columns[4].querySelector(".column-name").textContent.trim(),
|
||||
"Favorite Color"
|
||||
);
|
||||
assert.strictEqual(
|
||||
columns[5].querySelector(".column-name").textContent.trim(),
|
||||
"Replies Posted"
|
||||
);
|
||||
assert.dom(".column-name", columns[4]).hasText("Favorite Color");
|
||||
assert.dom(".column-name", columns[5]).hasText("Replies Posted");
|
||||
|
||||
// Now click restore default and check order of column names
|
||||
await click(".reset-to-default");
|
||||
|
|
|
@ -37,17 +37,16 @@ module("Integration | Component | admin-plugin-config-area", function (hooks) {
|
|||
</AdminPluginConfigArea>
|
||||
`);
|
||||
|
||||
assert.strictEqual(
|
||||
document.querySelectorAll(".admin-plugin-inner-sidebar-nav__item").length,
|
||||
3,
|
||||
"it renders the correct number of sidebar nav items (including always adding a Settings link)"
|
||||
);
|
||||
assert
|
||||
.dom(".admin-plugin-inner-sidebar-nav__item")
|
||||
.exists(
|
||||
{ count: 3 },
|
||||
"renders the correct number of sidebar nav items (including always adding a Settings link)"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
document.querySelector(".admin-plugin-config-area").textContent.trim(),
|
||||
"Test content",
|
||||
"it renders the yielded content"
|
||||
);
|
||||
assert
|
||||
.dom(".admin-plugin-config-area")
|
||||
.hasText("Test content", "renders the yielded content");
|
||||
});
|
||||
|
||||
test("it does not render the nav items in the sidebar when using top mode but it does along the top", async function (assert) {
|
||||
|
@ -70,16 +69,12 @@ module("Integration | Component | admin-plugin-config-area", function (hooks) {
|
|||
</AdminPluginConfigArea>
|
||||
`);
|
||||
|
||||
assert.strictEqual(
|
||||
document.querySelectorAll(".admin-plugin-inner-sidebar-nav__item").length,
|
||||
0,
|
||||
"it renders the correct number of sidebar nav items"
|
||||
);
|
||||
assert
|
||||
.dom(".admin-plugin-inner-sidebar-nav__item")
|
||||
.doesNotExist("renders the correct number of sidebar nav items");
|
||||
|
||||
assert.strictEqual(
|
||||
document.querySelector(".admin-plugin-config-area").textContent.trim(),
|
||||
"Test content",
|
||||
"it renders the yielded content"
|
||||
);
|
||||
assert
|
||||
.dom(".admin-plugin-config-area")
|
||||
.hasText("Test content", "renders the yielded content");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@ import { click, render } from "@ember/test-helpers";
|
|||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
module("Integration | Component | d-navigation", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
@ -26,9 +25,6 @@ module("Integration | Component | d-navigation", function (hooks) {
|
|||
assert
|
||||
.dom(".category-row")
|
||||
.exists({ count: 1 }, "displays only categories that are not muted");
|
||||
assert.strictEqual(
|
||||
query(".category-row .badge-category span").textContent.trim(),
|
||||
"dev"
|
||||
);
|
||||
assert.dom(".category-row .badge-category span").hasText("dev");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,6 @@ import { render } from "@ember/test-helpers";
|
|||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
module("Integration | Component | pending-post", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
@ -22,10 +21,6 @@ module("Integration | Component | pending-post", function (hooks) {
|
|||
|
||||
await render(hbs`<PendingPost @post={{this.post}}/>`);
|
||||
|
||||
assert.strictEqual(
|
||||
query("p.excerpt").textContent.trim(),
|
||||
"bold text",
|
||||
"renders the cooked text"
|
||||
);
|
||||
assert.dom("p.excerpt").hasText("bold text", "renders the cooked text");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -46,11 +46,12 @@ module("Integration | Component | search-menu", function (hooks) {
|
|||
|
||||
await fillIn("#search-term", "test");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".label-suffix").textContent.trim(),
|
||||
i18n("search.in_topics_posts"),
|
||||
"search label reflects context of search"
|
||||
);
|
||||
assert
|
||||
.dom(".label-suffix")
|
||||
.hasText(
|
||||
i18n("search.in_topics_posts"),
|
||||
"search label reflects context of search"
|
||||
);
|
||||
|
||||
await triggerKeyEvent("#search-term", "keyup", "Enter");
|
||||
|
||||
|
|
|
@ -148,10 +148,7 @@ module(
|
|||
await render(
|
||||
hbs`<MiniTagChooser @options={{hash allowAny=true hiddenValues=this.hiddenValues}} @value={{this.value}} />`
|
||||
);
|
||||
assert.strictEqual(
|
||||
query(".formatted-selection").textContent.trim(),
|
||||
"bar"
|
||||
);
|
||||
assert.dom(".formatted-selection").hasText("bar");
|
||||
|
||||
await this.subject.expand();
|
||||
assert.deepEqual(
|
||||
|
|
|
@ -4,7 +4,7 @@ import { module, test } from "qunit";
|
|||
import { NOTIFICATION_TYPES } from "discourse/tests/fixtures/concerns/notification-types";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
module(
|
||||
|
@ -71,16 +71,15 @@ module(
|
|||
return response({ notifications: [], bookmarks: [] });
|
||||
});
|
||||
await render(template);
|
||||
assert.strictEqual(
|
||||
query(".empty-state-title").textContent.trim(),
|
||||
i18n("user.no_bookmarks_title"),
|
||||
"empty state title is shown"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query(".empty-state-body").textContent.trim(),
|
||||
i18n("user.no_bookmarks_body", { icon: "" }).trim(),
|
||||
"empty state body is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state-title")
|
||||
.hasText(i18n("user.no_bookmarks_title"), "empty state title is shown");
|
||||
assert
|
||||
.dom(".empty-state-body")
|
||||
.hasText(
|
||||
i18n("user.no_bookmarks_body", { icon: "" }),
|
||||
"empty state body is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state-body svg.d-icon-bookmark")
|
||||
.exists("icon is correctly rendered in the empty state body");
|
||||
|
|
|
@ -3,7 +3,6 @@ import { hbs } from "ember-cli-htmlbars";
|
|||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
module(
|
||||
|
@ -11,19 +10,19 @@ module(
|
|||
function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
const template = hbs`<UserMenu::LikesNotificationsList/>`;
|
||||
test("empty state (aka blank page syndrome)", async function (assert) {
|
||||
pretender.get("/notifications", () => {
|
||||
return response({ notifications: [] });
|
||||
});
|
||||
|
||||
await render(template);
|
||||
await render(hbs`<UserMenu::LikesNotificationsList/>`);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".empty-state-title").textContent.trim(),
|
||||
i18n("user.no_likes_title"),
|
||||
"empty state title for the likes tab is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state-title")
|
||||
.hasText(
|
||||
i18n("user.no_likes_title"),
|
||||
"empty state title for the likes tab is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state-body a")
|
||||
.hasAttribute(
|
||||
|
|
|
@ -11,7 +11,6 @@ import UserMenuReviewable from "discourse/models/user-menu-reviewable";
|
|||
import { NOTIFICATION_TYPES } from "discourse/tests/fixtures/concerns/notification-types";
|
||||
import PrivateMessagesFixture from "discourse/tests/fixtures/private-messages-fixtures";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON, deepMerge } from "discourse-common/lib/object";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -163,20 +162,17 @@ module(
|
|||
getNotification(this.currentUser, this.siteSettings, this.site)
|
||||
);
|
||||
await render(template);
|
||||
const label = query("li a .item-label");
|
||||
const description = query("li a .item-description");
|
||||
|
||||
assert.strictEqual(
|
||||
label.textContent.trim(),
|
||||
"osama",
|
||||
"the label's content is the username by default"
|
||||
);
|
||||
assert
|
||||
.dom("li a .item-label")
|
||||
.hasText("osama", "the label's content is the username by default");
|
||||
|
||||
assert.strictEqual(
|
||||
description.textContent.trim(),
|
||||
"This is fancy title <a>!",
|
||||
"the description defaults to the fancy_title"
|
||||
);
|
||||
assert
|
||||
.dom("li a .item-description")
|
||||
.hasText(
|
||||
"This is fancy title <a>!",
|
||||
"the description defaults to the fancy_title"
|
||||
);
|
||||
});
|
||||
|
||||
test("the description falls back to topic_title from data if fancy_title is absent", async function (assert) {
|
||||
|
@ -187,13 +183,13 @@ module(
|
|||
})
|
||||
);
|
||||
await render(template);
|
||||
const description = query("li a .item-description");
|
||||
|
||||
assert.strictEqual(
|
||||
description.textContent.trim(),
|
||||
"this is title before it becomes fancy <a>!",
|
||||
"topic_title from data is rendered safely"
|
||||
);
|
||||
assert
|
||||
.dom("li a .item-description")
|
||||
.hasText(
|
||||
"this is title before it becomes fancy <a>!",
|
||||
"topic_title from data is rendered safely"
|
||||
);
|
||||
});
|
||||
|
||||
test("fancy_title is emoji-unescaped", async function (assert) {
|
||||
|
@ -222,13 +218,13 @@ module(
|
|||
})
|
||||
);
|
||||
await render(template);
|
||||
const description = query("li a .item-description");
|
||||
|
||||
assert.strictEqual(
|
||||
description.textContent.trim(),
|
||||
"unsafe title with <a> unescaped emoji",
|
||||
"topic_title is rendered safely"
|
||||
);
|
||||
assert
|
||||
.dom("li a .item-description")
|
||||
.hasText(
|
||||
"unsafe title with <a> unescaped emoji",
|
||||
"topic_title is rendered safely"
|
||||
);
|
||||
assert
|
||||
.dom(".item-description img.emoji")
|
||||
.exists("emoji is rendered correctly");
|
||||
|
@ -305,20 +301,22 @@ module(
|
|||
assert
|
||||
.dom("li .item-label")
|
||||
.hasClass("label-wrapper-1", "label wrapper has additional classes");
|
||||
assert.strictEqual(
|
||||
query("li .item-label").textContent.trim(),
|
||||
"notification label 666 <span>",
|
||||
"label content is customized"
|
||||
);
|
||||
assert
|
||||
.dom("li .item-label")
|
||||
.hasText(
|
||||
"notification label 666 <span>",
|
||||
"label content is customized"
|
||||
);
|
||||
|
||||
assert
|
||||
.dom(".item-description")
|
||||
.hasClass("description-class-1", "description has additional classes");
|
||||
assert.strictEqual(
|
||||
query(".item-description").textContent.trim(),
|
||||
"notification description 123 <script>",
|
||||
"description content is customized"
|
||||
);
|
||||
assert
|
||||
.dom(".item-description")
|
||||
.hasText(
|
||||
"notification description 123 <script>",
|
||||
"description content is customized"
|
||||
);
|
||||
});
|
||||
|
||||
test("description can be omitted", async function (assert) {
|
||||
|
@ -350,11 +348,9 @@ module(
|
|||
assert
|
||||
.dom(".item-description")
|
||||
.doesNotExist("description is not rendered");
|
||||
assert.strictEqual(
|
||||
query("li").textContent.trim(),
|
||||
"notification label",
|
||||
"only label content is displayed"
|
||||
);
|
||||
assert
|
||||
.dom("li")
|
||||
.hasText("notification label", "only label content is displayed");
|
||||
});
|
||||
|
||||
test("label can be omitted", async function (assert) {
|
||||
|
@ -383,11 +379,12 @@ module(
|
|||
);
|
||||
|
||||
await render(template);
|
||||
assert.strictEqual(
|
||||
query("li").textContent.trim(),
|
||||
"notification description",
|
||||
"only notification description is displayed"
|
||||
);
|
||||
assert
|
||||
.dom("li")
|
||||
.hasText(
|
||||
"notification description",
|
||||
"only notification description is displayed"
|
||||
);
|
||||
assert.dom(".item-label").doesNotExist("label is not rendered");
|
||||
});
|
||||
}
|
||||
|
@ -422,15 +419,12 @@ module(
|
|||
)
|
||||
);
|
||||
await render(template);
|
||||
assert.strictEqual(
|
||||
query("li.message .item-description").textContent.trim(),
|
||||
"This is a safe title!"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query("li.message .item-description b").textContent.trim(),
|
||||
"safe",
|
||||
"fancy title is not escaped"
|
||||
);
|
||||
assert
|
||||
.dom("li.message .item-description")
|
||||
.hasText("This is a safe title!");
|
||||
assert
|
||||
.dom("li.message .item-description b")
|
||||
.hasText("safe", "fancy title is not escaped");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -505,10 +499,7 @@ module(
|
|||
)
|
||||
);
|
||||
await render(template);
|
||||
assert.strictEqual(
|
||||
query("li.bookmark .item-label").textContent.trim(),
|
||||
"bookmarkPostAuthor"
|
||||
);
|
||||
assert.dom("li.bookmark .item-label").hasText("bookmarkPostAuthor");
|
||||
});
|
||||
|
||||
test("item description is the bookmark title", async function (assert) {
|
||||
|
@ -521,10 +512,9 @@ module(
|
|||
)
|
||||
);
|
||||
await render(template);
|
||||
assert.strictEqual(
|
||||
query("li.bookmark .item-description").textContent.trim(),
|
||||
"Custom bookmark title"
|
||||
);
|
||||
assert
|
||||
.dom("li.bookmark .item-description")
|
||||
.hasText("Custom bookmark title");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -589,15 +579,10 @@ module(
|
|||
);
|
||||
await render(template);
|
||||
|
||||
const label = query("li .item-label");
|
||||
const description = query("li .item-description");
|
||||
assert.strictEqual(
|
||||
label.textContent.trim(),
|
||||
"sayo2",
|
||||
"the label is the flagger_username"
|
||||
);
|
||||
assert.strictEqual(
|
||||
description.textContent.trim(),
|
||||
assert
|
||||
.dom("li .item-label")
|
||||
.hasText("sayo2", "the label is the flagger_username");
|
||||
assert.dom("li .item-description").hasText(
|
||||
i18n("user_menu.reviewable.default_item", {
|
||||
reviewable_id: this.item.reviewable.id,
|
||||
}),
|
||||
|
@ -613,11 +598,9 @@ module(
|
|||
})
|
||||
);
|
||||
await render(template);
|
||||
const label = query("li .item-label");
|
||||
assert.strictEqual(
|
||||
label.textContent.trim(),
|
||||
i18n("user_menu.reviewable.deleted_user")
|
||||
);
|
||||
assert
|
||||
.dom("li .item-label")
|
||||
.hasText(i18n("user_menu.reviewable.deleted_user"));
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -138,10 +138,9 @@ module("Integration | Component | user-menu", function (hooks) {
|
|||
this.currentUser.set("can_review", true);
|
||||
this.currentUser.set("reviewable_count", 4);
|
||||
await render(template);
|
||||
const countBadge = query(
|
||||
"#user-menu-button-review-queue .badge-notification"
|
||||
);
|
||||
assert.strictEqual(countBadge.textContent, "4");
|
||||
assert
|
||||
.dom("#user-menu-button-review-queue .badge-notification")
|
||||
.hasText("4");
|
||||
|
||||
this.currentUser.set("reviewable_count", 0);
|
||||
await settled();
|
||||
|
@ -315,13 +314,11 @@ module("Integration | Component | user-menu", function (hooks) {
|
|||
});
|
||||
await render(template);
|
||||
|
||||
const likesCountBadge = query(
|
||||
"#user-menu-button-likes .badge-notification"
|
||||
);
|
||||
assert.strictEqual(
|
||||
likesCountBadge.textContent,
|
||||
(1 + 2 + 3).toString(),
|
||||
"combines unread counts for `liked`, `liked_consolidated` and `reaction` types"
|
||||
);
|
||||
assert
|
||||
.dom("#user-menu-button-likes .badge-notification")
|
||||
.hasText(
|
||||
`${1 + 2 + 3}`,
|
||||
"combines unread counts for `liked`, `liked_consolidated` and `reaction` types"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ import { NOTIFICATION_TYPES } from "discourse/tests/fixtures/concerns/notificati
|
|||
import UserMenuFixtures from "discourse/tests/fixtures/user-menu";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON, deepMerge } from "discourse-common/lib/object";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -213,44 +213,32 @@ module("Integration | Component | user-menu | messages-list", function (hooks) {
|
|||
|
||||
assert.strictEqual(items.length, 6);
|
||||
|
||||
assert.strictEqual(
|
||||
items[0].textContent.trim(),
|
||||
assert.dom(items[0]).hasText(
|
||||
i18n("notifications.group_message_summary", {
|
||||
count: 13,
|
||||
group_name: "jokers",
|
||||
})
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
items[1].textContent.trim().replaceAll(/\s+/g, " "),
|
||||
"mixtape Test Topic 0003"
|
||||
);
|
||||
assert.dom(items[1]).hasText("mixtape Test Topic 0003");
|
||||
|
||||
assert.strictEqual(
|
||||
items[2].textContent.trim(),
|
||||
assert.dom(items[2]).hasText(
|
||||
i18n("notifications.group_message_summary", {
|
||||
count: 12,
|
||||
group_name: "jokers",
|
||||
})
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
items[3].textContent.trim().replaceAll(/\s+/g, " "),
|
||||
"mixtape Test Topic 0002"
|
||||
);
|
||||
assert.dom(items[3]).hasText("mixtape Test Topic 0002");
|
||||
|
||||
assert.strictEqual(
|
||||
items[4].textContent.trim(),
|
||||
assert.dom(items[4]).hasText(
|
||||
i18n("notifications.group_message_summary", {
|
||||
count: 11,
|
||||
group_name: "jokers",
|
||||
})
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
items[5].textContent.trim().replaceAll(/\s+/g, " "),
|
||||
"mixtape Test Topic 0001"
|
||||
);
|
||||
assert.dom(items[5]).hasText("mixtape Test Topic 0001");
|
||||
});
|
||||
|
||||
test("show all button for message notifications", async function (assert) {
|
||||
|
@ -304,11 +292,9 @@ module("Integration | Component | user-menu | messages-list", function (hooks) {
|
|||
|
||||
await render(template);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".empty-state-title").textContent.trim(),
|
||||
i18n("user.no_messages_title"),
|
||||
"empty state title is shown"
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state-title")
|
||||
.hasText(i18n("user.no_messages_title"), "empty state title is shown");
|
||||
assert
|
||||
.dom(".empty-state-body svg.d-icon-envelope")
|
||||
.exists("icon is correctly rendered in the empty state body");
|
||||
|
|
|
@ -5,7 +5,7 @@ import { NOTIFICATION_TYPES } from "discourse/tests/fixtures/concerns/notificati
|
|||
import NotificationFixtures from "discourse/tests/fixtures/notification-fixtures";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -81,14 +81,9 @@ module(
|
|||
[NOTIFICATION_TYPES.mentioned]: 1,
|
||||
});
|
||||
await render(template);
|
||||
const dismissButton = query(
|
||||
".panel-body-bottom .btn.notifications-dismiss"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dismissButton.textContent.trim(),
|
||||
i18n("user.dismiss"),
|
||||
"dismiss button has a label"
|
||||
);
|
||||
assert
|
||||
.dom(".panel-body-bottom .btn.notifications-dismiss")
|
||||
.hasText(i18n("user.dismiss"), "dismiss button has a label");
|
||||
assert
|
||||
.dom(".panel-body-bottom .btn.notifications-dismiss")
|
||||
.hasAttribute(
|
||||
|
@ -213,26 +208,36 @@ module(
|
|||
});
|
||||
await render(template);
|
||||
const items = queryAll("ul li");
|
||||
assert.true(
|
||||
items[0].textContent.includes("hello world 0011"),
|
||||
"the first pending reviewable is displayed 1st because it's most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert.true(
|
||||
items[1].textContent.includes("Unread notification #01"),
|
||||
"the first unread notification is displayed 2nd because it's the 2nd most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert.true(
|
||||
items[2].textContent.includes("Unread notification #02"),
|
||||
"the second unread notification is displayed 3rd because it's the 3rd most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert.true(
|
||||
items[3].textContent.includes("hello world 0033"),
|
||||
"the second pending reviewable is displayed 4th because it's the 4th most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert.true(
|
||||
items[4].textContent.includes("Read notification #01"),
|
||||
"read notifications come after the pending reviewables and unread notifications"
|
||||
);
|
||||
assert
|
||||
.dom(items[0])
|
||||
.includesText(
|
||||
"hello world 0011",
|
||||
"the first pending reviewable is displayed 1st because it's most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert
|
||||
.dom(items[1])
|
||||
.includesText(
|
||||
"Unread notification #01",
|
||||
"the first unread notification is displayed 2nd because it's the 2nd most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert
|
||||
.dom(items[2])
|
||||
.includesText(
|
||||
"Unread notification #02",
|
||||
"the second unread notification is displayed 3rd because it's the 3rd most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert
|
||||
.dom(items[3])
|
||||
.includesText(
|
||||
"hello world 0033",
|
||||
"the second pending reviewable is displayed 4th because it's the 4th most recent among pending reviewables and unread notifications"
|
||||
);
|
||||
assert
|
||||
.dom(items[4])
|
||||
.includesText(
|
||||
"Read notification #01",
|
||||
"read notifications come after the pending reviewables and unread notifications"
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -3,7 +3,6 @@ import { hbs } from "ember-cli-htmlbars";
|
|||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
module(
|
||||
|
@ -17,15 +16,12 @@ module(
|
|||
});
|
||||
});
|
||||
|
||||
const template = hbs`<UserMenu::OtherNotificationsList/>`;
|
||||
|
||||
test("empty state when there are no notifications", async function (assert) {
|
||||
await render(template);
|
||||
await render(hbs`<UserMenu::OtherNotificationsList/>`);
|
||||
assert.dom(".empty-state .empty-state-body").exists();
|
||||
assert.strictEqual(
|
||||
query(".empty-state .empty-state-title").textContent.trim(),
|
||||
i18n("user.no_other_notifications_title")
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state .empty-state-title")
|
||||
.hasText(i18n("user.no_other_notifications_title"));
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -3,7 +3,6 @@ import { hbs } from "ember-cli-htmlbars";
|
|||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
module(
|
||||
|
@ -17,15 +16,12 @@ module(
|
|||
});
|
||||
});
|
||||
|
||||
const template = hbs`<UserMenu::RepliesNotificationsList/>`;
|
||||
|
||||
test("empty state when there are no notifications", async function (assert) {
|
||||
await render(template);
|
||||
await render(hbs`<UserMenu::RepliesNotificationsList/>`);
|
||||
assert.dom(".empty-state .empty-state-body").exists();
|
||||
assert.strictEqual(
|
||||
query(".empty-state .empty-state-title").textContent.trim(),
|
||||
i18n("user.no_notifications_title")
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state .empty-state-title")
|
||||
.hasText(i18n("user.no_notifications_title"));
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -138,17 +138,15 @@ module("Unit | Utils | decorators", function (hooks) {
|
|||
this.set("name", "Jarek");
|
||||
await render(hbs`<EmberObjectComponent @name={{this.name}} />`);
|
||||
|
||||
assert.strictEqual(
|
||||
document.querySelector(".ember-object-component").textContent,
|
||||
"hello, Jarek"
|
||||
);
|
||||
assert.dom(".ember-object-component").hasText("hello, Jarek");
|
||||
|
||||
this.set("name", "Joffrey");
|
||||
assert.strictEqual(
|
||||
document.querySelector(".ember-object-component").textContent,
|
||||
"hello, Joffrey",
|
||||
"rerenders the component when arguments change"
|
||||
);
|
||||
assert
|
||||
.dom(".ember-object-component")
|
||||
.hasText(
|
||||
"hello, Joffrey",
|
||||
"rerenders the component when arguments change"
|
||||
);
|
||||
});
|
||||
|
||||
test("discourseComputed works in native classes", async function (assert) {
|
||||
|
@ -157,17 +155,15 @@ module("Unit | Utils | decorators", function (hooks) {
|
|||
this.set("name", "Jarek");
|
||||
await render(hbs`<NativeComponent @name={{this.name}} />`);
|
||||
|
||||
assert.strictEqual(
|
||||
document.querySelector(".native-component").textContent,
|
||||
"hello, Jarek"
|
||||
);
|
||||
assert.dom(".native-component").hasText("hello, Jarek");
|
||||
|
||||
this.set("name", "Joffrey");
|
||||
assert.strictEqual(
|
||||
document.querySelector(".native-component").textContent,
|
||||
"hello, Joffrey",
|
||||
"rerenders the component when arguments change"
|
||||
);
|
||||
assert
|
||||
.dom(".native-component")
|
||||
.hasText(
|
||||
"hello, Joffrey",
|
||||
"rerenders the component when arguments change"
|
||||
);
|
||||
});
|
||||
|
||||
test("debounce", async function (assert) {
|
||||
|
|
|
@ -3,8 +3,7 @@ import { render } from "@ember/test-helpers";
|
|||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
||||
|
@ -70,10 +69,9 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
|||
this.channel.membershipsCount = 4;
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".chat-channel-card__members").textContent.trim(),
|
||||
i18n("chat.channel.memberships_count", { count: 4 })
|
||||
);
|
||||
assert
|
||||
.dom(".chat-channel-card__members")
|
||||
.hasText(i18n("chat.channel.memberships_count", { count: 4 }));
|
||||
});
|
||||
|
||||
test("No description", async function (assert) {
|
||||
|
@ -86,10 +84,9 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
|||
test("Description", async function (assert) {
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".chat-channel-card__description").textContent.trim(),
|
||||
this.channel.description
|
||||
);
|
||||
assert
|
||||
.dom(".chat-channel-card__description")
|
||||
.hasText(this.channel.description);
|
||||
});
|
||||
|
||||
test("Name", async function (assert) {
|
||||
|
|
|
@ -4,8 +4,7 @@ import hbs from "htmlbars-inline-precompile";
|
|||
import { module, test } from "qunit";
|
||||
import Bookmark from "discourse/models/bookmark";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
||||
|
||||
|
@ -26,10 +25,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
|||
assert
|
||||
.dom(".chat-message-info__username")
|
||||
.hasText(this.message.chatWebhookEvent.username);
|
||||
assert.strictEqual(
|
||||
query(".chat-message-info__bot-indicator").textContent.trim(),
|
||||
i18n("chat.bot")
|
||||
);
|
||||
assert.dom(".chat-message-info__bot-indicator").hasText(i18n("chat.bot"));
|
||||
});
|
||||
|
||||
test("user", async function (assert) {
|
||||
|
|
|
@ -3,8 +3,7 @@ import { hbs } from "ember-cli-htmlbars";
|
|||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
module(
|
||||
"Integration | Component | user-menu | chat-notifications-list",
|
||||
|
@ -22,10 +21,9 @@ module(
|
|||
test("empty state when there are no notifications", async function (assert) {
|
||||
await render(template);
|
||||
assert.dom(".empty-state .empty-state-body").exists();
|
||||
assert.strictEqual(
|
||||
query(".empty-state .empty-state-title").textContent.trim(),
|
||||
i18n("user_menu.no_chat_notifications_title")
|
||||
);
|
||||
assert
|
||||
.dom(".empty-state .empty-state-title")
|
||||
.hasText(i18n("user_menu.no_chat_notifications_title"));
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -3,7 +3,7 @@ import hbs from "htmlbars-inline-precompile";
|
|||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
module("Poll | Component | poll-buttons-dropdown", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
@ -38,11 +38,12 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
|
|||
await click(".widget-dropdown-header");
|
||||
|
||||
assert.dom("li.dropdown-menu__item").exists({ count: 2 });
|
||||
assert.strictEqual(
|
||||
query("li.dropdown-menu__item span").textContent.trim(),
|
||||
i18n("poll.export-results.label"),
|
||||
"displays the poll Export action"
|
||||
);
|
||||
assert
|
||||
.dom("li.dropdown-menu__item span")
|
||||
.hasText(
|
||||
i18n("poll.export-results.label"),
|
||||
"displays the poll Export action"
|
||||
);
|
||||
});
|
||||
|
||||
test("Renders a show-tally button when poll is a bar chart", async function (assert) {
|
||||
|
@ -106,11 +107,12 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
|
|||
|
||||
assert.dom(".widget-dropdown-header").doesNotExist();
|
||||
assert.dom("button.widget-button").exists({ count: 1 });
|
||||
assert.strictEqual(
|
||||
query("button.widget-button span.d-button-label").textContent.trim(),
|
||||
i18n("poll.breakdown.breakdown"),
|
||||
"displays the poll Close action"
|
||||
);
|
||||
assert
|
||||
.dom("button.widget-button span.d-button-label")
|
||||
.hasText(
|
||||
i18n("poll.breakdown.breakdown"),
|
||||
"displays the poll Close action"
|
||||
);
|
||||
});
|
||||
|
||||
test("Doesn't render a button when user has no authorised actions", async function (assert) {
|
||||
|
|
|
@ -2,8 +2,7 @@ import { render } from "@ember/test-helpers";
|
|||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
const OPTIONS = [
|
||||
{ id: "1ddc47be0d2315b9711ee8526ca9d83f", html: "This", votes: 2, rank: 0 },
|
||||
|
@ -45,19 +44,19 @@ module("Poll | Component | poll-info", function (hooks) {
|
|||
@voters={{this.voters}}
|
||||
/>`);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".poll-info_instructions li.multiple-help-text").textContent.trim(),
|
||||
assert.dom(".poll-info_instructions li.multiple-help-text").hasText(
|
||||
i18n("poll.multiple.help.up_to_max_options", {
|
||||
count: this.max,
|
||||
}).replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the multiple help text"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".poll-info_instructions li.is-public").textContent.trim(),
|
||||
i18n("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the public label"
|
||||
);
|
||||
assert
|
||||
.dom(".poll-info_instructions li.is-public")
|
||||
.hasText(
|
||||
i18n("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the public label"
|
||||
);
|
||||
});
|
||||
|
||||
test("public multiple poll with results only shown on vote", async function (assert) {
|
||||
|
@ -91,26 +90,25 @@ module("Poll | Component | poll-info", function (hooks) {
|
|||
@voters={{this.voters}}
|
||||
/>`);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".poll-info_instructions li.multiple-help-text").textContent.trim(),
|
||||
assert.dom(".poll-info_instructions li.multiple-help-text").hasText(
|
||||
i18n("poll.multiple.help.up_to_max_options", {
|
||||
count: this.max,
|
||||
}).replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the multiple help text"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(
|
||||
".poll-info_instructions li.results-on-vote span"
|
||||
).textContent.trim(),
|
||||
i18n("poll.results.vote.title").replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the results on vote label"
|
||||
);
|
||||
assert
|
||||
.dom(".poll-info_instructions li.results-on-vote span")
|
||||
.hasText(
|
||||
i18n("poll.results.vote.title").replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the results on vote label"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".poll-info_instructions li.is-public").textContent.trim(),
|
||||
i18n("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the public label"
|
||||
);
|
||||
assert
|
||||
.dom(".poll-info_instructions li.is-public")
|
||||
.hasText(
|
||||
i18n("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
|
||||
"displays the public label"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,8 +2,7 @@ import { render } from "@ember/test-helpers";
|
|||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
const RANKED_CHOICE_OUTCOME = {
|
||||
tied: false,
|
||||
|
@ -47,8 +46,7 @@ module("Poll | Component | poll-results-ranked-choice", function (hooks) {
|
|||
.dom("table.poll-results-ranked-choice tr")
|
||||
.exists({ count: 3 }, "there are two rounds of ranked choice");
|
||||
|
||||
assert.strictEqual(
|
||||
query("span.poll-results-ranked-choice-info").textContent.trim(),
|
||||
assert.dom("span.poll-results-ranked-choice-info").hasText(
|
||||
i18n("poll.ranked_choice.winner", {
|
||||
count: this.rankedChoiceOutcome.round_activity.length,
|
||||
winner: this.rankedChoiceOutcome.winning_candidate.html,
|
||||
|
|
Loading…
Reference in New Issue