DEV: Move and fix incorrectly named tests (#37488)

Those were not being run because of missing `-test` suffix.
This commit is contained in:
Jarek Radosz
2026-02-03 19:10:06 +01:00
committed by GitHub
parent a2b22d182e
commit d29d38332f
3 changed files with 62 additions and 42 deletions
@@ -2,6 +2,7 @@ import { click, render } from "@ember/test-helpers";
import { module, test } from "qunit";
import EmptyTopicFilter from "discourse/components/empty-topic-filter";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { i18n } from "discourse-i18n";
module("Integration | Component | EmptyTopicFilter", function (hooks) {
setupRenderingTest(hooks);
@@ -120,4 +121,54 @@ module("Integration | Component | EmptyTopicFilter", function (hooks) {
assert.dom(".empty-state").exists("empty state is rendered");
assert.dom(".empty-state__cta button").exists("CTA button is rendered");
});
test("renders new education text when newFilter is true", async function (assert) {
await render(
<template>
<EmptyTopicFilter @unreadFilter={{false}} @newFilter={{true}} />
</template>
);
assert
.dom(".empty-state__title")
.hasText(i18n("topics.none.education.new"));
});
test("renders new_new education text when newFilter is true and new_new_view_enabled", async function (assert) {
this.currentUser.new_new_view_enabled = true;
await render(
<template>
<EmptyTopicFilter @unreadFilter={{false}} @newFilter={{true}} />
</template>
);
assert
.dom(".empty-state__title")
.hasText(i18n("topics.none.education.new_new"));
});
test("renders unread education text when unreadFilter is true", async function (assert) {
await render(
<template>
<EmptyTopicFilter @unreadFilter={{true}} @newFilter={{false}} />
</template>
);
assert
.dom(".empty-state__title")
.hasText(i18n("topics.none.education.unread"));
});
test("renders generic education text when neither newFilter nor unreadFilter is true", async function (assert) {
await render(
<template>
<EmptyTopicFilter @unreadFilter={{false}} @newFilter={{false}} />
</template>
);
assert
.dom(".empty-state__title")
.hasText(i18n("topics.none.education.generic"));
});
});
@@ -8,11 +8,10 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
needs.pretender((server, helper) => {
server.get("/polls/voters.json", (request) => {
let body = {};
if (
request.queryParams.option_id === "68b434ff88aeae7054e42cd05a4d9056"
) {
body = {
return helper.response({
voters: {
"68b434ff88aeae7054e42cd05a4d9056": [
{
@@ -23,31 +22,28 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
},
],
},
};
});
} else {
body = {
return helper.response({
voters: Array.from(new Array(5), (_, i) => ({
id: 600 + i,
username: `bruce${600 + i}`,
avatar_template: "/images/avatar.png",
name: "Bruce Wayne",
})),
};
});
}
return helper.response(body);
});
});
test("Polls", async function (assert) {
await visit("/t/-/15");
assert.dom(".poll").exists({ count: 2 }, "renders the polls correctly");
const polls = document.querySelectorAll(".poll");
assert
.dom(".info-number", polls[0])
.hasText("2", "displays the right number of votes");
assert
.dom(".info-number", polls[1])
.hasText("3", "displays the right number of votes");
@@ -55,41 +51,26 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
test("Public poll", async function (assert) {
await visit("/t/-/14");
assert.dom(".poll").exists({ count: 1 }, "renders the poll correctly");
await click("button.toggle-results");
assert
.dom(".poll-voters:nth-of-type(1) li")
.dom(".poll-voters li")
.exists({ count: 25 }, "displays the right number of voters");
await click(".poll-voters-toggle-expand:nth-of-type(1) a");
await click(".poll-voters-toggle-expand");
assert
.dom(".poll-voters:nth-of-type(1) li")
.dom(".poll-voters li")
.exists({ count: 26 }, "displays the right number of voters");
});
test("Public number poll", async function (assert) {
await visit("/t/-/13");
assert.dom(".poll").exists({ count: 1 }, "renders the poll correctly");
await click("button.toggle-results");
assert
.dom(".poll-voters:nth-of-type(1) li")
.exists({ count: 25 }, "displays the right number of voters");
assert
.dom(".poll-voters:nth-of-type(1) li:nth-of-type(1) a")
.doesNotHaveAttribute("href", "user URL does not exist");
await click(".poll-voters-toggle-expand:nth-of-type(1) a");
assert
.dom(".poll-voters:nth-of-type(1) li")
.exists({ count: 30 }, "displays the right number of voters");
.dom(".poll-info_counts-count .info-number")
.hasText("35", "displays the right number of voters");
});
});
@@ -21,23 +21,11 @@ acceptance("Rendering polls with bar charts - mobile", function (needs) {
test("Public number poll", async function (assert) {
await visit("/t/-/13");
assert.dom(".poll").exists({ count: 1 }, "renders the poll correctly");
await click("button.toggle-results");
assert
.dom(".poll-voters:nth-of-type(1) li")
.exists({ count: 25 }, "displays the right number of voters");
assert
.dom(".poll-voters:nth-of-type(1) li:nth-of-type(1) a")
.doesNotHaveAttribute("href", "user URL does not exist");
await click(".poll-voters-toggle-expand:nth-of-type(1) a");
assert
.dom(".poll-voters:nth-of-type(1) li")
.exists({ count: 35 }, "displays the right number of voters");
.dom(".poll-info_counts-count .info-number")
.hasText("35", "displays the right number of voters");
});
});