A platform for community discussion. Free, open, simple.
DEV: Remove plugin names from test titles (#39418)
Jarek Radosz893fcf714b0b
diff --git a/plugins/chat/test/javascripts/acceptance/chat-channel-reactions-test.js b/plugins/chat/test/javascripts/acceptance/chat-channel-reactions-test.jsindex fe681016387..5ceeaa65c1c 100644--- a/plugins/chat/test/javascripts/acceptance/chat-channel-reactions-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-channel-reactions-test.js@@ -19,7 +19,7 @@ const message = {},};-acceptance("Discourse Chat - Channel Reactions", function (needs) {+acceptance("Channel Reactions", function (needs) {needs.user({ has_chat_enabled: true });needs.settings({ chat_enabled: true, enable_emoji: true });diff --git a/plugins/chat/test/javascripts/acceptance/chat-composer-test.js b/plugins/chat/test/javascripts/acceptance/chat-composer-test.jsindex f1f21f79e22..49298770934 100644--- a/plugins/chat/test/javascripts/acceptance/chat-composer-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-composer-test.js@@ -17,7 +17,7 @@ import {const GROUP_NAME = "group1";-acceptance("Discourse Chat - Composer", function (needs) {+acceptance("Composer", function (needs) {needs.user({ has_chat_enabled: true });needs.settings({chat_enabled: true,@@ -72,7 +72,7 @@ acceptance("Discourse Chat - Composer", function (needs) {});let sendAttempt = 0;-acceptance("Discourse Chat - Composer - unreliable network", function (needs) {+acceptance("Composer - unreliable network", function (needs) {needs.user({ id: 1, has_chat_enabled: true });needs.settings({chat_enabled: true,diff --git a/plugins/chat/test/javascripts/acceptance/chat-email-preferences-test.js b/plugins/chat/test/javascripts/acceptance/chat-email-preferences-test.jsindex 58bbdb80b64..7b35b520843 100644--- a/plugins/chat/test/javascripts/acceptance/chat-email-preferences-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-email-preferences-test.js@@ -6,7 +6,7 @@ import {} from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";-acceptance("Chat | Email Preferences", function (needs) {+acceptance("Email Preferences", function (needs) {needs.user();needs.settings({chat_enabled: true,diff --git a/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js b/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.jsindex ed07297e1a7..af2fcba1314 100644--- a/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js@@ -2,7 +2,7 @@ import { click, visit } from "@ember/test-helpers";import { skip } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Discourse Chat - Chat live pane collapse", function (needs) {+acceptance("Chat live pane collapse", function (needs) {needs.user({username: "eviltrout",id: 1,diff --git a/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.js b/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.jsindex 3c77a3794b5..b6807c3edcf 100644--- a/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.js@@ -2,64 +2,61 @@ import { click, visit } from "@ember/test-helpers";import { skip } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance(- "Discourse Chat - Chat live pane - handling 429 errors",- function (needs) {- needs.user({- username: "eviltrout",- id: 1,- has_chat_enabled: true,+acceptance("Chat live pane - handling 429 errors", function (needs) {+ needs.user({+ username: "eviltrout",+ id: 1,+ has_chat_enabled: true,+ });+ needs.settings({+ chat_enabled: true,+ navigation_menu: "legacy",+ enable_emoji: true,+ });++ needs.pretender((server, helper) => {+ server.get("/chat/:chatChannelId/messages.json", () => {+ return helper.response(429);});- needs.settings({- chat_enabled: true,- navigation_menu: "legacy",- enable_emoji: true,- });-- needs.pretender((server, helper) => {- server.get("/chat/:chatChannelId/messages.json", () => {- return helper.response(429);- });- server.get("/chat/chat_channels.json", () =>- helper.response({- public_channels: [- {- id: 1,- title: "something",- current_user_membership: { following: true },- message_bus_last_ids: { new_mentions: 0, new_messages: 0 },- },- ],- direct_message_channels: [],- message_bus_last_ids: {- channel_metadata: 0,- channel_edits: 0,- channel_status: 0,- new_channel: 0,- user_tracking_state: 0,+ server.get("/chat/chat_channels.json", () =>+ helper.response({+ public_channels: [+ {+ id: 1,+ title: "something",+ current_user_membership: { following: true },+ message_bus_last_ids: { new_mentions: 0, new_messages: 0 },},- })- );-- server.get("/chat/chat_channels/:chatChannelId", () =>- helper.response({ id: 1, title: "something" })- );-- server.post("/chat/drafts", () => {- return helper.response([]);- });+ ],+ direct_message_channels: [],+ message_bus_last_ids: {+ channel_metadata: 0,+ channel_edits: 0,+ channel_status: 0,+ new_channel: 0,+ user_tracking_state: 0,+ },+ })+ );++ server.get("/chat/chat_channels/:chatChannelId", () =>+ helper.response({ id: 1, title: "something" })+ );++ server.post("/chat/drafts", () => {+ return helper.response([]);+ });- server.post("/chat/:chatChannelId.json", () => {- return helper.response({ success: "OK" });- });+ server.post("/chat/:chatChannelId.json", () => {+ return helper.response({ success: "OK" });});+ });- skip("Handles 429 errors by displaying an alert", async function (assert) {- await visit("/chat/c/cat/1");+ skip("Handles 429 errors by displaying an alert", async function (assert) {+ await visit("/chat/c/cat/1");- assert.dom(".dialog-content").exists("displays the 429 error");- await click(".dialog-footer .btn-primary");- });- }-);+ assert.dom(".dialog-content").exists("displays the 429 error");+ await click(".dialog-footer .btn-primary");+ });+});diff --git a/plugins/chat/test/javascripts/acceptance/hashtag-css-generator-test.js b/plugins/chat/test/javascripts/acceptance/hashtag-css-generator-test.jsindex 8417a0eab10..ec110b83d19 100644--- a/plugins/chat/test/javascripts/acceptance/hashtag-css-generator-test.js+++ b/plugins/chat/test/javascripts/acceptance/hashtag-css-generator-test.js@@ -2,7 +2,7 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Chat | Hashtag CSS Generator", function (needs) {+acceptance("Hashtag CSS Generator", function (needs) {const category1 = {id: 1,color: "ff0000",diff --git a/plugins/chat/test/javascripts/components/channel-icon-test.gjs b/plugins/chat/test/javascripts/components/channel-icon-test.gjsindex efbded84f60..26f6d5fffd3 100644--- a/plugins/chat/test/javascripts/components/channel-icon-test.gjs+++ b/plugins/chat/test/javascripts/components/channel-icon-test.gjs@@ -7,7 +7,7 @@ import ChannelIcon from "discourse/plugins/chat/discourse/components/channel-icoimport ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import { CHATABLE_TYPES } from "discourse/plugins/chat/discourse/models/chat-channel";-module("Discourse Chat | Component | <ChannelIcon />", function (hooks) {+module("Component | <ChannelIcon />", function (hooks) {setupRenderingTest(hooks);test("category channel - badge", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/channel-name-test.gjs b/plugins/chat/test/javascripts/components/channel-name-test.gjsindex 939243207d5..ffe48bdf123 100644--- a/plugins/chat/test/javascripts/components/channel-name-test.gjs+++ b/plugins/chat/test/javascripts/components/channel-name-test.gjs@@ -9,7 +9,7 @@ import { CHATABLE_TYPES } from "discourse/plugins/chat/discourse/models/chat-chaconst CHANNEL_NAME_LABEL = ".chat-channel-name__label";-module("Discourse Chat | Component | <ChannelName />", function (hooks) {+module("Component | <ChannelName />", function (hooks) {setupRenderingTest(hooks);test("category channel - label", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/channel-title-test.gjs b/plugins/chat/test/javascripts/components/channel-title-test.gjsindex 7c1bd976daa..1ca12c7ff82 100644--- a/plugins/chat/test/javascripts/components/channel-title-test.gjs+++ b/plugins/chat/test/javascripts/components/channel-title-test.gjs@@ -5,7 +5,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-title";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | <ChannelTitle />", function (hooks) {+module("Component | <ChannelTitle />", function (hooks) {setupRenderingTest(hooks);test("icon", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-card-test.gjsindex e03b38ef78b..c08d00a4db8 100644--- a/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs@@ -6,7 +6,7 @@ import { i18n } from "discourse-i18n";import ChatChannelCard from "discourse/plugins/chat/discourse/components/chat-channel-card";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-channel-card", function (hooks) {+module("Component | chat-channel-card", function (hooks) {setupRenderingTest(hooks);hooks.beforeEach(function () {diff --git a/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjsindex 11a48f1d6a2..5cd7a3ddc89 100644--- a/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs@@ -8,7 +8,7 @@ import { i18n } from "discourse-i18n";import ChatChannelLeaveBtn from "discourse/plugins/chat/discourse/components/chat-channel-leave-btn";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {+module("Component | chat-channel-leave-btn", function (hooks) {setupRenderingTest(hooks);test("accepts an optional onLeaveChannel callback", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjsindex e92171980de..36f657fd4db 100644--- a/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs@@ -5,7 +5,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatChannelMetadata from "discourse/plugins/chat/discourse/components/chat-channel-metadata";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-channel-metadata", function (hooks) {+module("Component | chat-channel-metadata", function (hooks) {setupRenderingTest(hooks);test("displays created at placeholder for empty chat", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjsindex 367f4c96fcb..b8d8f3f9fce 100644--- a/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs@@ -5,109 +5,94 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatChannelPreviewCard from "discourse/plugins/chat/discourse/components/chat-channel-preview-card";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | chat-channel-preview-card",- function (hooks) {- setupRenderingTest(hooks);-- hooks.beforeEach(function () {- this.set(- "channel",- new ChatFabricators(getOwner(this)).channel({- chatable_type: "Category",- })+module("Component | chat-channel-preview-card", function (hooks) {+ setupRenderingTest(hooks);++ hooks.beforeEach(function () {+ this.set(+ "channel",+ new ChatFabricators(getOwner(this)).channel({+ chatable_type: "Category",+ })+ );++ this.channel.description = "Important stuff is announced here.";+ this.channel.title = "announcements";+ this.channel.meta = { can_join_chat_channel: true };+ this.currentUser.set("has_chat_enabled", true);+ this.siteSettings.chat_enabled = true;+ });++ test("channel title", async function (assert) {+ await render(+ <template><ChatChannelPreviewCard @channel={{this.channel}} /></template>+ );++ assert+ .dom(".chat-channel-name__label")+ .hasText(this.channel.title, "shows the channel title");++ assert+ .dom(".chat-channel-icon.--icon")+ .exists("shows the category hashtag badge");+ });++ test("channel description", async function (assert) {+ await render(+ <template><ChatChannelPreviewCard @channel={{this.channel}} /></template>+ );++ assert+ .dom(".chat-channel-preview-card__description")+ .hasText(this.channel.description, "the channel description is shown");+ });++ test("no channel description", async function (assert) {+ this.channel.description = null;++ await render(+ <template><ChatChannelPreviewCard @channel={{this.channel}} /></template>+ );++ assert+ .dom(".chat-channel-preview-card__description")+ .doesNotExist(+ "no line is left for the channel description if there is none");- this.channel.description = "Important stuff is announced here.";- this.channel.title = "announcements";- this.channel.meta = { can_join_chat_channel: true };- this.currentUser.set("has_chat_enabled", true);- this.siteSettings.chat_enabled = true;- });-- test("channel title", async function (assert) {- await render(- <template>- <ChatChannelPreviewCard @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-channel-name__label")- .hasText(this.channel.title, "shows the channel title");-- assert- .dom(".chat-channel-icon.--icon")- .exists("shows the category hashtag badge");- });-- test("channel description", async function (assert) {- await render(- <template>- <ChatChannelPreviewCard @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-channel-preview-card__description")- .hasText(this.channel.description, "the channel description is shown");- });-- test("no channel description", async function (assert) {- this.channel.description = null;-- await render(- <template>- <ChatChannelPreviewCard @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-channel-preview-card__description")- .doesNotExist(- "no line is left for the channel description if there is none"- );-- assert- .dom(".chat-channel-preview-card.-no-description")- .exists("adds a modifier class for styling");- });-- test("join", async function (assert) {- await render(- <template>- <ChatChannelPreviewCard @channel={{this.channel}} />- </template>- );-- assert- .dom(".toggle-channel-membership-button.-join")- .exists("shows the join channel button");- });-- test("browse all", async function (assert) {- await render(- <template>- <ChatChannelPreviewCard @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-channel-preview-card__browse-all")- .exists("shows a link to browse all channels");- });-- test("closed channel", async function (assert) {- this.channel.status = "closed";- await render(- <template>- <ChatChannelPreviewCard @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-channel-preview-card__join-channel-btn")- .doesNotExist("it does not show the join channel button");- });- }-);+ assert+ .dom(".chat-channel-preview-card.-no-description")+ .exists("adds a modifier class for styling");+ });++ test("join", async function (assert) {+ await render(+ <template><ChatChannelPreviewCard @channel={{this.channel}} /></template>+ );++ assert+ .dom(".toggle-channel-membership-button.-join")+ .exists("shows the join channel button");+ });++ test("browse all", async function (assert) {+ await render(+ <template><ChatChannelPreviewCard @channel={{this.channel}} /></template>+ );++ assert+ .dom(".chat-channel-preview-card__browse-all")+ .exists("shows a link to browse all channels");+ });++ test("closed channel", async function (assert) {+ this.channel.status = "closed";+ await render(+ <template><ChatChannelPreviewCard @channel={{this.channel}} /></template>+ );++ assert+ .dom(".chat-channel-preview-card__join-channel-btn")+ .doesNotExist("it does not show the join channel button");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-row-test.gjsindex 32978caf00f..d0aaa982cbf 100644--- a/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs@@ -8,7 +8,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatChannelRow from "discourse/plugins/chat/discourse/components/chat-channel-row";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-channel-row", function (hooks) {+module("Component | chat-channel-row", function (hooks) {setupRenderingTest(hooks);hooks.beforeEach(function () {diff --git a/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-status-test.gjsindex ea568e0d050..b2762a0b74c 100644--- a/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs@@ -10,7 +10,7 @@ import {channelStatusIcon,} from "discourse/plugins/chat/discourse/models/chat-channel";-module("Discourse Chat | Component | chat-channel-status", function (hooks) {+module("Component | chat-channel-status", function (hooks) {setupRenderingTest(hooks);test("renders nothing when channel is opened", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-test.gjsindex aca9b9b16d4..f4585b88287 100644--- a/plugins/chat/test/javascripts/components/chat-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-test.gjs@@ -8,222 +8,219 @@ import { publishToMessageBus } from "discourse/tests/helpers/qunit-helpers";import ChatChannel from "discourse/plugins/chat/discourse/components/chat-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | chat-channel | status on mentions",- function (hooks) {- setupRenderingTest(hooks);-- const channelId = 1;- const actingUser = {+module("Component | chat-channel | status on mentions", function (hooks) {+ setupRenderingTest(hooks);++ const channelId = 1;+ const actingUser = {+ id: 1,+ username: "acting_user",+ };+ const mentionedUser = {+ id: 1000,+ username: "user1",+ status: {+ description: "surfing",+ emoji: "surfing_man",+ },+ };+ const mentionedUser2 = {+ id: 2000,+ username: "user2",+ status: {+ description: "vacation",+ emoji: "desert_island",+ },+ };+ const message = {+ id: 1891,+ message: `Hey @${mentionedUser.username}`,+ cooked: `<p>Hey <a class="mention" href="/u/${mentionedUser.username}">@${mentionedUser.username}</a></p>`,+ mentioned_users: [mentionedUser],+ created_at: "2020-08-04T15:00:00.000Z",+ user: {id: 1,- username: "acting_user",- };- const mentionedUser = {- id: 1000,- username: "user1",- status: {- description: "surfing",- emoji: "surfing_man",- },- };- const mentionedUser2 = {- id: 2000,- username: "user2",- status: {- description: "vacation",- emoji: "desert_island",- },- };- const message = {- id: 1891,- message: `Hey @${mentionedUser.username}`,- cooked: `<p>Hey <a class="mention" href="/u/${mentionedUser.username}">@${mentionedUser.username}</a></p>`,- mentioned_users: [mentionedUser],- created_at: "2020-08-04T15:00:00.000Z",- user: {- id: 1,- username: "jesse",- },- };-- hooks.beforeEach(function () {- pretender.get(`/chat/api/channels/1/messages`, () =>- response({- messages: [message],- meta: { can_delete_self: true },- })- );- pretender.get(`/chat/api/me/channels`, () =>- response({- direct_message_channels: [],- public_channels: [],- })- );-- this.channel = new ChatFabricators(getOwner(this)).channel({- id: channelId,- currentUserMembership: { following: true },- meta: { can_join_chat_channel: false },- });- this.appEvents = this.container.lookup("service:app-events");+ username: "jesse",+ },+ };++ hooks.beforeEach(function () {+ pretender.get(`/chat/api/channels/1/messages`, () =>+ response({+ messages: [message],+ meta: { can_delete_self: true },+ })+ );+ pretender.get(`/chat/api/me/channels`, () =>+ response({+ direct_message_channels: [],+ public_channels: [],+ })+ );++ this.channel = new ChatFabricators(getOwner(this)).channel({+ id: channelId,+ currentUserMembership: { following: true },+ meta: { can_join_chat_channel: false },});+ this.appEvents = this.container.lookup("service:app-events");+ });++ test("it shows status on mentions", async function (assert) {+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ assertStatusIsRendered(+ assert,+ statusSelector(mentionedUser.username),+ mentionedUser.status+ );+ });++ test("it updates status on mentions", async function (assert) {+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ const newStatus = {+ description: "off to dentist",+ emoji: "tooth",+ };- test("it shows status on mentions", async function (assert) {- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- assertStatusIsRendered(- assert,- statusSelector(mentionedUser.username),- mentionedUser.status- );+ this.appEvents.trigger("user-status:changed", {+ [mentionedUser.id]: newStatus,});- test("it updates status on mentions", async function (assert) {- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- const newStatus = {- description: "off to dentist",- emoji: "tooth",- };+ const selector = statusSelector(mentionedUser.username);+ await waitFor(selector);- this.appEvents.trigger("user-status:changed", {- [mentionedUser.id]: newStatus,- });+ assertStatusIsRendered(+ assert,+ statusSelector(mentionedUser.username),+ newStatus+ );+ });- const selector = statusSelector(mentionedUser.username);- await waitFor(selector);+ test("it deletes status on mentions", async function (assert) {+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );- assertStatusIsRendered(- assert,- statusSelector(mentionedUser.username),- newStatus- );+ this.appEvents.trigger("user-status:changed", {+ [mentionedUser.id]: null,});- test("it deletes status on mentions", async function (assert) {- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- this.appEvents.trigger("user-status:changed", {- [mentionedUser.id]: null,- });-- const selector = statusSelector(mentionedUser.username);- await waitFor(selector, { count: 0 });- assert.dom(selector).doesNotExist("status is deleted");+ const selector = statusSelector(mentionedUser.username);+ await waitFor(selector, { count: 0 });+ assert.dom(selector).doesNotExist("status is deleted");+ });++ test("it shows status on mentions on messages that came from Message Bus", async function (assert) {+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ await receiveChatMessageViaMessageBus();++ assertStatusIsRendered(+ assert,+ statusSelector(mentionedUser2.username),+ mentionedUser2.status+ );+ });++ test("it updates status on mentions on messages that came from Message Bus", async function (assert) {+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );+ await receiveChatMessageViaMessageBus();++ const newStatus = {+ description: "off to meeting",+ emoji: "calendar",+ };+ this.appEvents.trigger("user-status:changed", {+ [mentionedUser2.id]: newStatus,});- test("it shows status on mentions on messages that came from Message Bus", async function (assert) {- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- await receiveChatMessageViaMessageBus();-- assertStatusIsRendered(- assert,- statusSelector(mentionedUser2.username),- mentionedUser2.status- );+ const selector = statusSelector(mentionedUser2.username);+ await waitFor(selector);+ assertStatusIsRendered(+ assert,+ statusSelector(mentionedUser2.username),+ newStatus+ );+ });++ test("it deletes status on mentions on messages that came from Message Bus", async function (assert) {+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );+ await receiveChatMessageViaMessageBus();++ this.appEvents.trigger("user-status:changed", {+ [mentionedUser2.id]: null,});- test("it updates status on mentions on messages that came from Message Bus", async function (assert) {- await render(- <template><ChatChannel @channel={{this.channel}} /></template>+ const selector = statusSelector(mentionedUser2.username);+ await waitFor(selector, { count: 0 });+ assert.dom(selector).doesNotExist("status is deleted");+ });++ test("it shows status tooltip", async function (assert) {+ await render(+ <template>+ <ChatChannel @channel={{this.channel}} /><DTooltips />+ </template>+ );+ await triggerEvent(statusSelector(mentionedUser.username), "pointermove");++ assert+ .dom(".user-status-tooltip-description")+ .hasText(+ mentionedUser.status.description,+ "status description is correct");- await receiveChatMessageViaMessageBus();-- const newStatus = {- description: "off to meeting",- emoji: "calendar",- };- this.appEvents.trigger("user-status:changed", {- [mentionedUser2.id]: newStatus,- });-- const selector = statusSelector(mentionedUser2.username);- await waitFor(selector);- assertStatusIsRendered(- assert,- statusSelector(mentionedUser2.username),- newStatus- );- });- test("it deletes status on mentions on messages that came from Message Bus", async function (assert) {- await render(- <template><ChatChannel @channel={{this.channel}} /></template>+ assert+ .dom(+ `.user-status-message-tooltip-content img[alt='${mentionedUser.status.emoji}']`+ )+ .exists("status emoji is correct");+ });++ function assertStatusIsRendered(assert, selector, status) {+ assert+ .dom(selector)+ .exists("status is rendered")+ .hasAttribute(+ "src",+ new RegExp(`${status.emoji}.png`),+ "status emoji is updated");- await receiveChatMessageViaMessageBus();-- this.appEvents.trigger("user-status:changed", {- [mentionedUser2.id]: null,- });-- const selector = statusSelector(mentionedUser2.username);- await waitFor(selector, { count: 0 });- assert.dom(selector).doesNotExist("status is deleted");- });+ }- test("it shows status tooltip", async function (assert) {- await render(- <template>- <ChatChannel @channel={{this.channel}} /><DTooltips />- </template>- );- await triggerEvent(statusSelector(mentionedUser.username), "pointermove");-- assert- .dom(".user-status-tooltip-description")- .hasText(- mentionedUser.status.description,- "status description is correct"- );-- assert- .dom(- `.user-status-message-tooltip-content img[alt='${mentionedUser.status.emoji}']`- )- .exists("status emoji is correct");+ async function receiveChatMessageViaMessageBus() {+ await publishToMessageBus(`/chat/${channelId}`, {+ chat_message: {+ id: 2138,+ message: `Hey @${mentionedUser2.username}`,+ cooked: `<p>Hey <a class="mention" href="/u/${mentionedUser2.username}">@${mentionedUser2.username}</a></p>`,+ created_at: "2023-05-18T16:07:59.588Z",+ excerpt: `Hey @${mentionedUser2.username}`,+ available_flags: [],+ chat_channel_id: 7,+ mentioned_users: [mentionedUser2],+ user: actingUser,+ chat_webhook_event: null,+ uploads: [],+ },+ type: "sent",});+ }- function assertStatusIsRendered(assert, selector, status) {- assert- .dom(selector)- .exists("status is rendered")- .hasAttribute(- "src",- new RegExp(`${status.emoji}.png`),- "status emoji is updated"- );- }-- async function receiveChatMessageViaMessageBus() {- await publishToMessageBus(`/chat/${channelId}`, {- chat_message: {- id: 2138,- message: `Hey @${mentionedUser2.username}`,- cooked: `<p>Hey <a class="mention" href="/u/${mentionedUser2.username}">@${mentionedUser2.username}</a></p>`,- created_at: "2023-05-18T16:07:59.588Z",- excerpt: `Hey @${mentionedUser2.username}`,- available_flags: [],- chat_channel_id: 7,- mentioned_users: [mentionedUser2],- user: actingUser,- chat_webhook_event: null,- uploads: [],- },- type: "sent",- });- }-- function statusSelector(username) {- return `.mention[href='/u/${username}'] .user-status-message img`;- }+ function statusSelector(username) {+ return `.mention[href='/u/${username}'] .user-status-message img`;}-);+});diff --git a/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjsindex bbbb1f4a06d..8d816aa46c7 100644--- a/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs@@ -3,7 +3,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatComposerDropdown from "discourse/plugins/chat/discourse/components/chat-composer-dropdown";-module("Discourse Chat | Component | chat-composer-dropdown", function (hooks) {+module("Component | chat-composer-dropdown", function (hooks) {setupRenderingTest(hooks);test("buttons", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjsindex f752639ee4c..da5737852c2 100644--- a/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs@@ -5,90 +5,87 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatComposerMessageDetails from "discourse/plugins/chat/discourse/components/chat-composer-message-details";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | chat-composer-message-details",- function (hooks) {- setupRenderingTest(hooks);-- test("data-id attribute", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message();-- await render(- <template>- <ChatComposerMessageDetails @message={{this.message}} />- </template>- );-- assert- .dom(".chat-composer-message-details")- .hasAttribute("data-id", this.message.id.toString());+module("Component | chat-composer-message-details", function (hooks) {+ setupRenderingTest(hooks);++ test("data-id attribute", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message();++ await render(+ <template>+ <ChatComposerMessageDetails @message={{this.message}} />+ </template>+ );++ assert+ .dom(".chat-composer-message-details")+ .hasAttribute("data-id", this.message.id.toString());+ });++ test("editing a message has the pencil icon", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message({+ editing: true,});- test("editing a message has the pencil icon", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message({- editing: true,- });+ await render(+ <template>+ <ChatComposerMessageDetails @message={{this.message}} />+ </template>+ );- await render(- <template>- <ChatComposerMessageDetails @message={{this.message}} />- </template>- );+ assert.dom(".chat-composer-message-details .d-icon-pencil").exists();+ });- assert.dom(".chat-composer-message-details .d-icon-pencil").exists();+ test("replying to a message has the reply icon", async function (assert) {+ const firstMessage = new ChatFabricators(getOwner(this)).message();+ this.message = new ChatFabricators(getOwner(this)).message({+ inReplyTo: firstMessage,});- test("replying to a message has the reply icon", async function (assert) {- const firstMessage = new ChatFabricators(getOwner(this)).message();- this.message = new ChatFabricators(getOwner(this)).message({- inReplyTo: firstMessage,- });-- await render(- <template>- <ChatComposerMessageDetails @message={{this.message}} />- </template>- );-- assert.dom(".chat-composer-message-details .d-icon-reply").exists();- });-- test("displays user avatar", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message();-- await render(- <template>- <ChatComposerMessageDetails @message={{this.message}} />- </template>- );-- assert- .dom(".chat-composer-message-details .chat-user-avatar .avatar")- .hasAttribute("title", this.message.user.username);- });-- test("displays message excerpt", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message();-- await render(- <template>- <ChatComposerMessageDetails @message={{this.message}} />- </template>- );-- assert.dom(".chat-reply__excerpt").hasText(this.message.excerpt);- });-- test("displays user’s username", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message();-- await render(- <template>- <ChatComposerMessageDetails @message={{this.message}} />- </template>- );-- assert.dom(".chat-reply__username").hasText(this.message.user.username);- });- }-);+ await render(+ <template>+ <ChatComposerMessageDetails @message={{this.message}} />+ </template>+ );++ assert.dom(".chat-composer-message-details .d-icon-reply").exists();+ });++ test("displays user avatar", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message();++ await render(+ <template>+ <ChatComposerMessageDetails @message={{this.message}} />+ </template>+ );++ assert+ .dom(".chat-composer-message-details .chat-user-avatar .avatar")+ .hasAttribute("title", this.message.user.username);+ });++ test("displays message excerpt", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message();++ await render(+ <template>+ <ChatComposerMessageDetails @message={{this.message}} />+ </template>+ );++ assert.dom(".chat-reply__excerpt").hasText(this.message.excerpt);+ });++ test("displays user’s username", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message();++ await render(+ <template>+ <ChatComposerMessageDetails @message={{this.message}} />+ </template>+ );++ assert.dom(".chat-reply__username").hasText(this.message.user.username);+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjsindex 0de52c5c81f..070103bfb31 100644--- a/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs@@ -6,87 +6,80 @@ import { i18n } from "discourse-i18n";import Channel from "discourse/plugins/chat/discourse/components/chat/composer/channel";import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";-module(- "Discourse Chat | Component | chat-composer placeholder",- function (hooks) {- setupRenderingTest(hooks);-- test("direct message to self shows Jot something down", async function (assert) {- pretender.get("/emojis.json", () => [200, [], {}]);-- this.currentUser.set("id", 1);- this.channel = ChatChannel.create({- chatable_type: "DirectMessage",- chatable: {- users: [{ id: 1 }],- },- });-- await render(<template><Channel @channel={{this.channel}} /></template>);-- assert- .dom(".chat-composer__input")- .hasAttribute("placeholder", "Jot something down");+module("Component | chat-composer placeholder", function (hooks) {+ setupRenderingTest(hooks);++ test("direct message to self shows Jot something down", async function (assert) {+ pretender.get("/emojis.json", () => [200, [], {}]);++ this.currentUser.set("id", 1);+ this.channel = ChatChannel.create({+ chatable_type: "DirectMessage",+ chatable: {+ users: [{ id: 1 }],+ },});- test("direct message to multiple folks shows their names when not a group", async function (assert) {- pretender.get("/emojis.json", () => [200, [], {}]);-- this.channel = ChatChannel.create({- chatable_type: "DirectMessage",- chatable: {- group: false,- users: [- { name: "Tomtom" },- { name: "Steaky" },- { username: "zorro" },- ],- },- });-- await render(<template><Channel @channel={{this.channel}} /></template>);-- assert- .dom(".chat-composer__input")- .hasAttribute("placeholder", "Chat with Tomtom, Steaky, @zorro");+ await render(<template><Channel @channel={{this.channel}} /></template>);++ assert+ .dom(".chat-composer__input")+ .hasAttribute("placeholder", "Jot something down");+ });++ test("direct message to multiple folks shows their names when not a group", async function (assert) {+ pretender.get("/emojis.json", () => [200, [], {}]);++ this.channel = ChatChannel.create({+ chatable_type: "DirectMessage",+ chatable: {+ group: false,+ users: [{ name: "Tomtom" }, { name: "Steaky" }, { username: "zorro" }],+ },});- test("direct message to group shows Chat in group", async function (assert) {- pretender.get("/chat/emojis.json", () => [200, [], {}]);-- this.channel = ChatChannel.create({- chatable_type: "DirectMessage",- title: "Meetup Chat",- chatable: {- group: true,- users: [- { username: "user1" },- { username: "user2" },- { username: "user3" },- ],- },- });-- await render(<template><Channel @channel={{this.channel}} /></template>);-- assert- .dom(".chat-composer__input")- .hasAttribute("placeholder", i18n("chat.placeholder_group"));+ await render(<template><Channel @channel={{this.channel}} /></template>);++ assert+ .dom(".chat-composer__input")+ .hasAttribute("placeholder", "Chat with Tomtom, Steaky, @zorro");+ });++ test("direct message to group shows Chat in group", async function (assert) {+ pretender.get("/chat/emojis.json", () => [200, [], {}]);++ this.channel = ChatChannel.create({+ chatable_type: "DirectMessage",+ title: "Meetup Chat",+ chatable: {+ group: true,+ users: [+ { username: "user1" },+ { username: "user2" },+ { username: "user3" },+ ],+ },});- test("message to channel shows send message to channel name", async function (assert) {- pretender.get("/emojis.json", () => [200, [], {}]);+ await render(<template><Channel @channel={{this.channel}} /></template>);- this.channel = ChatChannel.create({- chatable_type: "Category",- title: "just-cats",- });+ assert+ .dom(".chat-composer__input")+ .hasAttribute("placeholder", i18n("chat.placeholder_group"));+ });- await render(<template><Channel @channel={{this.channel}} /></template>);+ test("message to channel shows send message to channel name", async function (assert) {+ pretender.get("/emojis.json", () => [200, [], {}]);- assert- .dom(".chat-composer__input")- .hasAttribute("placeholder", "Chat in #just-cats");+ this.channel = ChatChannel.create({+ chatable_type: "Category",+ title: "just-cats",});- }-);++ await render(<template><Channel @channel={{this.channel}} /></template>);++ assert+ .dom(".chat-composer__input")+ .hasAttribute("placeholder", "Chat in #just-cats");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjsindex 4f2736b599f..20efd810e74 100644--- a/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs@@ -6,7 +6,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";import ChatComposerUpload from "discourse/plugins/chat/discourse/components/chat-composer-upload";-module("Discourse Chat | Component | chat-composer-upload", function (hooks) {+module("Component | chat-composer-upload", function (hooks) {setupRenderingTest(hooks);test("file - uploading in progress", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjsindex 781b4c0aaf3..06f273327c2 100644--- a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs@@ -41,7 +41,7 @@ function setupUploadPretender() {);}-module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {+module("Component | chat-composer-uploads", function (hooks) {setupRenderingTest(hooks);test("loading uploads from an outside source (e.g. draft or editing message)", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjsindex 742cf49c135..ab9111303e9 100644--- a/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs@@ -3,7 +3,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatEmojiAvatar from "discourse/plugins/chat/discourse/components/chat-emoji-avatar";-module("Discourse Chat | Component | chat-emoji-avatar", function (hooks) {+module("Component | chat-emoji-avatar", function (hooks) {setupRenderingTest(hooks);test("uses an emoji as avatar", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs b/plugins/chat/test/javascripts/components/chat-header-icon-test.gjsindex 671c1f86115..5c60dffdfd5 100644--- a/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs@@ -8,7 +8,7 @@ import { i18n } from "discourse-i18n";import Icon from "discourse/plugins/chat/discourse/components/chat/header/icon";import { HEADER_INDICATOR_PREFERENCE_ALL_NEW } from "discourse/plugins/chat/discourse/lib/chat-constants";-module("Discourse Chat | Component | chat-header-icon", function (hooks) {+module("Component | chat-header-icon", function (hooks) {setupRenderingTest(hooks);test("full page - never separated sidebar mode", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjsindex ae87c804fe7..cde935adf00 100644--- a/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs@@ -6,7 +6,7 @@ import Avatar from "discourse/plugins/chat/discourse/components/chat/message/avaimport ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";-module("Discourse Chat | Component | chat-message-avatar", function (hooks) {+module("Component | chat-message-avatar", function (hooks) {setupRenderingTest(hooks);test("chat_webhook_event", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs b/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjsindex f642c8d86ee..56ae750f570 100644--- a/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs@@ -46,7 +46,7 @@ const galleryCooked =const evilString = "<script>someeviltitle</script>";const evilStringEscaped = "<script>someeviltitle</script>";-module("Discourse Chat | Component | chat message collapser", function (hooks) {+module("Component | chat message collapser", function (hooks) {setupRenderingTest(hooks);test("escapes uploads header", async function (assert) {@@ -61,320 +61,297 @@ module("Discourse Chat | Component | chat message collapser", function (hooks) {});});-module(- "Discourse Chat | Component | chat message collapser youtube",- function (hooks) {- setupRenderingTest(hooks);+module("Component | chat message collapser youtube", function (hooks) {+ setupRenderingTest(hooks);- test("escapes youtube header", async function (assert) {- this.set(- "cooked",- youtubeCooked.replace(- "https://www.youtube.com/watch?v=ytId1",- `https://www.youtube.com/watch?v=${evilString}`- )- );- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ test("escapes youtube header", async function (assert) {+ this.set(+ "cooked",+ youtubeCooked.replace(+ "https://www.youtube.com/watch?v=ytId1",+ `https://www.youtube.com/watch?v=${evilString}`+ )+ );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- assert- .dom(".chat-message-collapser-link")- .hasProperty(- "href",- "https://www.youtube.com/watch?v=%3Cscript%3Esomeeviltitle%3C/script%3E"- );- });+ assert+ .dom(".chat-message-collapser-link")+ .hasProperty(+ "href",+ "https://www.youtube.com/watch?v=%3Cscript%3Esomeeviltitle%3C/script%3E"+ );+ });- test("shows youtube link in header", async function (assert) {- this.set("cooked", youtubeCooked);+ test("shows youtube link in header", async function (assert) {+ this.set("cooked", youtubeCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const link = queryAll(".chat-message-collapser-link");+ const link = queryAll(".chat-message-collapser-link");- assert.strictEqual(link.length, 2, "two youtube links rendered");- assert- .dom(link[0])- .hasAttribute("href", "https://www.youtube.com/watch?v=ytId1");- assert- .dom(link[1])- .hasAttribute("href", "https://www.youtube.com/watch?v=ytId2");- });+ assert.strictEqual(link.length, 2, "two youtube links rendered");+ assert+ .dom(link[0])+ .hasAttribute("href", "https://www.youtube.com/watch?v=ytId1");+ assert+ .dom(link[1])+ .hasAttribute("href", "https://www.youtube.com/watch?v=ytId2");+ });- test("shows all user written text", async function (assert) {- youtubeCooked.youtubeid;- this.set("cooked", youtubeCooked);+ test("shows all user written text", async function (assert) {+ youtubeCooked.youtubeid;+ this.set("cooked", youtubeCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const text = queryAll(".chat-message-collapser p");+ const text = queryAll(".chat-message-collapser p");- assert.strictEqual(text.length, 3, "shows all written text");- assert.dom(text[0]).hasText("written text", "first line of written text");- assert- .dom(text[1])- .hasText("more written text", "third line of written text");- assert- .dom(text[2])- .hasText("and even more", "fifth line of written text");- });+ assert.strictEqual(text.length, 3, "shows all written text");+ assert.dom(text[0]).hasText("written text", "first line of written text");+ assert+ .dom(text[1])+ .hasText("more written text", "third line of written text");+ assert.dom(text[2]).hasText("and even more", "fifth line of written text");+ });- test("collapses and expands cooked youtube", async function (assert) {- this.set("cooked", youtubeCooked);+ test("collapses and expands cooked youtube", async function (assert) {+ this.set("cooked", youtubeCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const youtubeDivs = queryAll(".youtube-onebox");+ const youtubeDivs = queryAll(".youtube-onebox");- assert.strictEqual(- youtubeDivs.length,- 2,- "two youtube previews rendered"- );+ assert.strictEqual(youtubeDivs.length, 2, "two youtube previews rendered");- await click(".chat-message-collapser-opened");+ await click(".chat-message-collapser-opened");- assert- .dom(".youtube-onebox[data-video-id='ytId1']")- .isNotVisible("first youtube preview hidden");- assert- .dom(".youtube-onebox[data-video-id='ytId2']")- .isVisible("second youtube preview still visible");+ assert+ .dom(".youtube-onebox[data-video-id='ytId1']")+ .isNotVisible("first youtube preview hidden");+ assert+ .dom(".youtube-onebox[data-video-id='ytId2']")+ .isVisible("second youtube preview still visible");- await click(".chat-message-collapser-closed");+ await click(".chat-message-collapser-closed");- assert.strictEqual(- youtubeDivs.length,- 2,- "two youtube previews rendered"- );+ assert.strictEqual(youtubeDivs.length, 2, "two youtube previews rendered");- await click(queryAll(".chat-message-collapser-opened")[1]);+ await click(queryAll(".chat-message-collapser-opened")[1]);- assert- .dom(".youtube-onebox[data-video-id='ytId1']")- .isVisible("first youtube preview still visible");- assert- .dom(".youtube-onebox[data-video-id='ytId2']")- .isNotVisible("second youtube preview hidden");+ assert+ .dom(".youtube-onebox[data-video-id='ytId1']")+ .isVisible("first youtube preview still visible");+ assert+ .dom(".youtube-onebox[data-video-id='ytId2']")+ .isNotVisible("second youtube preview hidden");- await click(".chat-message-collapser-closed");+ await click(".chat-message-collapser-closed");- assert.strictEqual(- youtubeDivs.length,- 2,- "two youtube previews rendered"- );- });- }-);+ assert.strictEqual(youtubeDivs.length, 2, "two youtube previews rendered");+ });+});-module(- "Discourse Chat | Component | chat message collapser images",- function (hooks) {- setupRenderingTest(hooks);- const imageTextCooked = "<p>A picture of Tomtom</p>";+module("Component | chat message collapser images", function (hooks) {+ setupRenderingTest(hooks);+ const imageTextCooked = "<p>A picture of Tomtom</p>";- test("shows filename for one image", async function (assert) {- this.set("cooked", imageTextCooked);- this.set("uploads", [{ original_filename: "tomtom.jpeg" }]);+ test("shows filename for one image", async function (assert) {+ this.set("cooked", imageTextCooked);+ this.set("uploads", [{ original_filename: "tomtom.jpeg" }]);- await render(- <template>- <ChatMessageCollapser- @cooked={{this.cooked}}- @uploads={{this.uploads}}- />- </template>- );+ await render(+ <template>+ <ChatMessageCollapser+ @cooked={{this.cooked}}+ @uploads={{this.uploads}}+ />+ </template>+ );- assert- .dom(".chat-message-collapser-link-small")- .includesText("tomtom.jpeg");- });+ assert+ .dom(".chat-message-collapser-link-small")+ .includesText("tomtom.jpeg");+ });- test("shows number of files for multiple images", async function (assert) {- this.set("cooked", imageTextCooked);- this.set("uploads", [{}, {}]);+ test("shows number of files for multiple images", async function (assert) {+ this.set("cooked", imageTextCooked);+ this.set("uploads", [{}, {}]);- await render(- <template>- <ChatMessageCollapser- @cooked={{this.cooked}}- @uploads={{this.uploads}}- />- </template>- );+ await render(+ <template>+ <ChatMessageCollapser+ @cooked={{this.cooked}}+ @uploads={{this.uploads}}+ />+ </template>+ );- assert.dom(".chat-message-collapser-link-small").includesText("2 files");- });+ assert.dom(".chat-message-collapser-link-small").includesText("2 files");+ });- test("collapses and expands images", async function (assert) {- this.set("cooked", imageTextCooked);- this.set("uploads", [- {- original_filename: "tomtom.png",- url: "images/d-logo-sketch-small.png",- width: 16,- height: 16,- },- ]);+ test("collapses and expands images", async function (assert) {+ this.set("cooked", imageTextCooked);+ this.set("uploads", [+ {+ original_filename: "tomtom.png",+ url: "images/d-logo-sketch-small.png",+ width: 16,+ height: 16,+ },+ ]);- await render(- <template>- <ChatMessageCollapser- @cooked={{this.cooked}}- @uploads={{this.uploads}}- />- </template>- );+ await render(+ <template>+ <ChatMessageCollapser+ @cooked={{this.cooked}}+ @uploads={{this.uploads}}+ />+ </template>+ );- assert.dom(".chat-uploads").isVisible();- assert.dom(".chat-img-upload").isVisible();+ assert.dom(".chat-uploads").isVisible();+ assert.dom(".chat-img-upload").isVisible();- await click(".chat-message-collapser-opened");- assert.dom(".chat-uploads").isNotVisible();- assert.dom(".chat-img-upload").isNotVisible();+ await click(".chat-message-collapser-opened");+ assert.dom(".chat-uploads").isNotVisible();+ assert.dom(".chat-img-upload").isNotVisible();- await click(".chat-message-collapser-closed");- assert.dom(".chat-uploads").isVisible();- assert.dom(".chat-img-upload").isVisible();- });+ await click(".chat-message-collapser-closed");+ assert.dom(".chat-uploads").isVisible();+ assert.dom(".chat-img-upload").isVisible();+ });- test("rebinds lightbox when upload data changes", async function (assert) {- this.set("cooked", imageTextCooked);- this.set("uploads", [- {- original_filename: "tomtom.png",- url: "/images/d-logo-sketch-small.png",- short_path: "/uploads/short-url/one",- width: 16,- height: 16,- },- ]);+ test("rebinds lightbox when upload data changes", async function (assert) {+ this.set("cooked", imageTextCooked);+ this.set("uploads", [+ {+ original_filename: "tomtom.png",+ url: "/images/d-logo-sketch-small.png",+ short_path: "/uploads/short-url/one",+ width: 16,+ height: 16,+ },+ ]);- await render(- <template>- <ChatMessageCollapser- @cooked={{this.cooked}}- @uploads={{this.uploads}}- />- </template>- );+ await render(+ <template>+ <ChatMessageCollapser+ @cooked={{this.cooked}}+ @uploads={{this.uploads}}+ />+ </template>+ );- await click(".chat-img-upload");- await waitFor(".pswp--open");- assert.dom(".pswp--open").exists("opens for initial upload");- await click(".pswp__button--close");- await waitFor(".pswp--open", { count: 0 });-- this.set("uploads", [- {- original_filename: "tomtom-new.png",- url: "/images/avatar.png",- short_path: "/uploads/short-url/two",- width: 16,- height: 16,- },- ]);- await settled();-- await click(".chat-img-upload");- await waitFor(".pswp--open");- assert.dom(".pswp--open").exists("opens after uploads update");- await click(".pswp__button--close");- await waitFor(".pswp--open", { count: 0 });- });- }-);+ await click(".chat-img-upload");+ await waitFor(".pswp--open");+ assert.dom(".pswp--open").exists("opens for initial upload");+ await click(".pswp__button--close");+ await waitFor(".pswp--open", { count: 0 });++ this.set("uploads", [+ {+ original_filename: "tomtom-new.png",+ url: "/images/avatar.png",+ short_path: "/uploads/short-url/two",+ width: 16,+ height: 16,+ },+ ]);+ await settled();++ await click(".chat-img-upload");+ await waitFor(".pswp--open");+ assert.dom(".pswp--open").exists("opens after uploads update");+ await click(".pswp__button--close");+ await waitFor(".pswp--open", { count: 0 });+ });+});-module(- "Discourse Chat | Component | chat message collapser animated image",- function (hooks) {- setupRenderingTest(hooks);+module("Component | chat message collapser animated image", function (hooks) {+ setupRenderingTest(hooks);- test("shows links for animated image", async function (assert) {- this.set("cooked", animatedImageCooked);+ test("shows links for animated image", async function (assert) {+ this.set("cooked", animatedImageCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const links = queryAll("a.chat-message-collapser-link-small");+ const links = queryAll("a.chat-message-collapser-link-small");- assert.dom(links[0]).includesText("avatar.png");- assert.dom(links[0]).hasAttribute("href", "/images/avatar.png");+ assert.dom(links[0]).includesText("avatar.png");+ assert.dom(links[0]).hasAttribute("href", "/images/avatar.png");- assert.dom(links[1]).includesText("d-logo-sketch-small.png");- assert- .dom(links[1])- .hasAttribute("href", "/images/d-logo-sketch-small.png");- });+ assert.dom(links[1]).includesText("d-logo-sketch-small.png");+ assert+ .dom(links[1])+ .hasAttribute("href", "/images/d-logo-sketch-small.png");+ });- test("shows all user written text", async function (assert) {- this.set("cooked", animatedImageCooked);+ test("shows all user written text", async function (assert) {+ this.set("cooked", animatedImageCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const text = queryAll(".chat-message-collapser p");+ const text = queryAll(".chat-message-collapser p");- assert.strictEqual(text.length, 5, "shows all written text");- assert.dom(text[0]).hasText("written text");- assert.dom(text[2]).hasText("more written text");- assert.dom(text[4]).hasText("and even more");- });+ assert.strictEqual(text.length, 5, "shows all written text");+ assert.dom(text[0]).hasText("written text");+ assert.dom(text[2]).hasText("more written text");+ assert.dom(text[4]).hasText("and even more");+ });- test("collapses and expands animated image onebox", async function (assert) {- this.set("cooked", animatedImageCooked);+ test("collapses and expands animated image onebox", async function (assert) {+ this.set("cooked", animatedImageCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const animatedOneboxes = queryAll(".animated.onebox");+ const animatedOneboxes = queryAll(".animated.onebox");- assert.strictEqual(animatedOneboxes.length, 2, "two oneboxes rendered");+ assert.strictEqual(animatedOneboxes.length, 2, "two oneboxes rendered");- await click(".chat-message-collapser-opened");+ await click(".chat-message-collapser-opened");- assert- .dom(".onebox[src='/images/avatar.png']")- .isNotVisible("first onebox hidden");- assert- .dom(".onebox[src='/images/d-logo-sketch-small.png']")- .isVisible("second onebox still visible");+ assert+ .dom(".onebox[src='/images/avatar.png']")+ .isNotVisible("first onebox hidden");+ assert+ .dom(".onebox[src='/images/d-logo-sketch-small.png']")+ .isVisible("second onebox still visible");- await click(".chat-message-collapser-closed");+ await click(".chat-message-collapser-closed");- assert.strictEqual(animatedOneboxes.length, 2, "two oneboxes rendered");+ assert.strictEqual(animatedOneboxes.length, 2, "two oneboxes rendered");- await click(queryAll(".chat-message-collapser-opened")[1]);+ await click(queryAll(".chat-message-collapser-opened")[1]);- assert- .dom(".onebox[src='/images/avatar.png']")- .isVisible("first onebox still visible");- assert- .dom(".onebox[src='/images/d-logo-sketch-small.png']")- .isNotVisible("second onebox hidden");+ assert+ .dom(".onebox[src='/images/avatar.png']")+ .isVisible("first onebox still visible");+ assert+ .dom(".onebox[src='/images/d-logo-sketch-small.png']")+ .isNotVisible("second onebox hidden");- await click(".chat-message-collapser-closed");+ await click(".chat-message-collapser-closed");- assert.strictEqual(animatedOneboxes.length, 2, "two oneboxes rendered");- });- }-);+ assert.strictEqual(animatedOneboxes.length, 2, "two oneboxes rendered");+ });+});module(- "Discourse Chat | Component | chat message collapser external image onebox",+ "Component | chat message collapser external image onebox",function (hooks) {setupRenderingTest(hooks);@@ -449,193 +426,187 @@ module(});-module(- "Discourse Chat | Component | chat message collapser images",- function (hooks) {- setupRenderingTest(hooks);+module("Component | chat message collapser images", function (hooks) {+ setupRenderingTest(hooks);- skip("escapes link", async function (assert) {- this.set(- "cooked",- imageCooked- .replace("shows alt", evilString)- .replace("/images/d-logo-sketch-small.png", evilString)- );- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ skip("escapes link", async function (assert) {+ this.set(+ "cooked",+ imageCooked+ .replace("shows alt", evilString)+ .replace("/images/d-logo-sketch-small.png", evilString)+ );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const links = [- ...document.querySelectorAll(".chat-message-collapser-link-small"),- ];+ const links = [+ ...document.querySelectorAll(".chat-message-collapser-link-small"),+ ];- assert.dom(links[0]).includesHtml(evilStringEscaped);- assert- .dom(links[1])- .includesHtml("<script>someeviltitle</script>");- });+ assert.dom(links[0]).includesHtml(evilStringEscaped);+ assert+ .dom(links[1])+ .includesHtml("<script>someeviltitle</script>");+ });- test("shows alt or links (if no alt) for linked image", async function (assert) {- this.set("cooked", imageCooked);+ test("shows alt or links (if no alt) for linked image", async function (assert) {+ this.set("cooked", imageCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const links = queryAll("a.chat-message-collapser-link-small");+ const links = queryAll("a.chat-message-collapser-link-small");- assert.dom(links[0]).includesText("shows alt");- assert.dom(links[0]).hasAttribute("href", "/images/avatar.png");+ assert.dom(links[0]).includesText("shows alt");+ assert.dom(links[0]).hasAttribute("href", "/images/avatar.png");- assert.dom(links[1]).includesText("/images/d-logo-sketch-small.png");- assert- .dom(links[1])- .hasAttribute("href", "/images/d-logo-sketch-small.png");- });+ assert.dom(links[1]).includesText("/images/d-logo-sketch-small.png");+ assert+ .dom(links[1])+ .hasAttribute("href", "/images/d-logo-sketch-small.png");+ });- test("shows all user written text", async function (assert) {- this.set("cooked", imageCooked);+ test("shows all user written text", async function (assert) {+ this.set("cooked", imageCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const text = queryAll(".chat-message-collapser p");+ const text = queryAll(".chat-message-collapser p");- assert.strictEqual(text.length, 6, "shows all written text");- assert.dom(text[0]).hasText("written text");- assert.dom(text[2]).hasText("more written text");- assert.dom(text[4]).hasText("and even more");- });+ assert.strictEqual(text.length, 6, "shows all written text");+ assert.dom(text[0]).hasText("written text");+ assert.dom(text[2]).hasText("more written text");+ assert.dom(text[4]).hasText("and even more");+ });- test("collapses and expands images", async function (assert) {- this.set("cooked", imageCooked);+ test("collapses and expands images", async function (assert) {+ this.set("cooked", imageCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const images = queryAll("img");+ const images = queryAll("img");- assert.strictEqual(images.length, 3);+ assert.strictEqual(images.length, 3);- await click(".chat-message-collapser-opened");+ await click(".chat-message-collapser-opened");- assert- .dom("img[src='/images/avatar.png']")- .isNotVisible("first image hidden");- assert- .dom("img[src='/images/d-logo-sketch-small.png']")- .isVisible("second image still visible");+ assert+ .dom("img[src='/images/avatar.png']")+ .isNotVisible("first image hidden");+ assert+ .dom("img[src='/images/d-logo-sketch-small.png']")+ .isVisible("second image still visible");- await click(".chat-message-collapser-closed");+ await click(".chat-message-collapser-closed");- assert.strictEqual(images.length, 3);+ assert.strictEqual(images.length, 3);- await click(queryAll(".chat-message-collapser-opened")[1]);+ await click(queryAll(".chat-message-collapser-opened")[1]);- assert- .dom("img[src='/images/avatar.png']")- .isVisible("first image still visible");- assert- .dom("img[src='/images/d-logo-sketch-small.png']")- .isNotVisible("second image hidden");+ assert+ .dom("img[src='/images/avatar.png']")+ .isVisible("first image still visible");+ assert+ .dom("img[src='/images/d-logo-sketch-small.png']")+ .isNotVisible("second image hidden");- await click(".chat-message-collapser-closed");+ await click(".chat-message-collapser-closed");- assert.strictEqual(images.length, 3);- });+ assert.strictEqual(images.length, 3);+ });- test("does not show collapser for emoji images", async function (assert) {- this.set("cooked", imageCooked);+ test("does not show collapser for emoji images", async function (assert) {+ this.set("cooked", imageCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const links = queryAll("a.chat-message-collapser-link-small");- const images = queryAll("img");- const collapser = queryAll(".chat-message-collapser-opened");+ const links = queryAll("a.chat-message-collapser-link-small");+ const images = queryAll("img");+ const collapser = queryAll(".chat-message-collapser-opened");- assert.strictEqual(links.length, 2);- assert.strictEqual(images.length, 3, "shows images and emoji");- assert.strictEqual(collapser.length, 2);- });- }-);+ assert.strictEqual(links.length, 2);+ assert.strictEqual(images.length, 3, "shows images and emoji");+ assert.strictEqual(collapser.length, 2);+ });+});-module(- "Discourse Chat | Component | chat message collapser galleries",- function (hooks) {- setupRenderingTest(hooks);+module("Component | chat message collapser galleries", function (hooks) {+ setupRenderingTest(hooks);- test("escapes title/link", async function (assert) {- this.set(- "cooked",- galleryCooked- .replace("https://imgur.com/gallery/yyVx5lJ", evilString)- .replace("Le tomtom album", evilString)- );- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ test("escapes title/link", async function (assert) {+ this.set(+ "cooked",+ galleryCooked+ .replace("https://imgur.com/gallery/yyVx5lJ", evilString)+ .replace("Le tomtom album", evilString)+ );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- assert- .dom(".chat-message-collapser-link-small")- .hasProperty("href", /%3Cscript%3Esomeeviltitle%3C\/script%3E$/);- assert.dom(".chat-message-collapser-link-small").hasHtml("someeviltitle");- });+ assert+ .dom(".chat-message-collapser-link-small")+ .hasProperty("href", /%3Cscript%3Esomeeviltitle%3C\/script%3E$/);+ assert.dom(".chat-message-collapser-link-small").hasHtml("someeviltitle");+ });- test("removes album title overlay", async function (assert) {- this.set("cooked", galleryCooked);+ test("removes album title overlay", async function (assert) {+ this.set("cooked", galleryCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- assert.dom(".album-title").doesNotExist("album title removed");- });+ assert.dom(".album-title").doesNotExist("album title removed");+ });- test("shows gallery link", async function (assert) {- this.set("cooked", galleryCooked);+ test("shows gallery link", async function (assert) {+ this.set("cooked", galleryCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- assert- .dom(".chat-message-collapser-link-small")- .includesText("Le tomtom album");- });+ assert+ .dom(".chat-message-collapser-link-small")+ .includesText("Le tomtom album");+ });- test("shows all user written text", async function (assert) {- this.set("cooked", galleryCooked);+ test("shows all user written text", async function (assert) {+ this.set("cooked", galleryCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- const text = queryAll(".chat-message-collapser p");+ const text = queryAll(".chat-message-collapser p");- assert.strictEqual(text.length, 2, "shows all written text");- assert.dom(text[0]).hasText("written text");- assert.dom(text[1]).hasText("more written text");- });+ assert.strictEqual(text.length, 2, "shows all written text");+ assert.dom(text[0]).hasText("written text");+ assert.dom(text[1]).hasText("more written text");+ });- test("collapses and expands images", async function (assert) {- this.set("cooked", galleryCooked);+ test("collapses and expands images", async function (assert) {+ this.set("cooked", galleryCooked);- await render(- <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>- );+ await render(+ <template><ChatMessageCollapser @cooked={{this.cooked}} /></template>+ );- assert.dom("img").isVisible("image visible initially");+ assert.dom("img").isVisible("image visible initially");- await click(".chat-message-collapser-opened");- assert.dom("img").isNotVisible("image hidden");+ await click(".chat-message-collapser-opened");+ assert.dom("img").isNotVisible("image hidden");- await click(".chat-message-collapser-closed");- assert.dom("img").isVisible("image visible initially");- });- }-);+ await click(".chat-message-collapser-closed");+ assert.dom("img").isVisible("image visible initially");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-message-info-test.gjs b/plugins/chat/test/javascripts/components/chat-message-info-test.gjsindex 6e5cc3c6f5c..401a409f8dd 100644--- a/plugins/chat/test/javascripts/components/chat-message-info-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-info-test.gjs@@ -8,7 +8,7 @@ import Info from "discourse/plugins/chat/discourse/components/chat/message/info"import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";-module("Discourse Chat | Component | chat-message-info", function (hooks) {+module("Component | chat-message-info", function (hooks) {setupRenderingTest(hooks);test("chat_webhook_event", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs b/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjsindex a87d13e96f5..7df30524bc1 100644--- a/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs@@ -7,60 +7,49 @@ import { i18n } from "discourse-i18n";import LeftGutter from "discourse/plugins/chat/discourse/components/chat/message/left-gutter";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | Chat::Message::LeftGutter",- function (hooks) {- setupRenderingTest(hooks);+module("Component | Chat::Message::LeftGutter", function (hooks) {+ setupRenderingTest(hooks);- test("default", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message();+ test("default", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message();- await render(- <template><LeftGutter @message={{this.message}} /></template>- );+ await render(<template><LeftGutter @message={{this.message}} /></template>);- assert.dom(".chat-message-left-gutter__date").exists();+ assert.dom(".chat-message-left-gutter__date").exists();+ });++ test("with reviewable", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message({+ reviewable_id: 1,});- test("with reviewable", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message({- reviewable_id: 1,- });+ await render(<template><LeftGutter @message={{this.message}} /></template>);- await render(- <template><LeftGutter @message={{this.message}} /></template>- );+ assert+ .dom(".chat-message-left-gutter__flag .svg-icon-title")+ .hasAttribute("title", i18n("chat.flagged"));+ });- assert- .dom(".chat-message-left-gutter__flag .svg-icon-title")- .hasAttribute("title", i18n("chat.flagged"));+ test("with flag status", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message({+ user_flag_status: 0,});- test("with flag status", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message({- user_flag_status: 0,- });+ await render(<template><LeftGutter @message={{this.message}} /></template>);- await render(- <template><LeftGutter @message={{this.message}} /></template>- );+ assert+ .dom(".chat-message-left-gutter__flag .svg-icon-title")+ .hasAttribute("title", i18n("chat.you_flagged"));+ });- assert- .dom(".chat-message-left-gutter__flag .svg-icon-title")- .hasAttribute("title", i18n("chat.you_flagged"));+ test("bookmark", async function (assert) {+ this.message = new ChatFabricators(getOwner(this)).message({+ bookmark: new CoreFabricators(getOwner(this)).bookmark(),});- test("bookmark", async function (assert) {- this.message = new ChatFabricators(getOwner(this)).message({- bookmark: new CoreFabricators(getOwner(this)).bookmark(),- });-- await render(- <template><LeftGutter @message={{this.message}} /></template>- );+ await render(<template><LeftGutter @message={{this.message}} /></template>);- assert.dom(".chat-message-left-gutter__date").exists();- assert.dom(".chat-message-left-gutter__bookmark").exists();- });- }-);+ assert.dom(".chat-message-left-gutter__date").exists();+ assert.dom(".chat-message-left-gutter__bookmark").exists();+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs b/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjsindex dad3f9f9952..362d59227fe 100644--- a/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs@@ -4,7 +4,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatMessageReaction from "discourse/plugins/chat/discourse/components/chat-message-reaction";-module("Discourse Chat | Component | chat-message-reaction", function (hooks) {+module("Component | chat-message-reaction", function (hooks) {setupRenderingTest(hooks);test("adds reacted class when user reacted", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-message-test.gjs b/plugins/chat/test/javascripts/components/chat-message-test.gjsindex c668d10bfa6..fc9836eef82 100644--- a/plugins/chat/test/javascripts/components/chat-message-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-test.gjs@@ -6,7 +6,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatMessage from "discourse/plugins/chat/discourse/components/chat-message";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-message", function (hooks) {+module("Component | chat-message", function (hooks) {setupRenderingTest(hooks);test("Message with edits", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-message-text-test.gjs b/plugins/chat/test/javascripts/components/chat-message-text-test.gjsindex 7e152b849e4..43eb2d05c4b 100644--- a/plugins/chat/test/javascripts/components/chat-message-text-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-text-test.gjs@@ -3,7 +3,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatMessageText from "discourse/plugins/chat/discourse/components/chat-message-text";-module("Discourse Chat | Component | chat-message-text", function (hooks) {+module("Component | chat-message-text", function (hooks) {setupRenderingTest(hooks);test("yields", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjsindex 46e5920f68c..fa3efe23a0b 100644--- a/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs@@ -6,28 +6,22 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ArchiveChannel from "discourse/plugins/chat/discourse/components/chat/modal/archive-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | <Chat::Modal::ArchiveChannel>",- function (hooks) {- setupRenderingTest(hooks);+module("Component | <Chat::Modal::ArchiveChannel>", function (hooks) {+ setupRenderingTest(hooks);- test("channel title is escaped in instructions correctly", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel({- title: `<script>someeviltitle</script>`,- });+ test("channel title is escaped in instructions correctly", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel({+ title: `<script>someeviltitle</script>`,+ });- await render(- <template>- <ArchiveChannel- @inline={{true}}- @model={{hash channel=this.channel}}- />- </template>- );+ await render(+ <template>+ <ArchiveChannel @inline={{true}} @model={{hash channel=this.channel}} />+ </template>+ );- assert- .dom(".chat-modal-archive-channel")- .includesHtml("<script>someeviltitle</script>");- });- }-);+ assert+ .dom(".chat-modal-archive-channel")+ .includesHtml("<script>someeviltitle</script>");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjsindex 554008413ef..f75bd097bff 100644--- a/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs@@ -6,28 +6,22 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import DeleteChannel from "discourse/plugins/chat/discourse/components/chat/modal/delete-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | <Chat::Modal::DeleteChannel />",- function (hooks) {- setupRenderingTest(hooks);+module("Component | <Chat::Modal::DeleteChannel />", function (hooks) {+ setupRenderingTest(hooks);- test("channel title is escaped in instructions correctly", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel({- title: `<script>someeviltitle</script>`,- });+ test("channel title is escaped in instructions correctly", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel({+ title: `<script>someeviltitle</script>`,+ });- await render(- <template>- <DeleteChannel- @inline={{true}}- @model={{hash channel=this.channel}}- />- </template>- );+ await render(+ <template>+ <DeleteChannel @inline={{true}} @model={{hash channel=this.channel}} />+ </template>+ );- assert- .dom(".chat-modal-delete-channel__instructions")- .includesHtml("<script>someeviltitle</script>");- });- }-);+ assert+ .dom(".chat-modal-delete-channel__instructions")+ .includesHtml("<script>someeviltitle</script>");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjsindex fc721c8483a..19c04167036 100644--- a/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs@@ -6,32 +6,29 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import MoveMessageToChannel from "discourse/plugins/chat/discourse/components/chat/modal/move-message-to-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | <Chat::Modal::MoveMessageToChannel />",- function (hooks) {- setupRenderingTest(hooks);+module("Component | <Chat::Modal::MoveMessageToChannel />", function (hooks) {+ setupRenderingTest(hooks);- test("channel title is escaped in instructions correctly", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel({- title: "<script>someeviltitle</script>",- });- this.selectedMessageIds = [this.channel.id];+ test("channel title is escaped in instructions correctly", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel({+ title: "<script>someeviltitle</script>",+ });+ this.selectedMessageIds = [this.channel.id];- await render(- <template>- <MoveMessageToChannel- @inline={{true}}- @model={{hash- sourceChannel=this.channel- selectedMessageIds=this.selectedMessageIds- }}- />- </template>- );+ await render(+ <template>+ <MoveMessageToChannel+ @inline={{true}}+ @model={{hash+ sourceChannel=this.channel+ selectedMessageIds=this.selectedMessageIds+ }}+ />+ </template>+ );- assert- .dom(".chat-modal-move-message-to-channel")- .includesHtml("<script>someeviltitle</script>");- });- }-);+ assert+ .dom(".chat-modal-move-message-to-channel")+ .includesHtml("<script>someeviltitle</script>");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-notices-test.gjs b/plugins/chat/test/javascripts/components/chat-notices-test.gjsindex 2715215ec9e..b49ccaec951 100644--- a/plugins/chat/test/javascripts/components/chat-notices-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-notices-test.gjs@@ -8,7 +8,7 @@ import { i18n } from "discourse-i18n";import ChatNotices from "discourse/plugins/chat/discourse/components/chat-notices";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-notice", function (hooks) {+module("Component | chat-notice", function (hooks) {setupRenderingTest(hooks);test("displays all notices for a channel", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs b/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjsindex 673aef73a3f..fad3b0f73b9 100644--- a/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs@@ -23,162 +23,157 @@ async function removeUser(id, channelName = "/chat-reply/1") {});}-module(- "Discourse Chat | Component | chat-replying-indicator",- function (hooks) {- setupRenderingTest(hooks);-- test("not displayed when no one is replying", async function (assert) {- await render(- <template>- <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />- </template>- );-- assert.dom(".chat-replying-indicator__text").doesNotExist();- });-- test("working for thread", async function (assert) {- await render(- <template>- <ChatReplyingIndicator+module("Component | chat-replying-indicator", function (hooks) {+ setupRenderingTest(hooks);++ test("not displayed when no one is replying", async function (assert) {+ await render(+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>+ );++ assert.dom(".chat-replying-indicator__text").doesNotExist();+ });++ test("working for thread", async function (assert) {+ await render(+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1/thread/1" />+ </template>+ );++ await addUser(1, "sam", "/chat-reply/1/thread/1");++ assert.dom(".chat-replying-indicator__text").hasText("sam is typing");+ });++ test("doesn’t leak in other indicators", async function (assert) {+ await render(+ <template>+ <div class="channel"><ChatReplyingIndicator+ @presenceChannelName="/chat-reply/1"+ /></div>+ <div class="thread"><ChatReplyingIndicator@presenceChannelName="/chat-reply/1/thread/1"- />- </template>- );-- await addUser(1, "sam", "/chat-reply/1/thread/1");-- assert.dom(".chat-replying-indicator__text").hasText("sam is typing");- });-- test("doesn’t leak in other indicators", async function (assert) {- await render(- <template>- <div class="channel"><ChatReplyingIndicator- @presenceChannelName="/chat-reply/1"- /></div>- <div class="thread"><ChatReplyingIndicator- @presenceChannelName="/chat-reply/1/thread/1"- /></div>- </template>- );-- await addUser(1, "sam");-- assert- .dom(".channel .chat-replying-indicator__text")- .hasText("sam is typing");- assert.dom(".thread .chat-replying-indicator__text").doesNotExist();-- await addUser(2, "mark", "/chat-reply/1/thread/1");- await removeUser(1);-- assert.dom(".channel .chat-replying-indicator__text").doesNotExist();- assert- .dom(".thread .chat-replying-indicator__text")- .hasText("mark is typing");- });-- test("displays indicator when user is replying", async function (assert) {- await render(- <template>- <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />- </template>- );-- await addUser(1, "sam");-- assert.dom(".chat-replying-indicator__text").hasText("sam is typing");- });-- test("displays indicator when 2 or 3 users are replying", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel();-- await render(- <template>- <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />- </template>- );-- await addUser(1, "sam");- await addUser(2, "mark");-- assert- .dom(".chat-replying-indicator__text")- .hasText("sam and mark are typing");- });-- test("displays indicator when 3 users are replying", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel();-- await render(- <template>- <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />- </template>- );-- await addUser(1, "sam");- await addUser(2, "mark");- await addUser(3, "joffrey");-- assert- .dom(".chat-replying-indicator__text")- .hasText("sam, mark and joffrey are typing");- });-- test("displays indicator when more than 3 users are replying", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel();-- await render(- <template>- <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />- </template>- );-- await addUser(1, "sam");- await addUser(2, "mark");- await addUser(3, "joffrey");- await addUser(4, "taylor");-- assert- .dom(".chat-replying-indicator__text")- .hasText("sam, mark and 2 others are typing");- });-- test("filters current user from list of repliers", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel();-- await render(- <template>- <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />- </template>- );-- await addUser(1, "sam");- await addUser(this.currentUser.id, this.currentUser.username);-- assert.dom(".chat-replying-indicator__text").hasText("sam is typing");- });-- test("resets presence when channel changes", async function (assert) {- this.set("presenceChannelName", "/chat-reply/1");+ /></div>+ </template>+ );++ await addUser(1, "sam");++ assert+ .dom(".channel .chat-replying-indicator__text")+ .hasText("sam is typing");+ assert.dom(".thread .chat-replying-indicator__text").doesNotExist();++ await addUser(2, "mark", "/chat-reply/1/thread/1");+ await removeUser(1);++ assert.dom(".channel .chat-replying-indicator__text").doesNotExist();+ assert+ .dom(".thread .chat-replying-indicator__text")+ .hasText("mark is typing");+ });++ test("displays indicator when user is replying", async function (assert) {+ await render(+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>+ );++ await addUser(1, "sam");++ assert.dom(".chat-replying-indicator__text").hasText("sam is typing");+ });++ test("displays indicator when 2 or 3 users are replying", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel();++ await render(+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>+ );++ await addUser(1, "sam");+ await addUser(2, "mark");++ assert+ .dom(".chat-replying-indicator__text")+ .hasText("sam and mark are typing");+ });- await addUser(1, "sam");-- await render(- <template>- <ChatReplyingIndicator- @presenceChannelName={{this.presenceChannelName}}- />- </template>- );-- assert.dom(".chat-replying-indicator__text").hasText("sam is typing");-- this.set("presenceChannelName", "/chat-reply/2");-- assert.dom(".chat-replying-indicator__text").doesNotExist();- });- }-);+ test("displays indicator when 3 users are replying", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel();++ await render(+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>+ );++ await addUser(1, "sam");+ await addUser(2, "mark");+ await addUser(3, "joffrey");++ assert+ .dom(".chat-replying-indicator__text")+ .hasText("sam, mark and joffrey are typing");+ });++ test("displays indicator when more than 3 users are replying", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel();++ await render(+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>+ );++ await addUser(1, "sam");+ await addUser(2, "mark");+ await addUser(3, "joffrey");+ await addUser(4, "taylor");++ assert+ .dom(".chat-replying-indicator__text")+ .hasText("sam, mark and 2 others are typing");+ });++ test("filters current user from list of repliers", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel();++ await render(+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>+ );++ await addUser(1, "sam");+ await addUser(this.currentUser.id, this.currentUser.username);++ assert.dom(".chat-replying-indicator__text").hasText("sam is typing");+ });++ test("resets presence when channel changes", async function (assert) {+ this.set("presenceChannelName", "/chat-reply/1");++ await addUser(1, "sam");++ await render(+ <template>+ <ChatReplyingIndicator+ @presenceChannelName={{this.presenceChannelName}}+ />+ </template>+ );++ assert.dom(".chat-replying-indicator__text").hasText("sam is typing");++ this.set("presenceChannelName", "/chat-reply/2");++ assert.dom(".chat-replying-indicator__text").doesNotExist();+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs b/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjsindex 8e079703341..9c4df479ff4 100644--- a/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs@@ -5,41 +5,38 @@ import { i18n } from "discourse-i18n";import ChatRetentionReminder from "discourse/plugins/chat/discourse/components/chat-retention-reminder";import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";-module(- "Discourse Chat | Component | chat-retention-reminder",- function (hooks) {- setupRenderingTest(hooks);+module("Component | chat-retention-reminder", function (hooks) {+ setupRenderingTest(hooks);- test("display retention info", async function (assert) {- this.channel = ChatChannel.create({ chatable_type: "Category" });- this.currentUser.set("needs_channel_retention_reminder", true);+ test("display retention info", async function (assert) {+ this.channel = ChatChannel.create({ chatable_type: "Category" });+ this.currentUser.set("needs_channel_retention_reminder", true);- await render(- <template><ChatRetentionReminder @channel={{this.channel}} /></template>- );+ await render(+ <template><ChatRetentionReminder @channel={{this.channel}} /></template>+ );- assert- .dom(".chat-retention-reminder")- .includesText(- `retain channel messages for ${this.siteSettings.chat_channel_retention_days} days`- );- });+ assert+ .dom(".chat-retention-reminder")+ .includesText(+ `retain channel messages for ${this.siteSettings.chat_channel_retention_days} days`+ );+ });- test("@type=short", async function (assert) {- this.channel = ChatChannel.create({ chatable_type: "Category" });- this.currentUser.set("needs_channel_retention_reminder", true);+ test("@type=short", async function (assert) {+ this.channel = ChatChannel.create({ chatable_type: "Category" });+ this.currentUser.set("needs_channel_retention_reminder", true);- await render(- <template>- <ChatRetentionReminder @channel={{this.channel}} @type="short" />- </template>- );+ await render(+ <template>+ <ChatRetentionReminder @channel={{this.channel}} @type="short" />+ </template>+ );- assert.dom(".chat-retention-reminder").includesText(- i18n("chat.retention_reminders.short", {- count: this.siteSettings.chat_channel_retention_days,- })- );- });- }-);+ assert.dom(".chat-retention-reminder").includesText(+ i18n("chat.retention_reminders.short", {+ count: this.siteSettings.chat_channel_retention_days,+ })+ );+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjsindex 86cba8be750..08a6ecb5ae3 100644--- a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs@@ -6,114 +6,111 @@ import { i18n } from "discourse-i18n";import ChatRetentionReminderText from "discourse/plugins/chat/discourse/components/chat-retention-reminder-text";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | chat-retention-reminder-text",- function (hooks) {- setupRenderingTest(hooks);-- test("when setting is set on 0", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel();- this.siteSettings.chat_channel_retention_days = 0;-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-retention-reminder-text")- .includesText("retain channel messages indefinitely");-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} @type="short" />- </template>- );-- assert- .dom(".chat-retention-reminder-text")- .includesText(i18n("chat.retention_reminders.indefinitely_short"));- });-- test("when channel is a public channel", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).channel();- this.siteSettings.chat_channel_retention_days = 10;-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-retention-reminder-text")- .includesText("retain channel messages for 10 days");-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} @type="short" />- </template>- );-- assert- .dom(".chat-retention-reminder-text")- .includesText(i18n("chat.retention_reminders.short", { count: 10 }));- });-- test("when channel is a DM channel", async function (assert) {- this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();- this.siteSettings.chat_dm_retention_days = 10;-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-retention-reminder-text")- .includesText("retain channel messages for 10 days");-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} @type="short" />- </template>- );-- assert- .dom(".chat-retention-reminder-text")- .includesText(i18n("chat.retention_reminders.short", { count: 10 }));- });-- test("links to chat settings for admins", async function (assert) {- this.currentUser.admin = true;- this.channel = new ChatFabricators(getOwner(this)).channel();- this.siteSettings.chat_channel_retention_days = 0;-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} />- </template>- );-- assert- .dom(".chat-retention-reminder-text a")- .hasAttribute("href", "/admin/site_settings/category/chat");- });-- test("does not link to chat settings for non-admins", async function (assert) {- this.currentUser.admin = false;- this.channel = new ChatFabricators(getOwner(this)).channel();- this.siteSettings.chat_channel_retention_days = 0;-- await render(- <template>- <ChatRetentionReminderText @channel={{this.channel}} />- </template>- );-- assert.dom(".chat-retention-reminder-text a").doesNotExist();- });- }-);+module("Component | chat-retention-reminder-text", function (hooks) {+ setupRenderingTest(hooks);++ test("when setting is set on 0", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel();+ this.siteSettings.chat_channel_retention_days = 0;++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} />+ </template>+ );++ assert+ .dom(".chat-retention-reminder-text")+ .includesText("retain channel messages indefinitely");++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} @type="short" />+ </template>+ );++ assert+ .dom(".chat-retention-reminder-text")+ .includesText(i18n("chat.retention_reminders.indefinitely_short"));+ });++ test("when channel is a public channel", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).channel();+ this.siteSettings.chat_channel_retention_days = 10;++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} />+ </template>+ );++ assert+ .dom(".chat-retention-reminder-text")+ .includesText("retain channel messages for 10 days");++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} @type="short" />+ </template>+ );++ assert+ .dom(".chat-retention-reminder-text")+ .includesText(i18n("chat.retention_reminders.short", { count: 10 }));+ });++ test("when channel is a DM channel", async function (assert) {+ this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();+ this.siteSettings.chat_dm_retention_days = 10;++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} />+ </template>+ );++ assert+ .dom(".chat-retention-reminder-text")+ .includesText("retain channel messages for 10 days");++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} @type="short" />+ </template>+ );++ assert+ .dom(".chat-retention-reminder-text")+ .includesText(i18n("chat.retention_reminders.short", { count: 10 }));+ });++ test("links to chat settings for admins", async function (assert) {+ this.currentUser.admin = true;+ this.channel = new ChatFabricators(getOwner(this)).channel();+ this.siteSettings.chat_channel_retention_days = 0;++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} />+ </template>+ );++ assert+ .dom(".chat-retention-reminder-text a")+ .hasAttribute("href", "/admin/site_settings/category/chat");+ });++ test("does not link to chat settings for non-admins", async function (assert) {+ this.currentUser.admin = false;+ this.channel = new ChatFabricators(getOwner(this)).channel();+ this.siteSettings.chat_channel_retention_days = 0;++ await render(+ <template>+ <ChatRetentionReminderText @channel={{this.channel}} />+ </template>+ );++ assert.dom(".chat-retention-reminder-text a").doesNotExist();+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-sidebar-indicators-test.gjs b/plugins/chat/test/javascripts/components/chat-sidebar-indicators-test.gjsindex 3df7f809a3f..c39d7c277fb 100644--- a/plugins/chat/test/javascripts/components/chat-sidebar-indicators-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-sidebar-indicators-test.gjs@@ -3,109 +3,106 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatSidebarIndicators from "discourse/plugins/chat/discourse/components/chat-sidebar-indicators";-module(- "Discourse Chat | Component | chat-sidebar-indicators",- function (hooks) {- setupRenderingTest(hooks);-- test("shows indicator when unreadCount > 0", async function (assert) {- const status = { unreadCount: 1 };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").exists();- });-- test("shows indicator when unreadThreadsCount > 0", async function (assert) {- const status = { unreadThreadsCount: 1 };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").exists();- });-- test("shows indicator when mentionCount > 0", async function (assert) {- const status = { mentionCount: 1 };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").exists();- assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");- });-- test("shows indicator when watchedThreadsUnreadCount > 0", async function (assert) {- const status = { watchedThreadsUnreadCount: 1 };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").exists();- assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");- });-- test("does not show indicator when all counts are 0", async function (assert) {- const status = {- unreadCount: 0,- unreadThreadsCount: 0,- mentionCount: 0,- watchedThreadsUnreadCount: 0,- };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").doesNotExist();- });-- test("shows urgent class for DM with unread messages", async function (assert) {- const status = {- unreadCount: 1,- isDirectMessageChannel: true,- };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");- });-- test("shows unread class for public channel with unread messages", async function (assert) {- const status = {- unreadCount: 1,- isDirectMessageChannel: false,- };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").hasClass("unread");- });-- test("shows urgent class when watchedThreadsUnreadCount > 0 even without other unreads", async function (assert) {- const status = {- unreadCount: 0,- unreadThreadsCount: 0,- mentionCount: 0,- watchedThreadsUnreadCount: 1,- isDirectMessageChannel: false,- };-- await render(- <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>- );-- assert.dom(".sidebar-section-link-content-badge").exists();- assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");- });- }-);+module("Component | chat-sidebar-indicators", function (hooks) {+ setupRenderingTest(hooks);++ test("shows indicator when unreadCount > 0", async function (assert) {+ const status = { unreadCount: 1 };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").exists();+ });++ test("shows indicator when unreadThreadsCount > 0", async function (assert) {+ const status = { unreadThreadsCount: 1 };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").exists();+ });++ test("shows indicator when mentionCount > 0", async function (assert) {+ const status = { mentionCount: 1 };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").exists();+ assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");+ });++ test("shows indicator when watchedThreadsUnreadCount > 0", async function (assert) {+ const status = { watchedThreadsUnreadCount: 1 };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").exists();+ assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");+ });++ test("does not show indicator when all counts are 0", async function (assert) {+ const status = {+ unreadCount: 0,+ unreadThreadsCount: 0,+ mentionCount: 0,+ watchedThreadsUnreadCount: 0,+ };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").doesNotExist();+ });++ test("shows urgent class for DM with unread messages", async function (assert) {+ const status = {+ unreadCount: 1,+ isDirectMessageChannel: true,+ };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");+ });++ test("shows unread class for public channel with unread messages", async function (assert) {+ const status = {+ unreadCount: 1,+ isDirectMessageChannel: false,+ };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").hasClass("unread");+ });++ test("shows urgent class when watchedThreadsUnreadCount > 0 even without other unreads", async function (assert) {+ const status = {+ unreadCount: 0,+ unreadThreadsCount: 0,+ mentionCount: 0,+ watchedThreadsUnreadCount: 1,+ isDirectMessageChannel: false,+ };++ await render(+ <template><ChatSidebarIndicators @suffixArgs={{status}} /></template>+ );++ assert.dom(".sidebar-section-link-content-badge").exists();+ assert.dom(".sidebar-section-link-content-badge").hasClass("urgent");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-header-test.gjsindex 48fdcd8ffae..fea6354ca68 100644--- a/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs@@ -5,7 +5,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import Header from "discourse/plugins/chat/discourse/components/chat/thread/header";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-thread-header", function (hooks) {+module("Component | chat-thread-header", function (hooks) {setupRenderingTest(hooks);test("it safely renders title", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjsindex 325f9c21620..fb81a8fd246 100644--- a/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs@@ -5,7 +5,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatThreadHeading from "discourse/plugins/chat/discourse/components/chat-thread-heading";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-thread-heading", function (hooks) {+module("Component | chat-thread-heading", function (hooks) {setupRenderingTest(hooks);test("it renders the title", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjsindex 269307e47fe..1026dd810ed 100644--- a/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs@@ -5,7 +5,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import Item from "discourse/plugins/chat/discourse/components/chat/thread-list/item";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | chat-thread-list-item", function (hooks) {+module("Component | chat-thread-list-item", function (hooks) {setupRenderingTest(hooks);test("it safely renders title", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjsindex d063a6b7b58..8cc2def97fa 100644--- a/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs@@ -6,72 +6,69 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatThreadParticipants from "discourse/plugins/chat/discourse/components/chat-thread-participants";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Component | <ChatThreadParticipants />",- function (hooks) {- setupRenderingTest(hooks);+module("Component | <ChatThreadParticipants />", function (hooks) {+ setupRenderingTest(hooks);- test("no participants", async function (assert) {- this.thread = new ChatFabricators(getOwner(this)).thread();- await render(- <template><ChatThreadParticipants @thread={{this.thread}} /></template>- );+ test("no participants", async function (assert) {+ this.thread = new ChatFabricators(getOwner(this)).thread();+ await render(+ <template><ChatThreadParticipants @thread={{this.thread}} /></template>+ );- assert.dom(".chat-thread-participants").doesNotExist();+ assert.dom(".chat-thread-participants").doesNotExist();+ });++ test("@includeOriginalMessageUser=true", async function (assert) {+ const originalMessageUser = new CoreFabricators(getOwner(this)).user({+ username: "bob",+ });+ this.thread = new ChatFabricators(getOwner(this)).thread({+ original_message: new ChatFabricators(getOwner(this)).message({+ user: originalMessageUser,+ }),+ preview: new ChatFabricators(getOwner(this)).threadPreview({+ channel: this.channel,+ participant_users: [+ originalMessageUser,+ new CoreFabricators(getOwner(this)).user({ username: "alice" }),+ ],+ }),});- test("@includeOriginalMessageUser=true", async function (assert) {- const originalMessageUser = new CoreFabricators(getOwner(this)).user({- username: "bob",- });- this.thread = new ChatFabricators(getOwner(this)).thread({- original_message: new ChatFabricators(getOwner(this)).message({- user: originalMessageUser,- }),- preview: new ChatFabricators(getOwner(this)).threadPreview({- channel: this.channel,- participant_users: [- originalMessageUser,- new CoreFabricators(getOwner(this)).user({ username: "alice" }),- ],- }),- });+ await render(+ <template><ChatThreadParticipants @thread={{this.thread}} /></template>+ );- await render(- <template><ChatThreadParticipants @thread={{this.thread}} /></template>- );+ assert.dom(".chat-user-avatar[data-username]").exists({ count: 2 });+ });- assert.dom(".chat-user-avatar[data-username]").exists({ count: 2 });+ test("@includeOriginalMessageUser=false", async function (assert) {+ const originalMessageUser = new CoreFabricators(getOwner(this)).user({+ username: "bob",+ });+ this.thread = new ChatFabricators(getOwner(this)).thread({+ original_message: new ChatFabricators(getOwner(this)).message({+ user: originalMessageUser,+ }),+ preview: new ChatFabricators(getOwner(this)).threadPreview({+ channel: this.channel,+ participant_users: [+ originalMessageUser,+ new CoreFabricators(getOwner(this)).user({ username: "alice" }),+ ],+ }),});- test("@includeOriginalMessageUser=false", async function (assert) {- const originalMessageUser = new CoreFabricators(getOwner(this)).user({- username: "bob",- });- this.thread = new ChatFabricators(getOwner(this)).thread({- original_message: new ChatFabricators(getOwner(this)).message({- user: originalMessageUser,- }),- preview: new ChatFabricators(getOwner(this)).threadPreview({- channel: this.channel,- participant_users: [- originalMessageUser,- new CoreFabricators(getOwner(this)).user({ username: "alice" }),- ],- }),- });-- await render(- <template>- <ChatThreadParticipants- @thread={{this.thread}}- @includeOriginalMessageUser={{false}}- />- </template>- );+ await render(+ <template>+ <ChatThreadParticipants+ @thread={{this.thread}}+ @includeOriginalMessageUser={{false}}+ />+ </template>+ );- assert.dom('.chat-user-avatar[data-username="bob"]').doesNotExist();- assert.dom('.chat-user-avatar[data-username="alice"]').exists();- });- }-);+ assert.dom('.chat-user-avatar[data-username="bob"]').doesNotExist();+ assert.dom('.chat-user-avatar[data-username="alice"]').exists();+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-upload-test.gjs b/plugins/chat/test/javascripts/components/chat-upload-test.gjsindex 99d676557c9..712cc262725 100644--- a/plugins/chat/test/javascripts/components/chat-upload-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-upload-test.gjs@@ -66,7 +66,7 @@ const TXT_FIXTURE = {human_filesize: "168 KB",};-module("Discourse Chat | Component | chat-upload", function (hooks) {+module("Component | chat-upload", function (hooks) {setupRenderingTest(hooks);test("with an image", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjsindex 50849b99810..f3814ee1b74 100644--- a/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs@@ -14,7 +14,7 @@ function containerSelector(user, options = {}) {return `.chat-user-avatar${onlineSelector} .chat-user-avatar__container[data-user-card=${user.username}] .avatar[title=${user.username}]`;}-module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {+module("Component | <ChatUserAvatar />", function (hooks) {setupRenderingTest(hooks);test("when user is not online", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs b/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjsindex 32de4257e88..dca12e9a831 100644--- a/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs@@ -6,41 +6,38 @@ import CoreFabricators from "discourse/lib/fabricators";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import DirectMessageButton from "discourse/plugins/chat/discourse/components/chat/direct-message-button";-module(- "Discourse Chat | Component | <Chat::DirectMessageButton />",- function (hooks) {- setupRenderingTest(hooks);+module("Component | <Chat::DirectMessageButton />", function (hooks) {+ setupRenderingTest(hooks);- test("when current user can send direct messages", async function (assert) {- sinon- .stub(this.owner.lookup("service:chat"), "userCanDirectMessage")- .value(true);- this.user = new CoreFabricators(getOwner(this)).user();+ test("when current user can send direct messages", async function (assert) {+ sinon+ .stub(this.owner.lookup("service:chat"), "userCanDirectMessage")+ .value(true);+ this.user = new CoreFabricators(getOwner(this)).user();- await render(- <template>- <DirectMessageButton @user={{this.user}} @modal={{true}} />- </template>- );+ await render(+ <template>+ <DirectMessageButton @user={{this.user}} @modal={{true}} />+ </template>+ );- assert.dom(".chat-direct-message-btn").exists("it shows the chat button");- });+ assert.dom(".chat-direct-message-btn").exists("it shows the chat button");+ });- test("when current user can’t send direct messages", async function (assert) {- sinon- .stub(this.owner.lookup("service:chat"), "userCanDirectMessage")- .value(false);- this.user = new CoreFabricators(getOwner(this)).user();+ test("when current user can’t send direct messages", async function (assert) {+ sinon+ .stub(this.owner.lookup("service:chat"), "userCanDirectMessage")+ .value(false);+ this.user = new CoreFabricators(getOwner(this)).user();- await render(- <template>- <DirectMessageButton @user={{this.user}} @modal={{true}} />- </template>- );+ await render(+ <template>+ <DirectMessageButton @user={{this.user}} @modal={{true}} />+ </template>+ );- assert- .dom(".chat-direct-message-btn")- .doesNotExist("it doesn’t show the chat button");- });- }-);+ assert+ .dom(".chat-direct-message-btn")+ .doesNotExist("it doesn’t show the chat button");+ });+});diff --git a/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs b/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjsindex a1f3adae5b3..47d55ba2553 100644--- a/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs@@ -4,7 +4,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatUserDisplayName from "discourse/plugins/chat/discourse/components/chat-user-display-name";module(- "Discourse Chat | Component | chat-user-display-name | prioritize username in UX",+ "Component | chat-user-display-name | prioritize username in UX",function (hooks) {setupRenderingTest(hooks);@@ -33,7 +33,7 @@ module();module(- "Discourse Chat | Component | chat-user-display-name | prioritize name in UX",+ "Component | chat-user-display-name | prioritize name in UX",function (hooks) {setupRenderingTest(hooks);diff --git a/plugins/chat/test/javascripts/components/chat-user-info-test.gjs b/plugins/chat/test/javascripts/components/chat-user-info-test.gjsindex dda8b1d7bdb..683a06c51df 100644--- a/plugins/chat/test/javascripts/components/chat-user-info-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-info-test.gjs@@ -3,7 +3,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatUserInfo from "discourse/plugins/chat/discourse/components/chat-user-info";-module("Discourse Chat | Component | chat-user-info", function (hooks) {+module("Component | chat-user-info", function (hooks) {setupRenderingTest(hooks);test("avatar and name", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/collapser-test.gjs b/plugins/chat/test/javascripts/components/collapser-test.gjsindex 1449a1e3c87..7d39116d64e 100644--- a/plugins/chat/test/javascripts/components/collapser-test.gjs+++ b/plugins/chat/test/javascripts/components/collapser-test.gjs@@ -4,7 +4,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import Collapser from "discourse/plugins/chat/discourse/components/collapser";-module("Discourse Chat | Component | collapser", function (hooks) {+module("Component | collapser", function (hooks) {setupRenderingTest(hooks);test("renders header", async function (assert) {diff --git a/plugins/chat/test/javascripts/components/thread-settings-test.gjs b/plugins/chat/test/javascripts/components/thread-settings-test.gjsindex b921b0252fb..505e24759e9 100644--- a/plugins/chat/test/javascripts/components/thread-settings-test.gjs+++ b/plugins/chat/test/javascripts/components/thread-settings-test.gjs@@ -5,7 +5,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import ChatModalThreadSettings from "discourse/plugins/chat/discourse/components/chat/modal/thread-settings";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Component | <ThreadSettings />", function (hooks) {+module("Component | <ThreadSettings />", function (hooks) {setupRenderingTest(hooks);test("discourse-ai - admin", async function (assert) {diff --git a/plugins/chat/test/javascripts/unit/components/chat-presence-behavior-test.gjs b/plugins/chat/test/javascripts/unit/components/chat-presence-behavior-test.gjsindex a6b98cf7096..702599135bd 100644--- a/plugins/chat/test/javascripts/unit/components/chat-presence-behavior-test.gjs+++ b/plugins/chat/test/javascripts/unit/components/chat-presence-behavior-test.gjs@@ -24,295 +24,289 @@ function setScrollerHeight(scroller, { clientHeight, scrollHeight }) {});}-module(- "Discourse Chat | Unit | Components | presence gating",- function (hooks) {- setupRenderingTest(hooks);-- hooks.beforeEach(function () {- this.fabricators = new ChatFabricators(getOwner(this));- setTestPresence(false);-- pretender.get(`/chat/api/channels/1/messages`, () =>- response({- messages: [],- meta: {- can_delete_self: true,- can_load_more_future: false,- can_load_more_past: false,- },- })- );- pretender.get(`/chat/api/me/channels`, () =>- response({- direct_message_channels: [],- public_channels: [],- })- );- pretender.get(`/chat/api/channels/1/threads/1/messages`, () =>- response({- messages: [],- meta: {- can_load_more_future: false,- can_load_more_past: false,- },- })- );+module("Unit | Components | presence gating", function (hooks) {+ setupRenderingTest(hooks);++ hooks.beforeEach(function () {+ this.fabricators = new ChatFabricators(getOwner(this));+ setTestPresence(false);++ pretender.get(`/chat/api/channels/1/messages`, () =>+ response({+ messages: [],+ meta: {+ can_delete_self: true,+ can_load_more_future: false,+ can_load_more_past: false,+ },+ })+ );+ pretender.get(`/chat/api/me/channels`, () =>+ response({+ direct_message_channels: [],+ public_channels: [],+ })+ );+ pretender.get(`/chat/api/channels/1/threads/1/messages`, () =>+ response({+ messages: [],+ meta: {+ can_load_more_future: false,+ can_load_more_past: false,+ },+ })+ );+ });++ hooks.afterEach(function () {+ setTestPresence(true);+ clearPresenceCallbacks();+ sinon.restore();+ });++ test("does not show arrow when user not present but pane cannot scroll", async function (assert) {+ const channel = this.fabricators.channel({+ id: 1,+ currentUserMembership: { following: true, last_read_message_id: 1 },});- hooks.afterEach(function () {- setTestPresence(true);- clearPresenceCallbacks();- sinon.restore();+ const readUpdateStub = sinon.stub(+ ChatChannel.prototype,+ "debouncedUpdateLastReadMessage"+ );++ this.channel = channel;+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {+ clientHeight: 500,+ scrollHeight: 500,});- test("does not show arrow when user not present but pane cannot scroll", async function (assert) {- const channel = this.fabricators.channel({- id: 1,- currentUserMembership: { following: true, last_read_message_id: 1 },- });-- const readUpdateStub = sinon.stub(- ChatChannel.prototype,- "debouncedUpdateLastReadMessage"- );-- this.channel = channel;- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {- clientHeight: 500,- scrollHeight: 500,- });-- const addMessagesStub = sinon.stub(- channel.messagesManager,- "addMessages"- );- readUpdateStub.resetHistory();-- publishToMessageBus(`/chat/1`, {- type: "sent",- chat_message: {- id: 999,- message: "hello",- cooked: "<p>hello</p>",- excerpt: "hello",- created_at: "2025-01-01T00:00:00.000Z",- user: { id: 1, username: "eviltrout" },- },- });- await settled();-- assert.true(addMessagesStub.calledOnce, "appends messages");- assert.false(readUpdateStub.called, "does not schedule read update");- assert- .dom(".chat-scroll-to-bottom__button.visible")- .doesNotExist("does not show scroll-to-bottom arrow");+ const addMessagesStub = sinon.stub(channel.messagesManager, "addMessages");+ readUpdateStub.resetHistory();++ publishToMessageBus(`/chat/1`, {+ type: "sent",+ chat_message: {+ id: 999,+ message: "hello",+ cooked: "<p>hello</p>",+ excerpt: "hello",+ created_at: "2025-01-01T00:00:00.000Z",+ user: { id: 1, username: "eviltrout" },+ },});+ await settled();- test("shows arrow when user not present and pane can scroll", async function (assert) {- const channel = this.fabricators.channel({- id: 1,- currentUserMembership: { following: true, last_read_message_id: 1 },- });-- this.channel = channel;- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {- clientHeight: 100,- scrollHeight: 500,- });-- publishToMessageBus(`/chat/1`, {- type: "sent",- chat_message: {- id: 999,- message: "hello",- cooked: "<p>hello</p>",- excerpt: "hello",- created_at: "2025-01-01T00:00:00.000Z",- user: { id: 1, username: "eviltrout" },- },- });- await settled();+ assert.true(addMessagesStub.calledOnce, "appends messages");+ assert.false(readUpdateStub.called, "does not schedule read update");+ assert+ .dom(".chat-scroll-to-bottom__button.visible")+ .doesNotExist("does not show scroll-to-bottom arrow");+ });- assert- .dom(".chat-scroll-to-bottom__button.visible")- .exists("shows scroll-to-bottom arrow");+ test("shows arrow when user not present and pane can scroll", async function (assert) {+ const channel = this.fabricators.channel({+ id: 1,+ currentUserMembership: { following: true, last_read_message_id: 1 },});- test("pending manager tracks messages across contexts", async function (assert) {- const channel = this.fabricators.channel({- id: 1,- currentUserMembership: { following: true, last_read_message_id: 1 },- });-- this.channel = channel;- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- const pendingManager = getOwner(this).lookup(- "service:chat-pane-pending-manager"- );- assert.strictEqual(- pendingManager.totalPendingMessageCount,- 0,- "starts at zero"- );-- publishToMessageBus(`/chat/1`, {- type: "sent",- chat_message: {- id: 999,- message: "hello",- cooked: "<p>hello</p>",- excerpt: "hello",- created_at: "2025-01-01T00:00:00.000Z",- user: { id: 1, username: "eviltrout" },- },- });- await settled();-- assert.strictEqual(- pendingManager.totalPendingMessageCount,- 1,- "increments on new message"- );+ this.channel = channel;+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {+ clientHeight: 100,+ scrollHeight: 500,});- test("clears pending state when scrolling to bottom", async function (assert) {- const channel = this.fabricators.channel({- id: 1,- currentUserMembership: { following: true, last_read_message_id: 1 },- });-- this.channel = channel;- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {- clientHeight: 100,- scrollHeight: 500,- });-- const pendingManager = getOwner(this).lookup(- "service:chat-pane-pending-manager"- );-- publishToMessageBus(`/chat/1`, {- type: "sent",- chat_message: {- id: 999,- message: "hello",- cooked: "<p>hello</p>",- excerpt: "hello",- created_at: "2025-01-01T00:00:00.000Z",- user: { id: 1, username: "eviltrout" },- },- });- await settled();-- assert.strictEqual(- pendingManager.totalPendingMessageCount,- 1,- "has pending message"- );-- await click(".chat-scroll-to-bottom__button");-- assert.strictEqual(- pendingManager.totalPendingMessageCount,- 0,- "clears pending on scroll to bottom"- );- assert- .dom(".chat-scroll-to-bottom__button.visible")- .doesNotExist("hides arrow after scroll");+ publishToMessageBus(`/chat/1`, {+ type: "sent",+ chat_message: {+ id: 999,+ message: "hello",+ cooked: "<p>hello</p>",+ excerpt: "hello",+ created_at: "2025-01-01T00:00:00.000Z",+ user: { id: 1, username: "eviltrout" },+ },});+ await settled();- test("pending count contributes to document title", async function (assert) {- const channel = this.fabricators.channel({- id: 1,- currentUserMembership: { following: true, last_read_message_id: 1 },- });-- this.channel = channel;- await render(- <template><ChatChannel @channel={{this.channel}} /></template>- );-- const chatService = getOwner(this).lookup("service:chat");- const initialCount = chatService.getDocumentTitleCount();-- publishToMessageBus(`/chat/1`, {- type: "sent",- chat_message: {- id: 999,- message: "hello",- cooked: "<p>hello</p>",- excerpt: "hello",- created_at: "2025-01-01T00:00:00.000Z",- user: { id: 1, username: "eviltrout" },- },- });- await settled();-- assert.strictEqual(- chatService.getDocumentTitleCount(),- initialCount + 1,- "pending message increments document title count"- );+ assert+ .dom(".chat-scroll-to-bottom__button.visible")+ .exists("shows scroll-to-bottom arrow");+ });++ test("pending manager tracks messages across contexts", async function (assert) {+ const channel = this.fabricators.channel({+ id: 1,+ currentUserMembership: { following: true, last_read_message_id: 1 },});- test("thread enqueues messages when user not present", async function (assert) {- const thread = this.fabricators.thread({- id: 1,- channel: this.fabricators.channel({ id: 1 }),- currentUserMembership: { last_read_message_id: 1 },- });-- const readUpdateStub = sinon.stub(- ChatThread.prototype,- "debouncedUpdateLastReadMessage"- );-- this.thread = thread;- await render(<template><ChatThread @thread={{this.thread}} /></template>);-- setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {- clientHeight: 100,- scrollHeight: 500,- });-- const addMessagesStub = sinon.stub(thread.messagesManager, "addMessages");- readUpdateStub.resetHistory();-- publishToMessageBus(`/chat/1/thread/1`, {- type: "sent",- chat_message: {- id: 1001,- message: "thread hello",- cooked: "<p>thread hello</p>",- excerpt: "thread hello",- created_at: "2025-01-01T00:00:00.000Z",- user: { id: 1, username: "eviltrout" },- },- });- await settled();-- assert.true(addMessagesStub.calledOnce, "appends messages");- assert.false(readUpdateStub.called, "does not schedule read update");- assert- .dom(".chat-scroll-to-bottom__button.visible")- .exists("shows scroll-to-bottom arrow");+ this.channel = channel;+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ const pendingManager = getOwner(this).lookup(+ "service:chat-pane-pending-manager"+ );+ assert.strictEqual(+ pendingManager.totalPendingMessageCount,+ 0,+ "starts at zero"+ );++ publishToMessageBus(`/chat/1`, {+ type: "sent",+ chat_message: {+ id: 999,+ message: "hello",+ cooked: "<p>hello</p>",+ excerpt: "hello",+ created_at: "2025-01-01T00:00:00.000Z",+ user: { id: 1, username: "eviltrout" },+ },+ });+ await settled();++ assert.strictEqual(+ pendingManager.totalPendingMessageCount,+ 1,+ "increments on new message"+ );+ });++ test("clears pending state when scrolling to bottom", async function (assert) {+ const channel = this.fabricators.channel({+ id: 1,+ currentUserMembership: { following: true, last_read_message_id: 1 },});- }-);++ this.channel = channel;+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {+ clientHeight: 100,+ scrollHeight: 500,+ });++ const pendingManager = getOwner(this).lookup(+ "service:chat-pane-pending-manager"+ );++ publishToMessageBus(`/chat/1`, {+ type: "sent",+ chat_message: {+ id: 999,+ message: "hello",+ cooked: "<p>hello</p>",+ excerpt: "hello",+ created_at: "2025-01-01T00:00:00.000Z",+ user: { id: 1, username: "eviltrout" },+ },+ });+ await settled();++ assert.strictEqual(+ pendingManager.totalPendingMessageCount,+ 1,+ "has pending message"+ );++ await click(".chat-scroll-to-bottom__button");++ assert.strictEqual(+ pendingManager.totalPendingMessageCount,+ 0,+ "clears pending on scroll to bottom"+ );+ assert+ .dom(".chat-scroll-to-bottom__button.visible")+ .doesNotExist("hides arrow after scroll");+ });++ test("pending count contributes to document title", async function (assert) {+ const channel = this.fabricators.channel({+ id: 1,+ currentUserMembership: { following: true, last_read_message_id: 1 },+ });++ this.channel = channel;+ await render(+ <template><ChatChannel @channel={{this.channel}} /></template>+ );++ const chatService = getOwner(this).lookup("service:chat");+ const initialCount = chatService.getDocumentTitleCount();++ publishToMessageBus(`/chat/1`, {+ type: "sent",+ chat_message: {+ id: 999,+ message: "hello",+ cooked: "<p>hello</p>",+ excerpt: "hello",+ created_at: "2025-01-01T00:00:00.000Z",+ user: { id: 1, username: "eviltrout" },+ },+ });+ await settled();++ assert.strictEqual(+ chatService.getDocumentTitleCount(),+ initialCount + 1,+ "pending message increments document title count"+ );+ });++ test("thread enqueues messages when user not present", async function (assert) {+ const thread = this.fabricators.thread({+ id: 1,+ channel: this.fabricators.channel({ id: 1 }),+ currentUserMembership: { last_read_message_id: 1 },+ });++ const readUpdateStub = sinon.stub(+ ChatThread.prototype,+ "debouncedUpdateLastReadMessage"+ );++ this.thread = thread;+ await render(<template><ChatThread @thread={{this.thread}} /></template>);++ setScrollerHeight(this.element.querySelector(".chat-messages-scroller"), {+ clientHeight: 100,+ scrollHeight: 500,+ });++ const addMessagesStub = sinon.stub(thread.messagesManager, "addMessages");+ readUpdateStub.resetHistory();++ publishToMessageBus(`/chat/1/thread/1`, {+ type: "sent",+ chat_message: {+ id: 1001,+ message: "thread hello",+ cooked: "<p>thread hello</p>",+ excerpt: "thread hello",+ created_at: "2025-01-01T00:00:00.000Z",+ user: { id: 1, username: "eviltrout" },+ },+ });+ await settled();++ assert.true(addMessagesStub.calledOnce, "appends messages");+ assert.false(readUpdateStub.called, "does not schedule read update");+ assert+ .dom(".chat-scroll-to-bottom__button.visible")+ .exists("shows scroll-to-bottom arrow");+ });+});diff --git a/plugins/chat/test/javascripts/unit/lib/chat-audio-test.js b/plugins/chat/test/javascripts/unit/lib/chat-audio-test.jsindex ab3c7d3a655..f6fdf717e01 100644--- a/plugins/chat/test/javascripts/unit/lib/chat-audio-test.js+++ b/plugins/chat/test/javascripts/unit/lib/chat-audio-test.js@@ -5,7 +5,7 @@ import { withPluginApi } from "discourse/lib/plugin-api";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import chatAudioInitializer from "discourse/plugins/chat/discourse/initializers/chat-audio";-module("Discourse Chat | Unit | chat-audio", function (hooks) {+module("Unit | chat-audio", function (hooks) {setupRenderingTest(hooks);hooks.beforeEach(function () {diff --git a/plugins/chat/test/javascripts/unit/lib/chat-composer-buttons-test.js b/plugins/chat/test/javascripts/unit/lib/chat-composer-buttons-test.jsindex 8b008cc4b17..5817de7b118 100644--- a/plugins/chat/test/javascripts/unit/lib/chat-composer-buttons-test.js+++ b/plugins/chat/test/javascripts/unit/lib/chat-composer-buttons-test.js@@ -6,7 +6,7 @@ import {registerChatComposerButton,} from "discourse/plugins/chat/discourse/lib/chat-composer-buttons";-module("Discourse Chat | Unit | chat-composer-buttons", function (hooks) {+module("Unit | chat-composer-buttons", function (hooks) {hooks.beforeEach(function () {registerChatComposerButton({id: "foo",diff --git a/plugins/chat/test/javascripts/unit/lib/chat-message-interactor-test.js b/plugins/chat/test/javascripts/unit/lib/chat-message-interactor-test.jsindex ea4e6d3c3f1..1cc0d30be65 100644--- a/plugins/chat/test/javascripts/unit/lib/chat-message-interactor-test.js+++ b/plugins/chat/test/javascripts/unit/lib/chat-message-interactor-test.js@@ -8,7 +8,7 @@ import {import ChatMessageInteractor from "discourse/plugins/chat/discourse/lib/chat-message-interactor";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Unit | chat-message-interactor", function (hooks) {+module("Unit | chat-message-interactor", function (hooks) {setupTest(hooks);hooks.beforeEach(function () {diff --git a/plugins/chat/test/javascripts/unit/lib/chat-subscription-manager-test.js b/plugins/chat/test/javascripts/unit/lib/chat-subscription-manager-test.jsindex 45b5d36ab05..ab3ced81f40 100644--- a/plugins/chat/test/javascripts/unit/lib/chat-subscription-manager-test.js+++ b/plugins/chat/test/javascripts/unit/lib/chat-subscription-manager-test.js@@ -6,175 +6,172 @@ import ChatChannelSubscriptionManager from "discourse/plugins/chat/discourse/libimport ChatChannelThreadSubscriptionManager from "discourse/plugins/chat/discourse/lib/chat-channel-thread-subscription-manager";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Unit | Lib | chat subscription managers",- function (hooks) {- setupTest(hooks);-- hooks.beforeEach(function () {- const owner = getOwner(this);-- this.fabricators = new ChatFabricators(owner);-- const messageBus = owner.lookup("service:message-bus");- sinon.stub(messageBus, "subscribe");- sinon.stub(messageBus, "unsubscribe");+module("Unit | Lib | chat subscription managers", function (hooks) {+ setupTest(hooks);++ hooks.beforeEach(function () {+ const owner = getOwner(this);++ this.fabricators = new ChatFabricators(owner);++ const messageBus = owner.lookup("service:message-bus");+ sinon.stub(messageBus, "subscribe");+ sinon.stub(messageBus, "unsubscribe");+ });++ hooks.afterEach(function () {+ sinon.restore();+ });++ test("channel manager syncs uploads when matching staged message is sent", function (assert) {+ const channel = this.fabricators.channel({ id: 11 });+ const manager = new ChatChannelSubscriptionManager(this, channel);+ manager.currentUser = { id: 1 };++ const stagedMessage = this.fabricators.message({+ id: "staged-1",+ channel,+ staged: true,+ processed: false,+ message: "",+ cooked: "",+ user: { id: 1, username: "current_user" },+ uploads: [{ id: 1, url: "/uploads/local.png", width: 16, height: 16 }],});+ channel.messagesManager.addMessages([stagedMessage]);- hooks.afterEach(function () {- sinon.restore();+ manager.handleSentMessage({+ type: "sent",+ staged_id: "staged-1",+ chat_message: buildChatMessagePayload({+ id: 99,+ uploads: [+ {+ id: 1,+ url: "/uploads/server.png",+ short_path: "/uploads/short-url/server",+ width: 300,+ height: 200,+ },+ ],+ }),});- test("channel manager syncs uploads when matching staged message is sent", function (assert) {- const channel = this.fabricators.channel({ id: 11 });- const manager = new ChatChannelSubscriptionManager(this, channel);- manager.currentUser = { id: 1 };-- const stagedMessage = this.fabricators.message({- id: "staged-1",- channel,- staged: true,- processed: false,- message: "",- cooked: "",- user: { id: 1, username: "current_user" },- uploads: [{ id: 1, url: "/uploads/local.png", width: 16, height: 16 }],- });- channel.messagesManager.addMessages([stagedMessage]);-- manager.handleSentMessage({- type: "sent",- staged_id: "staged-1",- chat_message: buildChatMessagePayload({- id: 99,- uploads: [- {- id: 1,- url: "/uploads/server.png",- short_path: "/uploads/short-url/server",- width: 300,- height: 200,- },- ],- }),- });-- assert.strictEqual(channel.messagesManager.messages.length, 1);- assert.strictEqual(stagedMessage.id, 99);- assert.false(stagedMessage.staged);- assert.strictEqual(stagedMessage.uploads[0].url, "/uploads/server.png");- assert.strictEqual(- stagedMessage.uploads[0].short_path,- "/uploads/short-url/server"- );+ assert.strictEqual(channel.messagesManager.messages.length, 1);+ assert.strictEqual(stagedMessage.id, 99);+ assert.false(stagedMessage.staged);+ assert.strictEqual(stagedMessage.uploads[0].url, "/uploads/server.png");+ assert.strictEqual(+ stagedMessage.uploads[0].short_path,+ "/uploads/short-url/server"+ );+ });++ test("thread manager syncs uploads when matching staged message is sent", function (assert) {+ const channel = this.fabricators.channel({ id: 12 });+ const thread = this.fabricators.thread({ id: 222, channel });+ const manager = new ChatChannelThreadSubscriptionManager(this, thread);+ manager.currentUser = { id: 1 };++ const stagedMessage = this.fabricators.message({+ id: "staged-2",+ channel,+ staged: true,+ processed: false,+ message: "",+ cooked: "",+ user: { id: 1, username: "current_user" },+ uploads: [+ { id: 2, url: "/uploads/local-thread.png", width: 20, height: 20 },+ ],});+ thread.messagesManager.addMessages([stagedMessage]);- test("thread manager syncs uploads when matching staged message is sent", function (assert) {- const channel = this.fabricators.channel({ id: 12 });- const thread = this.fabricators.thread({ id: 222, channel });- const manager = new ChatChannelThreadSubscriptionManager(this, thread);- manager.currentUser = { id: 1 };-- const stagedMessage = this.fabricators.message({- id: "staged-2",- channel,- staged: true,- processed: false,- message: "",- cooked: "",- user: { id: 1, username: "current_user" },+ manager.handleSentMessage({+ type: "sent",+ staged_id: "staged-2",+ chat_message: buildChatMessagePayload({+ id: 109,uploads: [- { id: 2, url: "/uploads/local-thread.png", width: 20, height: 20 },+ {+ id: 2,+ url: "/uploads/server-thread.png",+ short_path: "/uploads/short-url/server-thread",+ width: 640,+ height: 480,+ },],- });- thread.messagesManager.addMessages([stagedMessage]);-- manager.handleSentMessage({- type: "sent",- staged_id: "staged-2",- chat_message: buildChatMessagePayload({- id: 109,- uploads: [- {- id: 2,- url: "/uploads/server-thread.png",- short_path: "/uploads/short-url/server-thread",- width: 640,- height: 480,- },- ],- }),- });-- assert.strictEqual(thread.messagesManager.messages.length, 1);- assert.strictEqual(stagedMessage.id, 109);- assert.false(stagedMessage.staged);- assert.strictEqual(- stagedMessage.uploads[0].url,- "/uploads/server-thread.png"- );- assert.strictEqual(- stagedMessage.uploads[0].short_path,- "/uploads/short-url/server-thread"- );+ }),});- test("channel manager keeps deleted messages visible for category moderators", function (assert) {- const channel = this.fabricators.channel({- id: 13,- meta: { can_moderate: true },- });- const message = this.fabricators.message({- id: 201,- channel,- user: { id: 2, username: "other_user" },- });- channel.messagesManager.addMessages([message]);-- const manager = new ChatChannelSubscriptionManager(this, channel);- manager.currentUser = { id: 1, staff: false };-- manager.handleDeleteMessage({- deleted_id: message.id,- deleted_at: "2026-03-11T10:00:00.000Z",- deleted_by_id: 1,- });-- assert.strictEqual(channel.messagesManager.messages.length, 1);- assert.strictEqual(message.deletedById, 1);- assert.strictEqual(message.deletedAt, "2026-03-11T10:00:00.000Z");- assert.false(message.expanded);+ assert.strictEqual(thread.messagesManager.messages.length, 1);+ assert.strictEqual(stagedMessage.id, 109);+ assert.false(stagedMessage.staged);+ assert.strictEqual(+ stagedMessage.uploads[0].url,+ "/uploads/server-thread.png"+ );+ assert.strictEqual(+ stagedMessage.uploads[0].short_path,+ "/uploads/short-url/server-thread"+ );+ });++ test("channel manager keeps deleted messages visible for category moderators", function (assert) {+ const channel = this.fabricators.channel({+ id: 13,+ meta: { can_moderate: true },+ });+ const message = this.fabricators.message({+ id: 201,+ channel,+ user: { id: 2, username: "other_user" },});+ channel.messagesManager.addMessages([message]);- test("thread manager keeps deleted messages visible for category moderators", function (assert) {- const channel = this.fabricators.channel({- id: 14,- meta: { can_moderate: true },- });- const thread = this.fabricators.thread({ id: 223, channel });- const message = this.fabricators.message({- id: 202,- channel,- user: { id: 2, username: "other_user" },- });- thread.messagesManager.addMessages([message]);-- const manager = new ChatChannelThreadSubscriptionManager(this, thread);- manager.currentUser = { id: 1, staff: false };-- manager.handleDeleteMessage({- deleted_id: message.id,- deleted_at: "2026-03-11T10:00:00.000Z",- deleted_by_id: 1,- });-- assert.strictEqual(thread.messagesManager.messages.length, 1);- assert.strictEqual(message.deletedById, 1);- assert.strictEqual(message.deletedAt, "2026-03-11T10:00:00.000Z");- assert.false(message.expanded);+ const manager = new ChatChannelSubscriptionManager(this, channel);+ manager.currentUser = { id: 1, staff: false };++ manager.handleDeleteMessage({+ deleted_id: message.id,+ deleted_at: "2026-03-11T10:00:00.000Z",+ deleted_by_id: 1,});- }-);++ assert.strictEqual(channel.messagesManager.messages.length, 1);+ assert.strictEqual(message.deletedById, 1);+ assert.strictEqual(message.deletedAt, "2026-03-11T10:00:00.000Z");+ assert.false(message.expanded);+ });++ test("thread manager keeps deleted messages visible for category moderators", function (assert) {+ const channel = this.fabricators.channel({+ id: 14,+ meta: { can_moderate: true },+ });+ const thread = this.fabricators.thread({ id: 223, channel });+ const message = this.fabricators.message({+ id: 202,+ channel,+ user: { id: 2, username: "other_user" },+ });+ thread.messagesManager.addMessages([message]);++ const manager = new ChatChannelThreadSubscriptionManager(this, thread);+ manager.currentUser = { id: 1, staff: false };++ manager.handleDeleteMessage({+ deleted_id: message.id,+ deleted_at: "2026-03-11T10:00:00.000Z",+ deleted_by_id: 1,+ });++ assert.strictEqual(thread.messagesManager.messages.length, 1);+ assert.strictEqual(message.deletedById, 1);+ assert.strictEqual(message.deletedAt, "2026-03-11T10:00:00.000Z");+ assert.false(message.expanded);+ });+});function buildChatMessagePayload({ id, uploads }) {return {diff --git a/plugins/chat/test/javascripts/unit/lib/chatables-loader-test.js b/plugins/chat/test/javascripts/unit/lib/chatables-loader-test.jsindex ea7733edde5..bd1b1657f2f 100644--- a/plugins/chat/test/javascripts/unit/lib/chatables-loader-test.js+++ b/plugins/chat/test/javascripts/unit/lib/chatables-loader-test.js@@ -7,7 +7,7 @@ import {} from "discourse/plugins/chat/discourse/lib/chat-constants";import ChatChatable from "discourse/plugins/chat/discourse/models/chat-chatable";-module("Discourse Chat | Unit | lib | chatables-loader", function () {+module("Unit | lib | chatables-loader", function () {function createUserChatable(username,{ has_chat_enabled = true, match_quality = MATCH_QUALITY_PARTIAL } = {}diff --git a/plugins/chat/test/javascripts/unit/lib/get-reaction-text-test.js b/plugins/chat/test/javascripts/unit/lib/get-reaction-text-test.jsindex a52e47eb8c5..c47248f475a 100644--- a/plugins/chat/test/javascripts/unit/lib/get-reaction-text-test.js+++ b/plugins/chat/test/javascripts/unit/lib/get-reaction-text-test.js@@ -8,7 +8,7 @@ import {MAX_DISPLAYED_USERNAMES,} from "discourse/plugins/chat/discourse/lib/get-reaction-text";-module("Discourse Chat | Unit | get-reaction-text", function (hooks) {+module("Unit | get-reaction-text", function (hooks) {setupTest(hooks);test("no reaction", function (assert) {diff --git a/plugins/chat/test/javascripts/unit/lib/slugify-channel-test.js b/plugins/chat/test/javascripts/unit/lib/slugify-channel-test.jsindex 8fdc4847404..3837c027263 100644--- a/plugins/chat/test/javascripts/unit/lib/slugify-channel-test.js+++ b/plugins/chat/test/javascripts/unit/lib/slugify-channel-test.js@@ -1,7 +1,7 @@import { module, test } from "qunit";import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";-module("Discourse Chat | Unit | slugify-channel", function () {+module("Unit | slugify-channel", function () {test("defaults for title", function (assert) {assert.strictEqual(slugifyChannel({ title: "Foo bar" }), "foo-bar");});diff --git a/plugins/chat/test/javascripts/unit/models/chat-channel-test.js b/plugins/chat/test/javascripts/unit/models/chat-channel-test.jsindex 7f4c929547d..9935e7355f9 100644--- a/plugins/chat/test/javascripts/unit/models/chat-channel-test.js+++ b/plugins/chat/test/javascripts/unit/models/chat-channel-test.js@@ -3,7 +3,7 @@ import { setupTest } from "ember-qunit";import { module, test } from "qunit";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Discourse Chat | Unit | Models | chat-channel", function (hooks) {+module("Unit | Models | chat-channel", function (hooks) {setupTest(hooks);module("unreadThreadsCount", function () {diff --git a/plugins/chat/test/javascripts/unit/models/chat-message-test.js b/plugins/chat/test/javascripts/unit/models/chat-message-test.jsindex dd6fb51adf6..f149c099654 100644--- a/plugins/chat/test/javascripts/unit/models/chat-message-test.js+++ b/plugins/chat/test/javascripts/unit/models/chat-message-test.js@@ -4,7 +4,7 @@ import { module, test } from "qunit";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";-module("Discourse Chat | Unit | Models | chat-message", function (hooks) {+module("Unit | Models | chat-message", function (hooks) {setupTest(hooks);test(".persisted", function (assert) {diff --git a/plugins/chat/test/javascripts/unit/services/chat-channel-info-route-origin-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-channel-info-route-origin-manager-test.jsindex 7797263490e..45567108bce 100644--- a/plugins/chat/test/javascripts/unit/services/chat-channel-info-route-origin-manager-test.js+++ b/plugins/chat/test/javascripts/unit/services/chat-channel-info-route-origin-manager-test.js@@ -4,7 +4,7 @@ import { module, test } from "qunit";import { ORIGINS } from "discourse/plugins/chat/discourse/services/chat-channel-info-route-origin-manager";module(- "Discourse Chat | Unit | Service | chat-channel-info-route-origin-manager",+ "Unit | Service | chat-channel-info-route-origin-manager",function (hooks) {setupTest(hooks);diff --git a/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.jsindex 39a034db03d..ab75ce00145 100644--- a/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.js+++ b/plugins/chat/test/javascripts/unit/services/chat-channels-manager-test.js@@ -4,615 +4,601 @@ import { module, test } from "qunit";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import UserChatChannelMembership from "discourse/plugins/chat/discourse/models/user-chat-channel-membership";-module(- "Discourse Chat | Unit | Service | chat-channels-manager",- function (hooks) {- setupTest(hooks);-- hooks.beforeEach(function () {- this.subject = getOwner(this).lookup("service:chat-channels-manager");- this.fabricators = new ChatFabricators(getOwner(this));+module("Unit | Service | chat-channels-manager", function (hooks) {+ setupTest(hooks);++ hooks.beforeEach(function () {+ this.subject = getOwner(this).lookup("service:chat-channels-manager");+ this.fabricators = new ChatFabricators(getOwner(this));+ });++ module("#sortChannelsByActivity with starred channels", function () {+ test("prioritizes starred channels over unstarred", function (assert) {+ const channelA = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-a",+ }),+ });+ const channelB = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-b",+ }),+ });++ channelA.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ channelB.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: false,+ });++ this.subject.store(channelA);+ this.subject.store(channelB);++ const result = this.subject.publicMessageChannels;++ assert.strictEqual(+ result[0].id,+ channelA.id,+ "starred channel comes first"+ );+ assert.strictEqual(+ result[1].id,+ channelB.id,+ "unstarred channel comes second"+ );});- module("#sortChannelsByActivity with starred channels", function () {- test("prioritizes starred channels over unstarred", function (assert) {- const channelA = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-a",- }),- });- const channelB = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-b",- }),- });+ test("sorts starred channels alphabetically by slug", function (assert) {+ const channelC = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-c",+ }),+ });+ const channelA = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-a",+ }),+ });+ const channelB = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-b",+ }),+ });++ channelC.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ channelA.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ channelB.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });++ this.subject.store(channelC);+ this.subject.store(channelA);+ this.subject.store(channelB);++ const result = this.subject.publicMessageChannels;++ assert.strictEqual(+ result[0].slug,+ "channel-a",+ "first starred channel is A"+ );+ assert.strictEqual(+ result[1].slug,+ "channel-b",+ "second starred channel is B"+ );+ assert.strictEqual(+ result[2].slug,+ "channel-c",+ "third starred channel is C"+ );+ });++ test("keeps unstarred channels sorted by activity after starred ones", function (assert) {+ const starredChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "starred-channel",+ }),+ });+ const unstarredChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "unstarred-channel",+ }),+ });- channelA.currentUserMembership = UserChatChannelMembership.create({+ starredChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ unstarredChannel.currentUserMembership = UserChatChannelMembership.create(+ {following: true,- starred: true,- });- channelB.currentUserMembership = UserChatChannelMembership.create({+ starred: false,+ }+ );++ this.subject.store(unstarredChannel);+ this.subject.store(starredChannel);++ const result = this.subject.publicMessageChannels;++ assert.strictEqual(+ result[0].id,+ starredChannel.id,+ "starred channel is first"+ );+ assert.strictEqual(+ result[1].id,+ unstarredChannel.id,+ "unstarred channel is after starred"+ );+ });+ });++ module("#unstarredPublicMessageChannelsByActivity", function () {+ test("excludes starred channels", function (assert) {+ const starredChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "starred-channel",+ }),+ });+ const unstarredChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "unstarred-channel",+ }),+ });++ starredChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ unstarredChannel.currentUserMembership = UserChatChannelMembership.create(+ {following: true,starred: false,- });+ }+ );- this.subject.store(channelA);- this.subject.store(channelB);+ this.subject.store(starredChannel);+ this.subject.store(unstarredChannel);- const result = this.subject.publicMessageChannels;+ const result = this.subject.unstarredPublicMessageChannelsByActivity;- assert.strictEqual(- result[0].id,- channelA.id,- "starred channel comes first"- );- assert.strictEqual(- result[1].id,- channelB.id,- "unstarred channel comes second"- );- });+ assert.strictEqual(result.length, 1, "returns only unstarred channels");+ assert.strictEqual(+ result[0].id,+ unstarredChannel.id,+ "returns the unstarred channel"+ );+ });- test("sorts starred channels alphabetically by slug", function (assert) {- const channelC = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-c",- }),- });- const channelA = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-a",- }),- });- const channelB = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-b",- }),- });+ test("sorts unstarred channels by activity with unreads first", function (assert) {+ const channelWithUnread = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-with-unread",+ }),+ });+ const channelNoUnread = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-no-unread",+ }),+ });- channelC.currentUserMembership = UserChatChannelMembership.create({+ channelWithUnread.currentUserMembership =+ UserChatChannelMembership.create({following: true,- starred: true,- });- channelA.currentUserMembership = UserChatChannelMembership.create({- following: true,- starred: true,+ starred: false,});- channelB.currentUserMembership = UserChatChannelMembership.create({+ channelNoUnread.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: false,+ });++ channelWithUnread.tracking.unreadCount = 5;+ channelNoUnread.tracking.unreadCount = 0;++ this.subject.store(channelNoUnread);+ this.subject.store(channelWithUnread);++ const result = this.subject.unstarredPublicMessageChannelsByActivity;++ assert.strictEqual(+ result[0].id,+ channelWithUnread.id,+ "channel with unreads comes first"+ );+ assert.strictEqual(+ result[1].id,+ channelNoUnread.id,+ "channel without unreads comes second"+ );+ });+ });++ module("#starredChannelsByActivity", function () {+ test("sorts starred channels with unreads first", function (assert) {+ const channelWithUnread = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-with-unread",+ }),+ });+ const channelNoUnread = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "channel-no-unread",+ }),+ });++ channelWithUnread.currentUserMembership =+ UserChatChannelMembership.create({following: true,starred: true,});+ channelNoUnread.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });- this.subject.store(channelC);- this.subject.store(channelA);- this.subject.store(channelB);-- const result = this.subject.publicMessageChannels;-- assert.strictEqual(- result[0].slug,- "channel-a",- "first starred channel is A"- );- assert.strictEqual(- result[1].slug,- "channel-b",- "second starred channel is B"- );- assert.strictEqual(- result[2].slug,- "channel-c",- "third starred channel is C"- );- });-- test("keeps unstarred channels sorted by activity after starred ones", function (assert) {- const starredChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "starred-channel",- }),- });- const unstarredChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "unstarred-channel",- }),- });+ channelWithUnread.tracking.unreadCount = 5;+ channelNoUnread.tracking.unreadCount = 0;- starredChannel.currentUserMembership = UserChatChannelMembership.create(- {- following: true,- starred: true,- }- );- unstarredChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: false,- });-- this.subject.store(unstarredChannel);- this.subject.store(starredChannel);-- const result = this.subject.publicMessageChannels;-- assert.strictEqual(- result[0].id,- starredChannel.id,- "starred channel is first"- );- assert.strictEqual(- result[1].id,- unstarredChannel.id,- "unstarred channel is after starred"- );- });- });+ this.subject.store(channelNoUnread);+ this.subject.store(channelWithUnread);- module("#unstarredPublicMessageChannelsByActivity", function () {- test("excludes starred channels", function (assert) {- const starredChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "starred-channel",- }),- });- const unstarredChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "unstarred-channel",- }),- });+ const result = this.subject.starredChannelsByActivity;- starredChannel.currentUserMembership = UserChatChannelMembership.create(- {- following: true,- starred: true,- }- );- unstarredChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: false,- });-- this.subject.store(starredChannel);- this.subject.store(unstarredChannel);-- const result = this.subject.unstarredPublicMessageChannelsByActivity;-- assert.strictEqual(result.length, 1, "returns only unstarred channels");- assert.strictEqual(- result[0].id,- unstarredChannel.id,- "returns the unstarred channel"- );- });-- test("sorts unstarred channels by activity with unreads first", function (assert) {- const channelWithUnread = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-with-unread",- }),- });- const channelNoUnread = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-no-unread",- }),- });+ assert.strictEqual(+ result[0].id,+ channelWithUnread.id,+ "channel with unreads comes first"+ );+ assert.strictEqual(+ result[1].id,+ channelNoUnread.id,+ "channel without unreads comes second"+ );+ });- channelWithUnread.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: false,- });- channelNoUnread.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: false,- });-- channelWithUnread.tracking.unreadCount = 5;- channelNoUnread.tracking.unreadCount = 0;-- this.subject.store(channelNoUnread);- this.subject.store(channelWithUnread);-- const result = this.subject.unstarredPublicMessageChannelsByActivity;-- assert.strictEqual(- result[0].id,- channelWithUnread.id,- "channel with unreads comes first"- );- assert.strictEqual(- result[1].id,- channelNoUnread.id,- "channel without unreads comes second"- );+ test("includes both public and DM starred channels", function (assert) {+ const publicChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "public",+ }),+ });+ const dmChannel = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "DM User",});- });- module("#starredChannelsByActivity", function () {- test("sorts starred channels with unreads first", function (assert) {- const channelWithUnread = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-with-unread",- }),- });- const channelNoUnread = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "channel-no-unread",- }),- });+ publicChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ dmChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });- channelWithUnread.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });- channelNoUnread.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });-- channelWithUnread.tracking.unreadCount = 5;- channelNoUnread.tracking.unreadCount = 0;-- this.subject.store(channelNoUnread);- this.subject.store(channelWithUnread);-- const result = this.subject.starredChannelsByActivity;-- assert.strictEqual(- result[0].id,- channelWithUnread.id,- "channel with unreads comes first"- );- assert.strictEqual(- result[1].id,- channelNoUnread.id,- "channel without unreads comes second"- );- });-- test("includes both public and DM starred channels", function (assert) {- const publicChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "public",- }),- });- const dmChannel = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "DM User",- });+ this.subject.store(publicChannel);+ this.subject.store(dmChannel);- publicChannel.currentUserMembership = UserChatChannelMembership.create({- following: true,- starred: true,- });- dmChannel.currentUserMembership = UserChatChannelMembership.create({+ const result = this.subject.starredChannelsByActivity;++ assert.strictEqual(result.length, 2, "returns both channels");+ });++ test("prioritizes unread status over channel type", function (assert) {+ const readPublicChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "read-public",+ }),+ });+ const unreadDmChannel = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Unread DM",+ });++ readPublicChannel.currentUserMembership =+ UserChatChannelMembership.create({following: true,starred: true,});+ unreadDmChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });- this.subject.store(publicChannel);- this.subject.store(dmChannel);-- const result = this.subject.starredChannelsByActivity;+ readPublicChannel.tracking.unreadCount = 0;+ unreadDmChannel.tracking.unreadCount = 3;- assert.strictEqual(result.length, 2, "returns both channels");- });+ this.subject.store(readPublicChannel);+ this.subject.store(unreadDmChannel);- test("prioritizes unread status over channel type", function (assert) {- const readPublicChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "read-public",- }),- });- const unreadDmChannel = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Unread DM",- });+ const result = this.subject.starredChannelsByActivity;- readPublicChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });- unreadDmChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });-- readPublicChannel.tracking.unreadCount = 0;- unreadDmChannel.tracking.unreadCount = 3;-- this.subject.store(readPublicChannel);- this.subject.store(unreadDmChannel);-- const result = this.subject.starredChannelsByActivity;-- assert.strictEqual(- result[0].id,- unreadDmChannel.id,- "unread DM comes before read public channel"- );- assert.strictEqual(- result[1].id,- readPublicChannel.id,- "read public channel comes after unread DM"- );- });-- test("sorts unread public channels before unread DMs", function (assert) {- const unreadPublicChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "unread-public",- }),- });- const unreadDmChannel = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Unread DM",- });+ assert.strictEqual(+ result[0].id,+ unreadDmChannel.id,+ "unread DM comes before read public channel"+ );+ assert.strictEqual(+ result[1].id,+ readPublicChannel.id,+ "read public channel comes after unread DM"+ );+ });- unreadPublicChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });- unreadDmChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });-- unreadPublicChannel.tracking.unreadCount = 2;- unreadDmChannel.tracking.unreadCount = 5;-- this.subject.store(unreadDmChannel);- this.subject.store(unreadPublicChannel);-- const result = this.subject.starredChannelsByActivity;-- assert.strictEqual(- result[0].id,- unreadPublicChannel.id,- "unread public channel comes first"- );- assert.strictEqual(- result[1].id,- unreadDmChannel.id,- "unread DM comes second"- );- });-- test("sorts read public channels before read DMs", function (assert) {- const readPublicChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "read-public",- }),- });- const readDmChannel = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Read DM",- });+ test("sorts unread public channels before unread DMs", function (assert) {+ const unreadPublicChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "unread-public",+ }),+ });+ const unreadDmChannel = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Unread DM",+ });- readPublicChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });- readDmChannel.currentUserMembership = UserChatChannelMembership.create({+ unreadPublicChannel.currentUserMembership =+ UserChatChannelMembership.create({following: true,starred: true,});+ unreadDmChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });- readPublicChannel.tracking.unreadCount = 0;- readDmChannel.tracking.unreadCount = 0;+ unreadPublicChannel.tracking.unreadCount = 2;+ unreadDmChannel.tracking.unreadCount = 5;- this.subject.store(readDmChannel);- this.subject.store(readPublicChannel);+ this.subject.store(unreadDmChannel);+ this.subject.store(unreadPublicChannel);- const result = this.subject.starredChannelsByActivity;+ const result = this.subject.starredChannelsByActivity;- assert.strictEqual(- result[0].id,- readPublicChannel.id,- "read public channel comes first"- );- assert.strictEqual(- result[1].id,- readDmChannel.id,- "read DM comes second"- );- });+ assert.strictEqual(+ result[0].id,+ unreadPublicChannel.id,+ "unread public channel comes first"+ );+ assert.strictEqual(+ result[1].id,+ unreadDmChannel.id,+ "unread DM comes second"+ );+ });- test("complete ordering: unread public, unread DM, read public, read DM", function (assert) {- const readPublicChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "read-public",- }),- });- const unreadPublicChannel = this.fabricators.channel({- chatable: this.fabricators.coreFabricators.category({- slug: "unread-public",- }),- });- const readDmChannel = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Read DM",- });- const unreadDmChannel = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Unread DM",- });+ test("sorts read public channels before read DMs", function (assert) {+ const readPublicChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "read-public",+ }),+ });+ const readDmChannel = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Read DM",+ });- readPublicChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });- unreadPublicChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });- readDmChannel.currentUserMembership = UserChatChannelMembership.create({+ readPublicChannel.currentUserMembership =+ UserChatChannelMembership.create({following: true,starred: true,});- unreadDmChannel.currentUserMembership =- UserChatChannelMembership.create({- following: true,- starred: true,- });-- readPublicChannel.tracking.unreadCount = 0;- unreadPublicChannel.tracking.unreadCount = 2;- readDmChannel.tracking.unreadCount = 0;- unreadDmChannel.tracking.unreadCount = 3;-- this.subject.store(readDmChannel);- this.subject.store(unreadDmChannel);- this.subject.store(readPublicChannel);- this.subject.store(unreadPublicChannel);-- const result = this.subject.starredChannelsByActivity;-- assert.strictEqual(result.length, 4, "returns all 4 channels");- assert.strictEqual(- result[0].id,- unreadPublicChannel.id,- "1st: unread public channel"- );- assert.strictEqual(result[1].id, unreadDmChannel.id, "2nd: unread DM");- assert.strictEqual(- result[2].id,- readPublicChannel.id,- "3rd: read public channel"- );- assert.strictEqual(result[3].id, readDmChannel.id, "4th: read DM");+ readDmChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,});++ readPublicChannel.tracking.unreadCount = 0;+ readDmChannel.tracking.unreadCount = 0;++ this.subject.store(readDmChannel);+ this.subject.store(readPublicChannel);++ const result = this.subject.starredChannelsByActivity;++ assert.strictEqual(+ result[0].id,+ readPublicChannel.id,+ "read public channel comes first"+ );+ assert.strictEqual(+ result[1].id,+ readDmChannel.id,+ "read DM comes second"+ );});- module("#sortDirectMessageChannels with starred channels", function () {- test("prioritizes starred DM channels over unstarred", function (assert) {- const dmA = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Alice",- });- const dmB = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Bob",- });+ test("complete ordering: unread public, unread DM, read public, read DM", function (assert) {+ const readPublicChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "read-public",+ }),+ });+ const unreadPublicChannel = this.fabricators.channel({+ chatable: this.fabricators.coreFabricators.category({+ slug: "unread-public",+ }),+ });+ const readDmChannel = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Read DM",+ });+ const unreadDmChannel = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Unread DM",+ });- dmA.currentUserMembership = UserChatChannelMembership.create({+ readPublicChannel.currentUserMembership =+ UserChatChannelMembership.create({following: true,starred: true,});- dmB.currentUserMembership = UserChatChannelMembership.create({+ unreadPublicChannel.currentUserMembership =+ UserChatChannelMembership.create({following: true,- starred: false,+ starred: true,});+ readDmChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ unreadDmChannel.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });- this.subject.store(dmA);- this.subject.store(dmB);+ readPublicChannel.tracking.unreadCount = 0;+ unreadPublicChannel.tracking.unreadCount = 2;+ readDmChannel.tracking.unreadCount = 0;+ unreadDmChannel.tracking.unreadCount = 3;++ this.subject.store(readDmChannel);+ this.subject.store(unreadDmChannel);+ this.subject.store(readPublicChannel);+ this.subject.store(unreadPublicChannel);++ const result = this.subject.starredChannelsByActivity;++ assert.strictEqual(result.length, 4, "returns all 4 channels");+ assert.strictEqual(+ result[0].id,+ unreadPublicChannel.id,+ "1st: unread public channel"+ );+ assert.strictEqual(result[1].id, unreadDmChannel.id, "2nd: unread DM");+ assert.strictEqual(+ result[2].id,+ readPublicChannel.id,+ "3rd: read public channel"+ );+ assert.strictEqual(result[3].id, readDmChannel.id, "4th: read DM");+ });+ });- const result = this.subject.directMessageChannels;+ module("#sortDirectMessageChannels with starred channels", function () {+ test("prioritizes starred DM channels over unstarred", function (assert) {+ const dmA = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Alice",+ });+ const dmB = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Bob",+ });- assert.strictEqual(- result[0].id,- dmA.id,- "starred DM channel comes first"- );- assert.strictEqual(- result[1].id,- dmB.id,- "unstarred DM channel comes second"- );+ dmA.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ dmB.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: false,});- test("sorts starred DM channels alphabetically by title", function (assert) {- const dmCharlie = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Charlie",- });- const dmAlice = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Alice",- });- const dmBob = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Bob",- });+ this.subject.store(dmA);+ this.subject.store(dmB);++ const result = this.subject.directMessageChannels;++ assert.strictEqual(+ result[0].id,+ dmA.id,+ "starred DM channel comes first"+ );+ assert.strictEqual(+ result[1].id,+ dmB.id,+ "unstarred DM channel comes second"+ );+ });- dmCharlie.currentUserMembership = UserChatChannelMembership.create({- following: true,- starred: true,- });- dmAlice.currentUserMembership = UserChatChannelMembership.create({- following: true,- starred: true,- });- dmBob.currentUserMembership = UserChatChannelMembership.create({- following: true,- starred: true,- });+ test("sorts starred DM channels alphabetically by title", function (assert) {+ const dmCharlie = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Charlie",+ });+ const dmAlice = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Alice",+ });+ const dmBob = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Bob",+ });- this.subject.store(dmCharlie);- this.subject.store(dmAlice);- this.subject.store(dmBob);-- const result = this.subject.directMessageChannels;-- assert.strictEqual(- result[0].title,- "Alice",- "first starred DM is Alice"- );- assert.strictEqual(result[1].title, "Bob", "second starred DM is Bob");- assert.strictEqual(- result[2].title,- "Charlie",- "third starred DM is Charlie"- );- });-- test("keeps unstarred DM channels sorted by activity after starred ones", function (assert) {- const starredDM = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Starred User",- });- const unstarredDM = this.fabricators.channel({- chatable: this.fabricators.directMessage(),- title: "Unstarred User",- });+ dmCharlie.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ dmAlice.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ dmBob.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });- starredDM.currentUserMembership = UserChatChannelMembership.create({- following: true,- starred: true,- });- unstarredDM.currentUserMembership = UserChatChannelMembership.create({- following: true,- starred: false,- });+ this.subject.store(dmCharlie);+ this.subject.store(dmAlice);+ this.subject.store(dmBob);- this.subject.store(unstarredDM);- this.subject.store(starredDM);+ const result = this.subject.directMessageChannels;- const result = this.subject.directMessageChannels;+ assert.strictEqual(result[0].title, "Alice", "first starred DM is Alice");+ assert.strictEqual(result[1].title, "Bob", "second starred DM is Bob");+ assert.strictEqual(+ result[2].title,+ "Charlie",+ "third starred DM is Charlie"+ );+ });- assert.strictEqual(- result[0].id,- starredDM.id,- "starred DM channel is first"- );- assert.strictEqual(- result[1].id,- unstarredDM.id,- "unstarred DM channel is after starred"- );+ test("keeps unstarred DM channels sorted by activity after starred ones", function (assert) {+ const starredDM = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Starred User",+ });+ const unstarredDM = this.fabricators.channel({+ chatable: this.fabricators.directMessage(),+ title: "Unstarred User",});++ starredDM.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: true,+ });+ unstarredDM.currentUserMembership = UserChatChannelMembership.create({+ following: true,+ starred: false,+ });++ this.subject.store(unstarredDM);+ this.subject.store(starredDM);++ const result = this.subject.directMessageChannels;++ assert.strictEqual(+ result[0].id,+ starredDM.id,+ "starred DM channel is first"+ );+ assert.strictEqual(+ result[1].id,+ unstarredDM.id,+ "unstarred DM channel is after starred"+ );});- }-);+ });+});diff --git a/plugins/chat/test/javascripts/unit/services/chat-drafts-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-drafts-manager-test.jsindex 071722b2deb..a0c96e3dcf4 100644--- a/plugins/chat/test/javascripts/unit/services/chat-drafts-manager-test.js+++ b/plugins/chat/test/javascripts/unit/services/chat-drafts-manager-test.js@@ -3,39 +3,36 @@ import { setupTest } from "ember-qunit";import { module, test } from "qunit";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module(- "Discourse Chat | Unit | Service | chat-drafts-manager",- function (hooks) {- setupTest(hooks);+module("Unit | Service | chat-drafts-manager", function (hooks) {+ setupTest(hooks);- hooks.beforeEach(function () {- this.subject = getOwner(this).lookup("service:chat-drafts-manager");- });+ hooks.beforeEach(function () {+ this.subject = getOwner(this).lookup("service:chat-drafts-manager");+ });- test("storing and retrieving message", async function (assert) {- const message1 = new ChatFabricators(getOwner(this)).message();+ test("storing and retrieving message", async function (assert) {+ const message1 = new ChatFabricators(getOwner(this)).message();- await this.subject.add(message1, message1.channel.id, null, false);+ await this.subject.add(message1, message1.channel.id, null, false);- assert.strictEqual(this.subject.get(message1.channel.id), message1);+ assert.strictEqual(this.subject.get(message1.channel.id), message1);- const message2 = new ChatFabricators(getOwner(this)).message();+ const message2 = new ChatFabricators(getOwner(this)).message();- await this.subject.add(message2, message2.channel.id, null, false);+ await this.subject.add(message2, message2.channel.id, null, false);- assert.strictEqual(this.subject.get(message2.channel.id), message2);- });+ assert.strictEqual(this.subject.get(message2.channel.id), message2);+ });- test("#reset", async function (assert) {- const message = new ChatFabricators(getOwner(this)).message();+ test("#reset", async function (assert) {+ const message = new ChatFabricators(getOwner(this)).message();- await this.subject.add(message, message.channel.id, null, false);+ await this.subject.add(message, message.channel.id, null, false);- assert.strictEqual(Object.keys(this.subject.drafts).length, 1);+ assert.strictEqual(Object.keys(this.subject.drafts).length, 1);- this.subject.reset();+ this.subject.reset();- assert.strictEqual(Object.keys(this.subject.drafts).length, 0);- });- }-);+ assert.strictEqual(Object.keys(this.subject.drafts).length, 0);+ });+});diff --git a/plugins/chat/test/javascripts/unit/services/chat-drawer-size-test.js b/plugins/chat/test/javascripts/unit/services/chat-drawer-size-test.jsindex 7ee7d2acce6..4ddbc35c35c 100644--- a/plugins/chat/test/javascripts/unit/services/chat-drawer-size-test.js+++ b/plugins/chat/test/javascripts/unit/services/chat-drawer-size-test.js@@ -2,7 +2,7 @@ import { getOwner } from "@ember/owner";import { setupTest } from "ember-qunit";import { module, test } from "qunit";-module("Discourse Chat | Unit | Service | chat-drawer-size", function (hooks) {+module("Unit | Service | chat-drawer-size", function (hooks) {setupTest(hooks);hooks.beforeEach(function () {diff --git a/plugins/chat/test/javascripts/unit/services/chat-guardian-test.js b/plugins/chat/test/javascripts/unit/services/chat-guardian-test.jsindex d2fa1893220..2614444f349 100644--- a/plugins/chat/test/javascripts/unit/services/chat-guardian-test.js+++ b/plugins/chat/test/javascripts/unit/services/chat-guardian-test.js@@ -4,7 +4,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {+acceptance("Unit | Service | chat-guardian", function (needs) {needs.hooks.beforeEach(function () {Object.defineProperty(this, "chatGuardian", {get: () => this.container.lookup("service:chat-guardian"),diff --git a/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.jsindex 1ebd513a041..802492bb453 100644--- a/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js+++ b/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js@@ -8,176 +8,173 @@ import {resetChatDrawerStateCallbacks,} from "discourse/plugins/chat/discourse/services/chat-state-manager";-module(- "Discourse Chat | Unit | Service | chat-state-manager",- function (hooks) {- setupTest(hooks);+module("Unit | Service | chat-state-manager", function (hooks) {+ setupTest(hooks);- hooks.beforeEach(function () {- this.subject = getOwner(this).lookup("service:chat-state-manager");- });+ hooks.beforeEach(function () {+ this.subject = getOwner(this).lookup("service:chat-state-manager");+ });- hooks.afterEach(function () {- this.subject.reset();- });+ hooks.afterEach(function () {+ this.subject.reset();+ });- test("isFullPagePreferred", function (assert) {- assert.false(this.subject.isFullPagePreferred);+ test("isFullPagePreferred", function (assert) {+ assert.false(this.subject.isFullPagePreferred);- this.subject.prefersFullPage();+ this.subject.prefersFullPage();- assert.true(this.subject.isFullPagePreferred);+ assert.true(this.subject.isFullPagePreferred);- this.subject.prefersDrawer();+ this.subject.prefersDrawer();- assert.false(this.subject.isFullPagePreferred);+ assert.false(this.subject.isFullPagePreferred);- this.subject.prefersDrawer();- forceMobile();+ this.subject.prefersDrawer();+ forceMobile();- assert.true(this.subject.isFullPagePreferred);- });+ assert.true(this.subject.isFullPagePreferred);+ });- test("isDrawerPreferred", function (assert) {- assert.true(this.subject.isDrawerPreferred);+ test("isDrawerPreferred", function (assert) {+ assert.true(this.subject.isDrawerPreferred);- this.subject.prefersFullPage();+ this.subject.prefersFullPage();- assert.false(this.subject.isDrawerPreferred);+ assert.false(this.subject.isDrawerPreferred);- this.subject.prefersDrawer();+ this.subject.prefersDrawer();- assert.true(this.subject.isDrawerPreferred);- });+ assert.true(this.subject.isDrawerPreferred);+ });- test("hasNoPreferredMode", async function (assert) {- assert.true(this.subject.hasNoPreferredMode);+ test("hasNoPreferredMode", async function (assert) {+ assert.true(this.subject.hasNoPreferredMode);- this.subject.prefersFullPage();+ this.subject.prefersFullPage();- assert.false(this.subject.hasNoPreferredMode);+ assert.false(this.subject.hasNoPreferredMode);- this.subject.prefersDrawer();+ this.subject.prefersDrawer();- assert.false(this.subject.hasNoPreferredMode);- });+ assert.false(this.subject.hasNoPreferredMode);+ });- test("lastKnownChatURL", function (assert) {- assert.strictEqual(this.subject.lastKnownChatURL, "/chat");+ test("lastKnownChatURL", function (assert) {+ assert.strictEqual(this.subject.lastKnownChatURL, "/chat");- this.subject.storeChatURL("/bar");- assert.strictEqual(this.subject.lastKnownChatURL, "/bar");- });+ this.subject.storeChatURL("/bar");+ assert.strictEqual(this.subject.lastKnownChatURL, "/bar");+ });- test("lastKnownChatURL defaults to starred channels only in drawer mode", function (assert) {- const chatChannelsManager = getOwner(this).lookup(- "service:chat-channels-manager"- );- sinon.stub(chatChannelsManager, "hasStarredChannels").get(() => true);-- assert.strictEqual(- this.subject.lastKnownChatURL,- "/chat/starred-channels",- "defaults to starred-channels in drawer mode"- );-- this.subject.prefersFullPage();- assert.strictEqual(- this.subject.lastKnownChatURL,- "/chat",- "defaults to /chat in fullscreen mode (starred channels in sidebar)"- );- });+ test("lastKnownChatURL defaults to starred channels only in drawer mode", function (assert) {+ const chatChannelsManager = getOwner(this).lookup(+ "service:chat-channels-manager"+ );+ sinon.stub(chatChannelsManager, "hasStarredChannels").get(() => true);- test("lastKnownAppURL", function (assert) {- assert.strictEqual(this.subject.lastKnownAppURL, "/latest");+ assert.strictEqual(+ this.subject.lastKnownChatURL,+ "/chat/starred-channels",+ "defaults to starred-channels in drawer mode"+ );- sinon.stub(this.subject.router, "currentURL").value("/foo");- this.subject.storeAppURL();+ this.subject.prefersFullPage();+ assert.strictEqual(+ this.subject.lastKnownChatURL,+ "/chat",+ "defaults to /chat in fullscreen mode (starred channels in sidebar)"+ );+ });- assert.strictEqual(this.subject.lastKnownAppURL, "/foo");+ test("lastKnownAppURL", function (assert) {+ assert.strictEqual(this.subject.lastKnownAppURL, "/latest");- this.subject.storeAppURL("/bar");+ sinon.stub(this.subject.router, "currentURL").value("/foo");+ this.subject.storeAppURL();- assert.strictEqual(this.subject.lastKnownAppURL, "/bar");- });+ assert.strictEqual(this.subject.lastKnownAppURL, "/foo");- test("isFullPageActive", function (assert) {- sinon.stub(this.subject.router, "currentRouteName").value("foo");- assert.false(this.subject.isFullPageActive);+ this.subject.storeAppURL("/bar");- sinon.stub(this.subject.router, "currentRouteName").value("chat");- assert.true(this.subject.isFullPageActive);- });+ assert.strictEqual(this.subject.lastKnownAppURL, "/bar");+ });- test("didCollapseDrawer", function (assert) {- this.subject.didCollapseDrawer();+ test("isFullPageActive", function (assert) {+ sinon.stub(this.subject.router, "currentRouteName").value("foo");+ assert.false(this.subject.isFullPageActive);- assert.false(this.subject.isDrawerExpanded);- assert.true(this.subject.isDrawerActive);- });+ sinon.stub(this.subject.router, "currentRouteName").value("chat");+ assert.true(this.subject.isFullPageActive);+ });- test("didExpandDrawer", function (assert) {- const stub = sinon.stub(- this.owner.lookup("service:chat"),- "updatePresence"- );+ test("didCollapseDrawer", function (assert) {+ this.subject.didCollapseDrawer();- this.subject.didExpandDrawer();+ assert.false(this.subject.isDrawerExpanded);+ assert.true(this.subject.isDrawerActive);+ });- assert.true(this.subject.isDrawerExpanded);- assert.true(this.subject.isDrawerActive);- sinon.assert.calledOnce(stub);- });+ test("didExpandDrawer", function (assert) {+ const stub = sinon.stub(+ this.owner.lookup("service:chat"),+ "updatePresence"+ );- test("didCloseDrawer", function (assert) {- const stub = sinon.stub(- this.owner.lookup("service:chat"),- "updatePresence"- );+ this.subject.didExpandDrawer();- this.subject.didCloseDrawer();+ assert.true(this.subject.isDrawerExpanded);+ assert.true(this.subject.isDrawerActive);+ sinon.assert.calledOnce(stub);+ });- assert.false(this.subject.isDrawerExpanded);- assert.false(this.subject.isDrawerActive);- sinon.assert.calledOnce(stub);- });+ test("didCloseDrawer", function (assert) {+ const stub = sinon.stub(+ this.owner.lookup("service:chat"),+ "updatePresence"+ );- test("didOpenDrawer", function (assert) {- const stub = sinon.stub(- this.owner.lookup("service:chat"),- "updatePresence"- );+ this.subject.didCloseDrawer();- this.subject.didOpenDrawer();+ assert.false(this.subject.isDrawerExpanded);+ assert.false(this.subject.isDrawerActive);+ sinon.assert.calledOnce(stub);+ });- assert.true(this.subject.isDrawerExpanded);- assert.true(this.subject.isDrawerActive);- assert.strictEqual(this.subject.lastKnownChatURL, "/chat");+ test("didOpenDrawer", function (assert) {+ const stub = sinon.stub(+ this.owner.lookup("service:chat"),+ "updatePresence"+ );- this.subject.didOpenDrawer("/foo");+ this.subject.didOpenDrawer();- assert.strictEqual(this.subject.lastKnownChatURL, "/foo");- sinon.assert.calledTwice(stub);- });+ assert.true(this.subject.isDrawerExpanded);+ assert.true(this.subject.isDrawerActive);+ assert.strictEqual(this.subject.lastKnownChatURL, "/chat");- test("callbacks", function (assert) {- this.state = null;- addChatDrawerStateCallback((state) => {- this.state = state;- });+ this.subject.didOpenDrawer("/foo");- this.subject.didOpenDrawer();+ assert.strictEqual(this.subject.lastKnownChatURL, "/foo");+ sinon.assert.calledTwice(stub);+ });- assert.true(this.state.isDrawerActive);- assert.true(this.state.isDrawerExpanded);+ test("callbacks", function (assert) {+ this.state = null;+ addChatDrawerStateCallback((state) => {+ this.state = state;+ });- this.subject.didCloseDrawer();+ this.subject.didOpenDrawer();- assert.false(this.state.isDrawerActive);- assert.false(this.state.isDrawerExpanded);+ assert.true(this.state.isDrawerActive);+ assert.true(this.state.isDrawerExpanded);- resetChatDrawerStateCallbacks();- });- }-);+ this.subject.didCloseDrawer();++ assert.false(this.state.isDrawerActive);+ assert.false(this.state.isDrawerExpanded);++ resetChatDrawerStateCallbacks();+ });+});diff --git a/plugins/chat/test/javascripts/unit/services/chat-test.js b/plugins/chat/test/javascripts/unit/services/chat-test.jsindex cf35d7b44ea..6299bc8bbf2 100644--- a/plugins/chat/test/javascripts/unit/services/chat-test.js+++ b/plugins/chat/test/javascripts/unit/services/chat-test.js@@ -2,7 +2,7 @@ import { test } from "qunit";import sinon from "sinon";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Discourse Chat | Unit | Service | chat", function (needs) {+acceptance("Unit | Service | chat", function (needs) {needs.user();needs.hooks.beforeEach(function () {diff --git a/plugins/chat/test/javascripts/unit/utility/plugin-api-test.js b/plugins/chat/test/javascripts/unit/utility/plugin-api-test.jsindex b46feaf1460..1d70c078daf 100644--- a/plugins/chat/test/javascripts/unit/utility/plugin-api-test.js+++ b/plugins/chat/test/javascripts/unit/utility/plugin-api-test.js@@ -8,7 +8,7 @@ import ChatMessageInteractor, {} from "discourse/plugins/chat/discourse/lib/chat-message-interactor";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";-module("Chat | Unit | Utility | plugin-api", function (hooks) {+module("Unit | Utility | plugin-api", function (hooks) {setupTest(hooks);test("#sendChatMessage", async function (assert) {diff --git a/plugins/checklist/test/javascripts/lib/checklist-test.js b/plugins/checklist/test/javascripts/lib/checklist-test.jsindex 7d0ac260b60..e406640e1cf 100644--- a/plugins/checklist/test/javascripts/lib/checklist-test.js+++ b/plugins/checklist/test/javascripts/lib/checklist-test.js@@ -35,7 +35,7 @@ async function prepare(raw) {return { updated };}-acceptance("discourse-checklist | checklist", function (needs) {+acceptance("checklist", function (needs) {needs.pretender((server, helper) => {server.get("/posts/42", () => helper.response({ raw: currentRaw }));});diff --git a/plugins/discourse-ai/test/javascripts/acceptance/post-helper-menu-test.js b/plugins/discourse-ai/test/javascripts/acceptance/post-helper-menu-test.jsindex 1f17d8f7c1d..b0ac80d8bd4 100644--- a/plugins/discourse-ai/test/javascripts/acceptance/post-helper-menu-test.js+++ b/plugins/discourse-ai/test/javascripts/acceptance/post-helper-menu-test.js@@ -11,7 +11,7 @@ import {} from "discourse/tests/helpers/qunit-helpers";import aiHelperPrompts from "../fixtures/ai-helper-prompts";-acceptance("AI Helper - Post Helper Menu", function (needs) {+acceptance("Post Helper Menu", function (needs) {needs.settings({discourse_ai_enabled: true,ai_helper_enabled: true,diff --git a/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.js b/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.jsindex b1ccaa5b8d1..3096349e2d6 100644--- a/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/lib/ai-streamer-test.js@@ -46,7 +46,7 @@ class FakeStreamUpdater {}}-module("Discourse AI | Unit | Lib | ai-streamer", function () {+module("Unit | Lib | ai-streamer", function () {function confirmPlaceholder(html, expected, assert) {const element = document.createElement("div");element.innerHTML = html;diff --git a/plugins/discourse-ai/test/javascripts/unit/lib/llm-provider-param-helpers-test.js b/plugins/discourse-ai/test/javascripts/unit/lib/llm-provider-param-helpers-test.jsindex d95d534ade6..8b2bc31a9c3 100644--- a/plugins/discourse-ai/test/javascripts/unit/lib/llm-provider-param-helpers-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/lib/llm-provider-param-helpers-test.js@@ -5,7 +5,7 @@ import {normalizeProviderParams,} from "discourse/plugins/discourse-ai/discourse/lib/llm-provider-param-helpers";-module("Discourse AI | Unit | Lib | llm-provider-param-helpers", function () {+module("Unit | Lib | llm-provider-param-helpers", function () {module("isParamActive", function () {test("returns false for null, undefined, and false", function (assert) {assert.false(isParamActive(null));diff --git a/plugins/discourse-ai/test/javascripts/unit/lib/smooth-streamer-test.js b/plugins/discourse-ai/test/javascripts/unit/lib/smooth-streamer-test.jsindex 799b8c9ee67..dd7b864ddc2 100644--- a/plugins/discourse-ai/test/javascripts/unit/lib/smooth-streamer-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/lib/smooth-streamer-test.js@@ -4,7 +4,7 @@ import { setupTest } from "ember-qunit";import { module, test } from "qunit";import SmoothStreamer from "discourse/plugins/discourse-ai/discourse/lib/smooth-streamer";-module("Discourse AI | Unit | Lib | smooth-streamer", function (hooks) {+module("Unit | Lib | smooth-streamer", function (hooks) {setupTest(hooks);test("it initializes correctly", function (assert) {diff --git a/plugins/discourse-ai/test/javascripts/unit/models/ai-agent-test.js b/plugins/discourse-ai/test/javascripts/unit/models/ai-agent-test.jsindex e498f770fa1..126bbee1eef 100644--- a/plugins/discourse-ai/test/javascripts/unit/models/ai-agent-test.js+++ b/plugins/discourse-ai/test/javascripts/unit/models/ai-agent-test.js@@ -1,7 +1,7 @@import { module, test } from "qunit";import AiAgent from "discourse/plugins/discourse-ai/discourse/admin/models/ai-agent";-module("Discourse AI | Unit | Model | ai-agent", function () {+module("Unit | Model | ai-agent", function () {test("toPOJO", function (assert) {const properties = {mcp_server_tool_names: { 9: ["search_issues"] },diff --git a/plugins/discourse-assign/test/javascripts/acceptance/assign-disabled-test.js b/plugins/discourse-assign/test/javascripts/acceptance/assign-disabled-test.jsindex 92520050733..b82f53e6d89 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/assign-disabled-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/assign-disabled-test.js@@ -2,7 +2,7 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance(`Discourse Assign | Assign disabled mobile`, function (needs) {+acceptance("Assign disabled mobile", function (needs) {needs.user({ can_assign: true });needs.mobileView();needs.settings({diff --git a/plugins/discourse-assign/test/javascripts/acceptance/assign-enabled-test.js b/plugins/discourse-assign/test/javascripts/acceptance/assign-enabled-test.jsindex eb71ad585b8..da170ba0569 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/assign-enabled-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/assign-enabled-test.js@@ -12,7 +12,7 @@ import {} from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";-acceptance(`Discourse Assign | Assign mobile`, function (needs) {+acceptance("Assign mobile", function (needs) {needs.user();needs.mobileView();needs.settings({@@ -47,7 +47,7 @@ acceptance(`Discourse Assign | Assign mobile`, function (needs) {});});-acceptance(`Discourse Assign | Assign desktop`, function (needs) {+acceptance("Assign desktop", function (needs) {needs.user({ can_assign: true });needs.settings({assign_enabled: true,@@ -120,7 +120,7 @@ acceptance(`Discourse Assign | Assign desktop`, function (needs) {});});-acceptance(`Discourse Assign | Assign Status enabled`, function (needs) {+acceptance("Assign Status enabled", function (needs) {needs.user({can_assign: true,});@@ -182,7 +182,7 @@ acceptance(`Discourse Assign | Assign Status enabled`, function (needs) {});});-acceptance(`Discourse Assign | Assign Status disabled`, function (needs) {+acceptance("Assign Status disabled", function (needs) {needs.user({can_assign: true,});@@ -244,7 +244,7 @@ const remindersFrequency = [},];-acceptance("Discourse Assign | User preferences", function (needs) {+acceptance("User preferences", function (needs) {needs.user({ can_assign: true, reminders_frequency: remindersFrequency });needs.settings({assign_enabled: true,@@ -289,7 +289,7 @@ acceptance("Discourse Assign | User preferences", function (needs) {});acceptance(- "Discourse Assign | User preferences | Pre-selected reminder frequency",+ "User preferences | Pre-selected reminder frequency",function (needs) {needs.user({ can_assign: true, reminders_frequency: remindersFrequency });needs.settings({diff --git a/plugins/discourse-assign/test/javascripts/acceptance/assigned-topic-test.js b/plugins/discourse-assign/test/javascripts/acceptance/assigned-topic-test.jsindex c93a6282fec..fe99603b248 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/assigned-topic-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/assigned-topic-test.js@@ -81,7 +81,7 @@ function assignNewUserToTopic(needs) {});}-acceptance(`Discourse Assign | Assigned topic`, function (needs) {+acceptance("Assigned topic", function (needs) {needs.user();needs.settings({assign_enabled: true,@@ -196,7 +196,7 @@ acceptance(`Discourse Assign | Assigned topic`, function (needs) {});});-acceptance(`Discourse Assign | Reassign topic`, function (needs) {+acceptance("Reassign topic", function (needs) {needs.user();needs.settings({assign_enabled: true,@@ -219,7 +219,7 @@ acceptance(`Discourse Assign | Reassign topic`, function (needs) {});});-acceptance(`Discourse Assign | Reassign topic | mobile`, function (needs) {+acceptance("Reassign topic | mobile", function (needs) {needs.user();needs.mobileView();needs.settings({@@ -242,7 +242,7 @@ acceptance(`Discourse Assign | Reassign topic | mobile`, function (needs) {});});-acceptance(`Discourse Assign | Reassign topic conditionals`, function (needs) {+acceptance("Reassign topic conditionals", function (needs) {needs.user();needs.settings({assign_enabled: true,@@ -263,7 +263,7 @@ acceptance(`Discourse Assign | Reassign topic conditionals`, function (needs) {});});-acceptance(`Discourse Assign | Assignee name XSS escaping`, function (needs) {+acceptance("Assignee name XSS escaping", function (needs) {const XSS_PAYLOAD = '<img src="xss-test">';needs.user();diff --git a/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.js b/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.jsindex 379827dc982..30b5e7365a3 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/assigns-tab-user-menu-test.js@@ -47,43 +47,37 @@ const USER_MENU_ASSIGN_RESPONSE = {],};-acceptance(- "Discourse Assign | user menu | user cannot assign",- function (needs) {- needs.user({- can_assign: false,- });- needs.settings({- assign_enabled: true,- });+acceptance("user menu | user cannot assign", function (needs) {+ needs.user({+ can_assign: false,+ });+ needs.settings({+ assign_enabled: true,+ });- test("the assigns tab is not shown", async function (assert) {- await visit("/");- await click(".d-header-icons .current-user button");- assert.dom("#user-menu-button-assign-list").doesNotExist();- });- }-);--acceptance(- "Discourse Assign | user menu | assign_enabled setting is disabled",- function (needs) {- needs.user({- can_assign: false,- });- needs.settings({- assign_enabled: false,- });+ test("the assigns tab is not shown", async function (assert) {+ await visit("/");+ await click(".d-header-icons .current-user button");+ assert.dom("#user-menu-button-assign-list").doesNotExist();+ });+});- test("the assigns tab is not shown", async function (assert) {- await visit("/");- await click(".d-header-icons .current-user button");- assert.dom("#user-menu-button-assign-list").doesNotExist();- });- }-);+acceptance("user menu | assign_enabled setting is disabled", function (needs) {+ needs.user({+ can_assign: false,+ });+ needs.settings({+ assign_enabled: false,+ });++ test("the assigns tab is not shown", async function (assert) {+ await visit("/");+ await click(".d-header-icons .current-user button");+ assert.dom("#user-menu-button-assign-list").doesNotExist();+ });+});-acceptance("Discourse Assign | user menu", function (needs) {+acceptance("user menu", function (needs) {needs.user({can_assign: true,grouped_unread_notifications: {diff --git a/plugins/discourse-assign/test/javascripts/acceptance/category-test.js b/plugins/discourse-assign/test/javascripts/acceptance/category-test.jsindex d51513a9ca4..1218ca7c27d 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/category-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/category-test.js@@ -25,82 +25,70 @@ function stubCategory(needs, customFields) {});}-acceptance(- "Discourse Assign | Categories for users that can assign",- function (needs) {- needs.user({ can_assign: true });- needs.settings({- assign_enabled: true,- assigns_user_url_path: "/",- assigns_public: false,- });- stubCategory(needs, { enable_unassigned_filter: "true" });+acceptance("Categories for users that can assign", function (needs) {+ needs.user({ can_assign: true });+ needs.settings({+ assign_enabled: true,+ assigns_user_url_path: "/",+ assigns_public: false,+ });+ stubCategory(needs, { enable_unassigned_filter: "true" });- test("can see Unassigned button", async function (assert) {- await visit("/c/test");+ test("can see Unassigned button", async function (assert) {+ await visit("/c/test");- const title = i18n("filters.unassigned.help");- assert.dom(`#navigation-bar li[title='${title}']`).exists();- });- }-);+ const title = i18n("filters.unassigned.help");+ assert.dom(`#navigation-bar li[title='${title}']`).exists();+ });+});-acceptance(- "Discourse Assign | Categories without enable_unassigned_filter",- function (needs) {- needs.user();- needs.settings({- assign_enabled: true,- assigns_user_url_path: "/",- assigns_public: false,- });- stubCategory(needs, { enable_unassigned_filter: "false" });+acceptance("Categories without enable_unassigned_filter", function (needs) {+ needs.user();+ needs.settings({+ assign_enabled: true,+ assigns_user_url_path: "/",+ assigns_public: false,+ });+ stubCategory(needs, { enable_unassigned_filter: "false" });- test("cannot see Unassigned button", async function (assert) {- await visit("/c/test");+ test("cannot see Unassigned button", async function (assert) {+ await visit("/c/test");- const title = i18n("filters.unassigned.help");- assert.dom(`#navigation-bar li[title='${title}']`).doesNotExist();- });- }-);+ const title = i18n("filters.unassigned.help");+ assert.dom(`#navigation-bar li[title='${title}']`).doesNotExist();+ });+});-acceptance(- "Discourse Assign | Categories when assigns are public",- function (needs) {- needs.user();- needs.settings({- assign_enabled: true,- assigns_user_url_path: "/",- assigns_public: true,- });- stubCategory(needs, { enable_unassigned_filter: "true" });+acceptance("Categories when assigns are public", function (needs) {+ needs.user();+ needs.settings({+ assign_enabled: true,+ assigns_user_url_path: "/",+ assigns_public: true,+ });+ stubCategory(needs, { enable_unassigned_filter: "true" });- test("can see Unassigned button", async function (assert) {- await visit("/c/test");+ test("can see Unassigned button", async function (assert) {+ await visit("/c/test");- const title = i18n("filters.unassigned.help");- assert.dom(`#navigation-bar li[title='${title}']`).exists();- });- }-);+ const title = i18n("filters.unassigned.help");+ assert.dom(`#navigation-bar li[title='${title}']`).exists();+ });+});-acceptance(- "Discourse Assign | Categories when assigns are private",- function (needs) {- needs.user();- needs.settings({- assign_enabled: true,- assigns_user_url_path: "/",- assigns_public: false,- });- stubCategory(needs, { enable_unassigned_filter: "true" });+acceptance("Categories when assigns are private", function (needs) {+ needs.user();+ needs.settings({+ assign_enabled: true,+ assigns_user_url_path: "/",+ assigns_public: false,+ });+ stubCategory(needs, { enable_unassigned_filter: "true" });- test("cannot see Unassigned button", async function (assert) {- await visit("/c/test");+ test("cannot see Unassigned button", async function (assert) {+ await visit("/c/test");- const title = i18n("filters.unassigned.help");- assert.dom(`#navigation-bar li[title='${title}']`).doesNotExist();- });- }-);+ const title = i18n("filters.unassigned.help");+ assert.dom(`#navigation-bar li[title='${title}']`).doesNotExist();+ });+});diff --git a/plugins/discourse-assign/test/javascripts/acceptance/edit-assignments-modal-test.js b/plugins/discourse-assign/test/javascripts/acceptance/edit-assignments-modal-test.jsindex 3e63790ccec..6731b854b9f 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/edit-assignments-modal-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/edit-assignments-modal-test.js@@ -12,7 +12,7 @@ const secondReply = topic.post_stream.posts[2];const new_assignee_1 = "user_1";const new_assignee_2 = "user_2";-acceptance(`Discourse Assign | Edit assignments modal`, function (needs) {+acceptance("Edit assignments modal", function (needs) {needs.user({ can_assign: true });needs.settings({assign_enabled: true,diff --git a/plugins/discourse-assign/test/javascripts/acceptance/group-assignments-test.js b/plugins/discourse-assign/test/javascripts/acceptance/group-assignments-test.jsindex 4cee4466a36..ac8f7633d0f 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/group-assignments-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/group-assignments-test.js@@ -4,7 +4,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";import AssignedTopics from "../fixtures/assigned-group-assignments-fixtures";import GroupMembers from "../fixtures/group-members-fixtures";-acceptance("Discourse Assign | GroupAssignments", function (needs) {+acceptance("GroupAssignments", function (needs) {needs.user();needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });needs.pretender((server, helper) => {diff --git a/plugins/discourse-assign/test/javascripts/acceptance/never-track-assign-reason-test.js b/plugins/discourse-assign/test/javascripts/acceptance/never-track-assign-reason-test.jsindex b1dd3c84d88..dfe42d34a92 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/never-track-assign-reason-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/never-track-assign-reason-test.js@@ -7,65 +7,62 @@ import {updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";-acceptance(- "Discourse Assign | Never track topics assign reason",- function (needs) {- needs.user({ can_send_private_messages: true });- needs.settings({- assign_enabled: true,- assigns_user_url_path: "/",- });+acceptance("Never track topics assign reason", function (needs) {+ needs.user({ can_send_private_messages: true });+ needs.settings({+ assign_enabled: true,+ assigns_user_url_path: "/",+ });- needs.pretender((server, helper) => {- server.get("/t/44.json", () => {- let topic = cloneJSON(topicFixtures["/t/130.json"]);- topic.details.notifications_reason_id = 3;- return helper.response(topic);- });- server.get("/t/45.json", () => {- let topic = cloneJSON(topicFixtures["/t/28830/1.json"]);- topic["assigned_to_user"] = {- username: "eviltrout",- name: "Robin Ward",- avatar_template:- "/letter_avatar/eviltrout/{size}/3_f9720745f5ce6dfc2b5641fca999d934.png",- };- return helper.response(topic);- });- server.get("/t/46.json", () => {- let topic = cloneJSON(topicFixtures["/t/28830/1.json"]);- topic["assigned_to_group"] = {- id: 47,- name: "discourse",- };- return helper.response(topic);- });+ needs.pretender((server, helper) => {+ server.get("/t/44.json", () => {+ let topic = cloneJSON(topicFixtures["/t/130.json"]);+ topic.details.notifications_reason_id = 3;+ return helper.response(topic);+ });+ server.get("/t/45.json", () => {+ let topic = cloneJSON(topicFixtures["/t/28830/1.json"]);+ topic["assigned_to_user"] = {+ username: "eviltrout",+ name: "Robin Ward",+ avatar_template:+ "/letter_avatar/eviltrout/{size}/3_f9720745f5ce6dfc2b5641fca999d934.png",+ };+ return helper.response(topic);+ });+ server.get("/t/46.json", () => {+ let topic = cloneJSON(topicFixtures["/t/28830/1.json"]);+ topic["assigned_to_group"] = {+ id: 47,+ name: "discourse",+ };+ return helper.response(topic);});+ });- test("Show default assign reason when user tracks topics", async function (assert) {- updateCurrentUser({ never_auto_track_topics: false });+ test("Show default assign reason when user tracks topics", async function (assert) {+ updateCurrentUser({ never_auto_track_topics: false });- await visit("/t/assignment-topic/44");+ await visit("/t/assignment-topic/44");- assert- .dom(".topic-notifications-button .reason span.text")- .hasText(- "You will receive notifications because you are watching this topic."- );- });+ assert+ .dom(".topic-notifications-button .reason span.text")+ .hasText(+ "You will receive notifications because you are watching this topic."+ );+ });- test("Show user assign reason when user never tracks topics", async function (assert) {- updateCurrentUser({- never_auto_track_topics: true,- });+ test("Show user assign reason when user never tracks topics", async function (assert) {+ updateCurrentUser({+ never_auto_track_topics: true,+ });- await visit("/t/assignment-topic/45");+ await visit("/t/assignment-topic/45");- assert- .dom(".topic-notifications-button .reason span.text")- .hasText(- "You will see a count of new replies because this topic was assigned to you."- );- });- }-);+ assert+ .dom(".topic-notifications-button .reason span.text")+ .hasText(+ "You will see a count of new replies because this topic was assigned to you."+ );+ });+});diff --git a/plugins/discourse-assign/test/javascripts/acceptance/post-popup-menu-test.js b/plugins/discourse-assign/test/javascripts/acceptance/post-popup-menu-test.jsindex c8800e3deeb..961a2988e51 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/post-popup-menu-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/post-popup-menu-test.js@@ -26,7 +26,7 @@ const selectors = {const topic = topicWithAssignedPosts();const post = topic.post_stream.posts[1];-acceptance(`Discourse Assign | Post popup menu`, function (needs) {+acceptance("Post popup menu", function (needs) {needs.user();needs.settings({assign_enabled: true,diff --git a/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.js b/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.jsindex 54b11af0b73..8873eb8c99a 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";-acceptance("Discourse Assign | Search - Full Page", function (needs) {+acceptance("Search - Full Page", function (needs) {needs.settings({ assign_enabled: true });needs.user({ can_assign: true });needs.pretender((server, helper) => {diff --git a/plugins/discourse-assign/test/javascripts/acceptance/topic-level-assign-menu-test.js b/plugins/discourse-assign/test/javascripts/acceptance/topic-level-assign-menu-test.jsindex dd0954e8c42..28598af5eda 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/topic-level-assign-menu-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/topic-level-assign-menu-test.js@@ -10,7 +10,7 @@ import topicWithAssignedPosts from "../fixtures/topic-with-assigned-posts";const topic = topicWithAssignedPosts();const post = topic.post_stream.posts[1];-acceptance(`Discourse Assign | Topic level assign menu`, function (needs) {+acceptance("Topic level assign menu", function (needs) {needs.user();needs.settings({assign_enabled: true,diff --git a/plugins/discourse-assign/test/javascripts/acceptance/user-assignments-list-test.js b/plugins/discourse-assign/test/javascripts/acceptance/user-assignments-list-test.jsindex 4b31d80901e..ccfca6cabfb 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/user-assignments-list-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/user-assignments-list-test.js@@ -5,29 +5,26 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import AssignedTopics from "../fixtures/assigned-topics-fixtures";-acceptance(- "Discourse Assign | Unassign/reassign from the topics list",- function (needs) {- needs.user();- needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });- needs.pretender((server, helper) => {- const messagesPath = "/topics/messages-assigned/eviltrout.json";- server.get(messagesPath, () =>- helper.response(cloneJSON(AssignedTopics[messagesPath]))- );- });+acceptance("Unassign/reassign from the topics list", function (needs) {+ needs.user();+ needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });+ needs.pretender((server, helper) => {+ const messagesPath = "/topics/messages-assigned/eviltrout.json";+ server.get(messagesPath, () =>+ helper.response(cloneJSON(AssignedTopics[messagesPath]))+ );+ });- test("unassign/reassign options are visible", async function (assert) {- const options = selectKit(".assign-actions-dropdown");+ test("unassign/reassign options are visible", async function (assert) {+ const options = selectKit(".assign-actions-dropdown");- await visit("/u/eviltrout/activity/assigned");- await options.expand();+ await visit("/u/eviltrout/activity/assigned");+ await options.expand();- assert.dom("li[data-value='unassign']").exists({ count: 1 });- assert.dom("li[data-value='reassign']").exists({ count: 1 });- });- }-);+ assert.dom("li[data-value='unassign']").exists({ count: 1 });+ assert.dom("li[data-value='reassign']").exists({ count: 1 });+ });+});acceptance("Discourse Assign | A user doesn't have assignments",diff --git a/plugins/discourse-assign/test/javascripts/acceptance/user-private-messages-assigned-test.js b/plugins/discourse-assign/test/javascripts/acceptance/user-private-messages-assigned-test.jsindex aca9f3b76de..a9c9a56ee14 100644--- a/plugins/discourse-assign/test/javascripts/acceptance/user-private-messages-assigned-test.js+++ b/plugins/discourse-assign/test/javascripts/acceptance/user-private-messages-assigned-test.js@@ -8,7 +8,7 @@ import {import { i18n } from "discourse-i18n";import AssignedTopics from "../fixtures/assigned-topics-fixtures";-acceptance("Discourse Assign | User Private Messages", function (needs) {+acceptance("User Private Messages", function (needs) {needs.user({can_assign: true,});diff --git a/plugins/discourse-assign/test/javascripts/integration/components/group-assigned-filter-test.gjs b/plugins/discourse-assign/test/javascripts/integration/components/group-assigned-filter-test.gjsindex 894b3cb6ae2..1d185af49ae 100644--- a/plugins/discourse-assign/test/javascripts/integration/components/group-assigned-filter-test.gjs+++ b/plugins/discourse-assign/test/javascripts/integration/components/group-assigned-filter-test.gjs@@ -3,32 +3,29 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import GroupAssignedFilter from "discourse/plugins/discourse-assign/discourse/components/group-assigned-filter";-module(- "Discourse Assign | Integration | Component | group-assigned-filter",- function (hooks) {- setupRenderingTest(hooks);+module("Integration | Component | group-assigned-filter", function (hooks) {+ setupRenderingTest(hooks);- test("displays username and name", async function (assert) {- const filter = {- id: 2,- username: "Ahmed",- name: "Ahmed Gagan",- avatar_template: "/letter_avatar_proxy/v4/letter/a/8c91f0/{size}.png",- title: "trust_level_0",- last_posted_at: "2020-06-22T10:15:54.532Z",- last_seen_at: "2020-07-07T11:55:59.437Z",- added_at: "2020-06-22T09:55:31.692Z",- timezone: "Asia/Calcutta",- };+ test("displays username and name", async function (assert) {+ const filter = {+ id: 2,+ username: "Ahmed",+ name: "Ahmed Gagan",+ avatar_template: "/letter_avatar_proxy/v4/letter/a/8c91f0/{size}.png",+ title: "trust_level_0",+ last_posted_at: "2020-06-22T10:15:54.532Z",+ last_seen_at: "2020-07-07T11:55:59.437Z",+ added_at: "2020-06-22T09:55:31.692Z",+ timezone: "Asia/Calcutta",+ };- await render(- <template>- <GroupAssignedFilter @showAvatar={{true}} @filter={{filter}} />- </template>- );+ await render(+ <template>+ <GroupAssignedFilter @showAvatar={{true}} @filter={{filter}} />+ </template>+ );- assert.dom(".assign-username").hasText("Ahmed");- assert.dom(".assign-name").hasText("Ahmed Gagan");- });- }-);+ assert.dom(".assign-username").hasText("Ahmed");+ assert.dom(".assign-name").hasText("Ahmed Gagan");+ });+});diff --git a/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-disconnected-test.js b/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-disconnected-test.jsindex d2ae901665e..759e274e0dd 100644--- a/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-disconnected-test.js+++ b/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-disconnected-test.js@@ -2,7 +2,7 @@ import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Cakeday - disconnected", function (needs) {+acceptance("disconnected", function (needs) {needs.settings({cakeday_enabled: true,cakeday_emoji: "cake",diff --git a/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-sidebar-test.js b/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-sidebar-test.jsindex 2c7da1ebfa0..e0e9a5cf761 100644--- a/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-sidebar-test.js+++ b/plugins/discourse-cakeday/test/javascripts/acceptance/cakeday-sidebar-test.js@@ -6,7 +6,7 @@ import { i18n } from "discourse-i18n";import anniversariesFixtures from "../fixtures/anniversaries";import birthdaysFixtures from "../fixtures/birthdays";-acceptance("Cakeday - Sidebar with cakeday disabled", function (needs) {+acceptance("Sidebar with cakeday disabled", function (needs) {needs.user();needs.settings({@@ -40,7 +40,7 @@ acceptance("Cakeday - Sidebar with cakeday disabled", function (needs) {});});-acceptance("Cakeday - Sidebar with cakeday enabled", function (needs) {+acceptance("Sidebar with cakeday enabled", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/category-calendar-navigation-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/category-calendar-navigation-test.jsindex 40b81343734..62744014acb 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/category-calendar-navigation-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/category-calendar-navigation-test.js@@ -2,96 +2,90 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance(- "Discourse Calendar - Category Events Calendar Navigation",- function (needs) {- needs.user();- needs.settings({- calendar_enabled: true,- discourse_post_event_enabled: true,- events_calendar_categories: "1|2",- });+acceptance("Category Events Calendar Navigation", function (needs) {+ needs.user();+ needs.settings({+ calendar_enabled: true,+ discourse_post_event_enabled: true,+ events_calendar_categories: "1|2",+ });- let eventCalls = [];+ let eventCalls = [];- async function assertCategory(assert, { name, id, count = 1 }) {- eventCalls = [];- await visit(`/c/${name}/${id}`);+ async function assertCategory(assert, { name, id, count = 1 }) {+ eventCalls = [];+ await visit(`/c/${name}/${id}`);- if (count >= 1) {- assert.true(- eventCalls.some((call) => call.category_id === id),- `Fetched events for category ${id}`- );+ if (count >= 1) {+ assert.true(+ eventCalls.some((call) => call.category_id === id),+ `Fetched events for category ${id}`+ );- assert.strictEqual(- eventCalls.length,- count,- `Only ${count} events fetch after navigation`- );+ assert.strictEqual(+ eventCalls.length,+ count,+ `Only ${count} events fetch after navigation`+ );- assert.dom(".fc-event-title").hasText(`Event in Cat ${id}`);- } else {- assert.strictEqual(- eventCalls.length,- 0,- `No events fetch for category ${id}`- );+ assert.dom(".fc-event-title").hasText(`Event in Cat ${id}`);+ } else {+ assert.strictEqual(+ eventCalls.length,+ 0,+ `No events fetch for category ${id}`+ );- assert.dom(".fc-event-title").doesNotExist();- }+ assert.dom(".fc-event-title").doesNotExist();}+ }- needs.pretender((server, helper) => {- server.get("/discourse-post-event/events", (request) => {- eventCalls.push(request.queryParams);- const categoryId = request.queryParams.category_id;+ needs.pretender((server, helper) => {+ server.get("/discourse-post-event/events", (request) => {+ eventCalls.push(request.queryParams);+ const categoryId = request.queryParams.category_id;- return helper.response({- events: [- {- id: 100 + parseInt(categoryId, 10),- starts_at: moment().add(1, "days").toISOString(),- ends_at: moment().add(1, "days").add(1, "hours").toISOString(),- post: {- id: 200 + parseInt(categoryId, 10),- post_number: 1,- url: `/t/event-in-cat-${categoryId}/1/1`,- topic: {- id: 300 + parseInt(categoryId, 10),- title: `Event in Cat ${categoryId}`,- },+ return helper.response({+ events: [+ {+ id: 100 + parseInt(categoryId, 10),+ starts_at: moment().add(1, "days").toISOString(),+ ends_at: moment().add(1, "days").add(1, "hours").toISOString(),+ post: {+ id: 200 + parseInt(categoryId, 10),+ post_number: 1,+ url: `/t/event-in-cat-${categoryId}/1/1`,+ topic: {+ id: 300 + parseInt(categoryId, 10),+ title: `Event in Cat ${categoryId}`,},- name: `Event in Cat ${categoryId}`,- category_id: parseInt(categoryId, 10),- occurrences: [- {- starts_at: moment().add(1, "days").toISOString(),- ends_at: moment()- .add(1, "days")- .add(1, "hours")- .toISOString(),- },- ],},- ],- });+ name: `Event in Cat ${categoryId}`,+ category_id: parseInt(categoryId, 10),+ occurrences: [+ {+ starts_at: moment().add(1, "days").toISOString(),+ ends_at: moment().add(1, "days").add(1, "hours").toISOString(),+ },+ ],+ },+ ],});});+ });- test("reloads events when navigating between categories", async function (assert) {- await assertCategory(assert, { name: "bug", id: "1" });- await assertCategory(assert, { name: "feature", id: "2" });- });+ test("reloads events when navigating between categories", async function (assert) {+ await assertCategory(assert, { name: "bug", id: "1" });+ await assertCategory(assert, { name: "feature", id: "2" });+ });- test("it does not load events for non-calendar categories", async function (assert) {- await assertCategory(assert, { name: "dev", id: "7", count: 0 });- });+ test("it does not load events for non-calendar categories", async function (assert) {+ await assertCategory(assert, { name: "dev", id: "7", count: 0 });+ });- test("it loads events again when returning to a calendar category", async function (assert) {- await assertCategory(assert, { name: "bug", id: "1" });- await assertCategory(assert, { name: "dev", id: "7", count: 0 });- await assertCategory(assert, { name: "feature", id: "2" });- });- }-);+ test("it loads events again when returning to a calendar category", async function (assert) {+ await assertCategory(assert, { name: "bug", id: "1" });+ await assertCategory(assert, { name: "dev", id: "7", count: 0 });+ await assertCategory(assert, { name: "feature", id: "2" });+ });+});diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.jsindex 98c38c5b46d..d45f6ee1050 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-outlet-test.js@@ -32,64 +32,58 @@ const eventsPretender = (server, helper) => {});};-acceptance(- "Discourse Calendar - Category Events Calendar Outlet None",- function (needs) {- needs.user();- needs.settings({- calendar_enabled: true,- discourse_post_event_enabled: true,- events_calendar_categories: "1",- calendar_categories: "",- calendar_categories_outlet: "none",- });-- needs.pretender(eventsPretender);+acceptance("Category Events Calendar Outlet None", function (needs) {+ needs.user();+ needs.settings({+ calendar_enabled: true,+ discourse_post_event_enabled: true,+ events_calendar_categories: "1",+ calendar_categories: "",+ calendar_categories_outlet: "none",+ });- test("don't display calendars if outlet option is none", async function (assert) {- await visit("/c/bug/1");+ needs.pretender(eventsPretender);- assert- .dom("#category-events-calendar")- .doesNotExist("Category Events calendar div does not exist");+ test("don't display calendars if outlet option is none", async function (assert) {+ await visit("/c/bug/1");- assert- .dom(".category-calendar")- .doesNotExist("Category calendar div does not exist");- });- }-);+ assert+ .dom("#category-events-calendar")+ .doesNotExist("Category Events calendar div does not exist");-acceptance(- "Discourse Calendar - Category Events Calendar Outlet Container Top",- function (needs) {- needs.user();- needs.settings({- calendar_enabled: true,- discourse_post_event_enabled: true,- events_calendar_categories: "1",- calendar_categories: "",- calendar_categories_outlet: "discovery-list-container-top",- });+ assert+ .dom(".category-calendar")+ .doesNotExist("Category calendar div does not exist");+ });+});++acceptance("Category Events Calendar Outlet Container Top", function (needs) {+ needs.user();+ needs.settings({+ calendar_enabled: true,+ discourse_post_event_enabled: true,+ events_calendar_categories: "1",+ calendar_categories: "",+ calendar_categories_outlet: "discovery-list-container-top",+ });- needs.pretender(eventsPretender);+ needs.pretender(eventsPretender);- test("display the specific calendar for the discovery-list-container-top outlet", async function (assert) {- await visit("/c/bug/1");+ test("display the specific calendar for the discovery-list-container-top outlet", async function (assert) {+ await visit("/c/bug/1");- assert- .dom("#category-events-calendar")- .exists("Category Events calendar div exists");+ assert+ .dom("#category-events-calendar")+ .exists("Category Events calendar div exists");- assert- .dom(".category-calendar")- .doesNotExist("Category calendar div does not exist");- });- }-);+ assert+ .dom(".category-calendar")+ .doesNotExist("Category calendar div does not exist");+ });+});acceptance(- "Discourse Calendar - Category Events Calendar Outlet Container before-topic-list-body",+ "Category Events Calendar Outlet Container before-topic-list-body",function (needs) {needs.user();needs.settings({@@ -111,7 +105,7 @@ acceptance();acceptance(- "Discourse Calendar - Category Events Calendar Outlet Container discovery-list-container-top",+ "Category Events Calendar Outlet Container discovery-list-container-top",function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.jsindex cfbe9536868..3a2a9aeaeff 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/category-events-calendar-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import I18n from "discourse-i18n";-acceptance("Discourse Calendar - Category Events Calendar", function (needs) {+acceptance("Category Events Calendar", function (needs) {needs.user();needs.settings({calendar_enabled: true,diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/notifications-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/notifications-test.jsindex 1e925099e4f..184c3b787a2 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/notifications-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/notifications-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";-acceptance("Discourse Calendar - Notifications", function (needs) {+acceptance("Notifications", function (needs) {needs.user({ redesigned_user_menu_enabled: true });needs.settings({ calendar_enabled: true });diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/sidebar-upcoming-events-item-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/sidebar-upcoming-events-item-test.jsindex 02b1238e0ff..514e1a9b4d9 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/sidebar-upcoming-events-item-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/sidebar-upcoming-events-item-test.js@@ -2,7 +2,7 @@ import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Discourse Calendar - hamburger action shown", function (needs) {+acceptance("hamburger action shown", function (needs) {needs.user();needs.settings({@@ -26,7 +26,7 @@ acceptance("Discourse Calendar - hamburger action shown", function (needs) {});});-acceptance("Discourse Calendar - hamburger action hidden", function (needs) {+acceptance("hamburger action hidden", function (needs) {needs.user();needs.settings({calendar_enabled: true,@@ -42,7 +42,7 @@ acceptance("Discourse Calendar - hamburger action hidden", function (needs) {});});-acceptance("Discourse Calendar - sidebar link shown", function (needs) {+acceptance("sidebar link shown", function (needs) {needs.user();needs.settings({calendar_enabled: true,@@ -60,7 +60,7 @@ acceptance("Discourse Calendar - sidebar link shown", function (needs) {});});-acceptance("Discourse Calendar - sidebar link hidden", function (needs) {+acceptance("sidebar link hidden", function (needs) {needs.user();needs.settings({calendar_enabled: true,diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-events-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-events-test.jsindex 5d3f159cb6a..2bd47feec16 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-events-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-events-test.js@@ -4,7 +4,7 @@ import { acceptance, fakeTime } from "discourse/tests/helpers/qunit-helpers";import eventTopicFixture from "../helpers/event-topic-fixture";import getEventByText from "../helpers/get-event-by-text";-acceptance("Discourse Calendar - Topic Calendar Events", function (needs) {+acceptance("Topic Calendar Events", function (needs) {needs.hooks.beforeEach(function () {this.clock = fakeTime("2023-09-10T00:00:00", "Europe/Lisbon", true);});diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-holidays-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-holidays-test.jsindex 65b0eed2605..88d1ca6e649 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-holidays-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-holidays-test.js@@ -4,7 +4,7 @@ import { cloneJSON } from "discourse/lib/object";import { acceptance, fakeTime } from "discourse/tests/helpers/qunit-helpers";import eventTopicFixture from "../helpers/event-topic-fixture";-acceptance("Discourse Calendar - Topic Calendar Holidays", function (needs) {+acceptance("Topic Calendar Holidays", function (needs) {needs.hooks.beforeEach(function () {this.clock = fakeTime("2023-12-10T00:00:00", "America/Los_Angeles", true);});diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/topic-title-decorator-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/topic-title-decorator-test.jsindex 473a6173097..1bf33f8f326 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/topic-title-decorator-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/topic-title-decorator-test.js@@ -5,7 +5,7 @@ import { cloneJSON } from "discourse/lib/object";import discoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";-acceptance("Discourse Calendar - Event Title Decorator", function (needs) {+acceptance("Event Title Decorator", function (needs) {needs.user();needs.settings({calendar_enabled: true,diff --git a/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.js b/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.jsindex 6ff562ab94f..e326e391e82 100644--- a/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.js+++ b/plugins/discourse-calendar/test/javascripts/acceptance/upcoming-events-calendar-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { tomorrow } from "discourse/lib/time-utils";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Discourse Calendar - Upcoming Events Calendar", function (needs) {+acceptance("Upcoming Events Calendar", function (needs) {needs.site({categories: [{diff --git a/plugins/discourse-chat-integration/test/javascripts/acceptance/transcript-test.js b/plugins/discourse-chat-integration/test/javascripts/acceptance/transcript-test.jsindex 6768cd38abf..90dd969d267 100644--- a/plugins/discourse-chat-integration/test/javascripts/acceptance/transcript-test.js+++ b/plugins/discourse-chat-integration/test/javascripts/acceptance/transcript-test.js@@ -17,7 +17,7 @@ async function visitWithRedirects(url) {}}-acceptance("Chat Integration - slack transcript", function (needs) {+acceptance("slack transcript", function (needs) {needs.user({can_create_topic: true,});diff --git a/plugins/discourse-data-explorer/test/javascripts/acceptance/list-queries-test.js b/plugins/discourse-data-explorer/test/javascripts/acceptance/list-queries-test.jsindex 5f4f607130d..77ecff73818 100644--- a/plugins/discourse-data-explorer/test/javascripts/acceptance/list-queries-test.js+++ b/plugins/discourse-data-explorer/test/javascripts/acceptance/list-queries-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";-acceptance("Data Explorer Plugin | List Queries", function (needs) {+acceptance("List Queries", function (needs) {needs.user();needs.settings({ data_explorer_enabled: true });diff --git a/plugins/discourse-data-explorer/test/javascripts/acceptance/new-query-test.js b/plugins/discourse-data-explorer/test/javascripts/acceptance/new-query-test.jsindex 7b2f0db7a29..07f237891a1 100644--- a/plugins/discourse-data-explorer/test/javascripts/acceptance/new-query-test.js+++ b/plugins/discourse-data-explorer/test/javascripts/acceptance/new-query-test.js@@ -2,7 +2,7 @@ import { click, currentURL, fillIn, visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Data Explorer Plugin | New Query", function (needs) {+acceptance("New Query", function (needs) {needs.user();needs.settings({ data_explorer_enabled: true });diff --git a/plugins/discourse-data-explorer/test/javascripts/acceptance/param-input-test.js b/plugins/discourse-data-explorer/test/javascripts/acceptance/param-input-test.jsindex 56955bfa4e3..cd952c1f34f 100644--- a/plugins/discourse-data-explorer/test/javascripts/acceptance/param-input-test.js+++ b/plugins/discourse-data-explorer/test/javascripts/acceptance/param-input-test.js@@ -8,7 +8,7 @@ async function runQuery() {await click("form.query-run button");}-acceptance("Data Explorer Plugin | Param Input", function (needs) {+acceptance("Param Input", function (needs) {needs.user();needs.settings({ data_explorer_enabled: true });diff --git a/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.js b/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.jsindex 8dea6d536f4..83540df54af 100644--- a/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.js+++ b/plugins/discourse-data-explorer/test/javascripts/acceptance/run-query-test.js@@ -4,7 +4,7 @@ import sinon from "sinon";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";-acceptance("Data Explorer Plugin | Run Query", function (needs) {+acceptance("Run Query", function (needs) {needs.user();needs.settings({ data_explorer_enabled: true });diff --git a/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs b/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjsindex b12646ad742..210ac6ae580 100644--- a/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs+++ b/plugins/discourse-data-explorer/test/javascripts/components/explorer-schema-test.gjs@@ -36,7 +36,7 @@ const schema = {],};-module("Data Explorer Plugin | Component | explorer-schema", function (hooks) {+module("Component | explorer-schema", function (hooks) {setupRenderingTest(hooks);test("will automatically convert to lowercase", async function (assert) {diff --git a/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjs b/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjsindex 0eba0801782..7bb5dd34514 100644--- a/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjs+++ b/plugins/discourse-data-explorer/test/javascripts/components/param-input-test.gjs@@ -149,7 +149,7 @@ const InputTestCases = [},];-module("Data Explorer Plugin | Component | param-input", function (hooks) {+module("Component | param-input", function (hooks) {setupRenderingTest(hooks);for (const testcase of InputTestCases) {diff --git a/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjs b/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjsindex 0c18e69a9e0..509ac151bae 100644--- a/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjs+++ b/plugins/discourse-data-explorer/test/javascripts/integration/components/data-explorer-chart-test.gjs@@ -3,87 +3,84 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import DataExplorerChart from "../../discourse/components/data-explorer-chart";-module(- "Data Explorer Plugin | Integration | Component | data-explorer-chart",- function (hooks) {- setupRenderingTest(hooks);+module("Integration | Component | data-explorer-chart", function (hooks) {+ setupRenderingTest(hooks);- test("renders a bar chart with a single dataset", async function (assert) {- const labels = ["label_1", "label_2"];- const datasets = [{ label: "data", values: [115, 1000] }];+ test("renders a bar chart with a single dataset", async function (assert) {+ const labels = ["label_1", "label_2"];+ const datasets = [{ label: "data", values: [115, 1000] }];- await render(- <template>- <DataExplorerChart- @labels={{labels}}- @datasets={{datasets}}- @chartType="bar"- @stacked={{false}}- />- </template>- );+ await render(+ <template>+ <DataExplorerChart+ @labels={{labels}}+ @datasets={{datasets}}+ @chartType="bar"+ @stacked={{false}}+ />+ </template>+ );- assert.dom("canvas").exists("renders a canvas");- });+ assert.dom("canvas").exists("renders a canvas");+ });- test("renders a line chart", async function (assert) {- const labels = ["2024-01-01", "2024-01-02"];- const datasets = [{ label: "count", values: [10, 20] }];+ test("renders a line chart", async function (assert) {+ const labels = ["2024-01-01", "2024-01-02"];+ const datasets = [{ label: "count", values: [10, 20] }];- await render(- <template>- <DataExplorerChart- @labels={{labels}}- @datasets={{datasets}}- @chartType="line"- @stacked={{false}}- />- </template>- );+ await render(+ <template>+ <DataExplorerChart+ @labels={{labels}}+ @datasets={{datasets}}+ @chartType="line"+ @stacked={{false}}+ />+ </template>+ );- assert.dom("canvas").exists("renders a canvas for line chart");- });+ assert.dom("canvas").exists("renders a canvas for line chart");+ });- test("renders a multi-series chart", async function (assert) {- const labels = ["user1", "user2"];- const datasets = [- { label: "likes", values: [10, 20] },- { label: "posts", values: [5, 15] },- ];+ test("renders a multi-series chart", async function (assert) {+ const labels = ["user1", "user2"];+ const datasets = [+ { label: "likes", values: [10, 20] },+ { label: "posts", values: [5, 15] },+ ];- await render(- <template>- <DataExplorerChart- @labels={{labels}}- @datasets={{datasets}}- @chartType="bar"- @stacked={{false}}- />- </template>- );+ await render(+ <template>+ <DataExplorerChart+ @labels={{labels}}+ @datasets={{datasets}}+ @chartType="bar"+ @stacked={{false}}+ />+ </template>+ );- assert.dom("canvas").exists("renders a canvas for multi-series chart");- });+ assert.dom("canvas").exists("renders a canvas for multi-series chart");+ });- test("renders a stacked chart", async function (assert) {- const labels = ["2024-01-01", "2024-01-02"];- const datasets = [- { label: "likes", values: [10, 20] },- { label: "posts", values: [5, 15] },- ];+ test("renders a stacked chart", async function (assert) {+ const labels = ["2024-01-01", "2024-01-02"];+ const datasets = [+ { label: "likes", values: [10, 20] },+ { label: "posts", values: [5, 15] },+ ];- await render(- <template>- <DataExplorerChart- @labels={{labels}}- @datasets={{datasets}}- @chartType="bar"- @stacked={{true}}- />- </template>- );+ await render(+ <template>+ <DataExplorerChart+ @labels={{labels}}+ @datasets={{datasets}}+ @chartType="bar"+ @stacked={{true}}+ />+ </template>+ );- assert.dom("canvas").exists("renders a canvas for stacked chart");- });- }-);+ assert.dom("canvas").exists("renders a canvas for stacked chart");+ });+});diff --git a/plugins/discourse-data-explorer/test/javascripts/integration/components/query-result-test.gjs b/plugins/discourse-data-explorer/test/javascripts/integration/components/query-result-test.gjsindex 6abf892f0a2..fd02b90b094 100644--- a/plugins/discourse-data-explorer/test/javascripts/integration/components/query-result-test.gjs+++ b/plugins/discourse-data-explorer/test/javascripts/integration/components/query-result-test.gjs@@ -4,390 +4,374 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";import QueryResult from "../../discourse/components/query-result";-module(- "Data Explorer Plugin | Integration | Component | query-result",- function (hooks) {- setupRenderingTest(hooks);-- test("renders query results", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name", "like_count"],- rows: [- ["user1", 10],- ["user2", 20],+module("Integration | Component | query-result", function (hooks) {+ setupRenderingTest(hooks);++ test("renders query results", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name", "like_count"],+ rows: [+ ["user1", 10],+ ["user2", 20],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert+ .dom(+ ".result-info .query-result-download-buttons button:nth-child(1) span"+ )+ .hasText(i18n("explorer.download_json"), "renders the JSON button");++ assert+ .dom(+ ".result-info .query-result-download-buttons button:nth-child(2) span"+ )+ .hasText(i18n("explorer.download_csv"), "renders the CSV button");++ assert.dom("div.result-about").exists("renders a query summary");+ assert.dom("canvas").exists("renders the chart above the table");++ assert.dom("table thead tr th:nth-child(1)").hasText("user_name");+ assert.dom("table thead tr th:nth-child(2)").hasText("like_count");+ assert.dom("table tbody tr:nth-child(1) td:nth-child(1)").hasText("user1");+ assert.dom("table tbody tr:nth-child(1) td:nth-child(2)").hasText("10");+ assert.dom("table tbody tr:nth-child(2) td:nth-child(1)").hasText("user2");+ assert.dom("table tbody tr:nth-child(2) td:nth-child(2)").hasText("20");+ });++ test("renders badge names in query results", async function (assert) {+ const content = {+ colrender: { 0: "badge" },+ relations: {+ badge: [+ {+ description: "description",+ icon: "user",+ id: 1,+ name: "badge name",+ display_name: "badge display name",+ },],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert- .dom(- ".result-info .query-result-download-buttons button:nth-child(1) span"- )- .hasText(i18n("explorer.download_json"), "renders the JSON button");-- assert- .dom(- ".result-info .query-result-download-buttons button:nth-child(2) span"- )- .hasText(i18n("explorer.download_csv"), "renders the CSV button");-- assert.dom("div.result-about").exists("renders a query summary");- assert.dom("canvas").exists("renders the chart above the table");-- assert.dom("table thead tr th:nth-child(1)").hasText("user_name");- assert.dom("table thead tr th:nth-child(2)").hasText("like_count");- assert- .dom("table tbody tr:nth-child(1) td:nth-child(1)")- .hasText("user1");- assert.dom("table tbody tr:nth-child(1) td:nth-child(2)").hasText("10");- assert- .dom("table tbody tr:nth-child(2) td:nth-child(1)")- .hasText("user2");- assert.dom("table tbody tr:nth-child(2) td:nth-child(2)").hasText("20");- });-- test("renders badge names in query results", async function (assert) {- const content = {- colrender: { 0: "badge" },- relations: {- badge: [- {- description: "description",- icon: "user",- id: 1,- name: "badge name",- display_name: "badge display name",- },- ],- },- result_count: 1,- columns: ["badge_id"],- rows: [[1]],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert- .dom("table tbody tr:nth-child(1) td:nth-child(1) span")- .hasText("badge display name");- });-- test("renders a post in query results", async function (assert) {- const content = {- colrender: { 0: "post" },- relations: {- post: [- {- description: "description",- id: 1,- topic_id: 1,- post_number: 1,- excerpt: "foo",- username: "user1",- avatar_template: "",- },- ],- },- result_count: 1,- columns: [""],- rows: [[1]],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert- .dom("table tbody tr:nth-child(1) td:nth-child(1) aside")- .hasAttribute("data-post", "1");- assert- .dom("table tbody tr:nth-child(1) td:nth-child(1) aside")- .hasAttribute("data-topic", "1");- });-- test("renders a category_id in query results", async function (assert) {- const content = {- colrender: { 0: "category" },- relations: {- category: [- {- id: 1,- name: "foo",- slug: "foo",- topic_count: 0,- position: 1,- description: "a category",- can_edit: true,- },- ],- },- result_count: 1,- columns: [""],- rows: [[1]],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert- .dom(- "table tbody tr:nth-child(1) td:nth-child(1) .badge-category__name"- )- .exists();- });- }-);--module(- "Data Explorer Plugin | Integration | Component | query-result | chart",- function (hooks) {- setupRenderingTest(hooks);-- test("renders the chart above the table for chartable results", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name", "like_count"],- rows: [- ["user1", 10],- ["user2", 20],+ },+ result_count: 1,+ columns: ["badge_id"],+ rows: [[1]],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert+ .dom("table tbody tr:nth-child(1) td:nth-child(1) span")+ .hasText("badge display name");+ });++ test("renders a post in query results", async function (assert) {+ const content = {+ colrender: { 0: "post" },+ relations: {+ post: [+ {+ description: "description",+ id: 1,+ topic_id: 1,+ post_number: 1,+ excerpt: "foo",+ username: "user1",+ avatar_template: "",+ },],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").exists("the chart was rendered");- assert.dom("table").exists("the table was rendered");- assert- .dom(".query-results-modes")- .exists("the chart/table toggle buttons are rendered");- });-- test("renders a chart when data has two columns and numbers in the second column", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name", "like_count"],- rows: [- ["user1", 10],- ["user2", 20],+ },+ result_count: 1,+ columns: [""],+ rows: [[1]],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert+ .dom("table tbody tr:nth-child(1) td:nth-child(1) aside")+ .hasAttribute("data-post", "1");+ assert+ .dom("table tbody tr:nth-child(1) td:nth-child(1) aside")+ .hasAttribute("data-topic", "1");+ });++ test("renders a category_id in query results", async function (assert) {+ const content = {+ colrender: { 0: "category" },+ relations: {+ category: [+ {+ id: 1,+ name: "foo",+ slug: "foo",+ topic_count: 0,+ position: 1,+ description: "a category",+ can_edit: true,+ },],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").exists();- });-- test("doesn't render a chart when data contains identifiers in the second column", async function (assert) {- const content = {- colrender: { 1: "user" },- relations: {- user: [- { id: 1, username: "user1" },- { id: 2, username: "user2" },- ],- },- result_count: 2,- columns: ["topic_id", "user_id"],- rows: [- [1, 10],- [2, 20],+ },+ result_count: 1,+ columns: [""],+ rows: [[1]],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert+ .dom("table tbody tr:nth-child(1) td:nth-child(1) .badge-category__name")+ .exists();+ });+});++module("Integration | Component | query-result | chart", function (hooks) {+ setupRenderingTest(hooks);++ test("renders the chart above the table for chartable results", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name", "like_count"],+ rows: [+ ["user1", 10],+ ["user2", 20],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").exists("the chart was rendered");+ assert.dom("table").exists("the table was rendered");+ assert+ .dom(".query-results-modes")+ .exists("the chart/table toggle buttons are rendered");+ });++ test("renders a chart when data has two columns and numbers in the second column", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name", "like_count"],+ rows: [+ ["user1", 10],+ ["user2", 20],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").exists();+ });++ test("doesn't render a chart when data contains identifiers in the second column", async function (assert) {+ const content = {+ colrender: { 1: "user" },+ relations: {+ user: [+ { id: 1, username: "user1" },+ { id: 2, username: "user2" },],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").doesNotExist();- });-- test("doesn't render a chart when data contains one column", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name"],- rows: [["user1"], ["user2"]],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").doesNotExist();- });-- test("renders a chart when data contains multiple numeric columns", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name", "like_count", "post_count"],- rows: [- ["user1", 10, 1],- ["user2", 20, 2],- ],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").exists();- });-- test("doesn't render a chart when all non-label columns are relation types", async function (assert) {- const content = {- colrender: { 1: "user", 2: "badge" },- relations: {- user: [{ id: 1, username: "user1" }],- badge: [{ id: 1, name: "badge1" }],- },- result_count: 1,- columns: ["topic_id", "user_id", "badge_id"],- rows: [[1, 1, 1]],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").doesNotExist();- });-- test("renders a chart for date-based data", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["date", "count"],- rows: [- ["2024-01-01", 10],- ["2024-01-02", 20],- ],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").exists("renders a chart canvas");- });-- test("renders a multi-series chart", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name", "like_count", "post_count"],- rows: [- ["user1", 10, 5],- ["user2", 20, 15],- ],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").exists("renders a chart canvas for multi-series");- });-- test("doesn't render a chart when there are text columns alongside numeric columns", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["name", "value", "description"],- rows: [- ["item1", 10, "some text"],- ["item2", 20, "other text"],- ],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").doesNotExist();- });-- test("toggle buttons independently show and hide chart and table", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name", "like_count"],- rows: [- ["user1", 10],- ["user2", 20],- ],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("canvas").exists("chart is visible by default");- assert.dom("table").exists("table is visible by default");-- await click(".query-results-modes .btn:first-child");- assert.dom("canvas").doesNotExist("chart is hidden after toggle");- assert.dom("table").exists("table remains visible");-- await click(".query-results-modes .btn:last-child");- assert.dom("canvas").doesNotExist("chart stays hidden");- assert.dom("table").doesNotExist("table is hidden after toggle");-- await click(".query-results-modes .btn:first-child");- assert.dom("canvas").exists("chart is visible again");- assert.dom("table").doesNotExist("table stays hidden");- });-- test("persists toggle state per query in localStorage", async function (assert) {- const query = { id: 42 };- const content = {- colrender: [],- result_count: 2,- columns: ["user_name", "like_count"],- rows: [- ["user1", 10],- ["user2", 20],- ],- };-- await render(- <template>- <QueryResult @content={{content}} @query={{query}} />- </template>- );-- assert.dom(".query-results-chart").exists("chart is visible by default");- assert.dom(".query-results-table").exists("table is visible by default");-- await click(".btn-toggle-chart");- assert- .dom(".query-results-chart")- .doesNotExist("chart is hidden after toggle");-- await render(- <template>- <QueryResult @content={{content}} @query={{query}} />- </template>- );-- assert- .dom(".query-results-chart")- .doesNotExist("chart state is restored from localStorage");- assert- .dom(".query-results-table")- .exists("table state is restored from localStorage");- });-- test("toggle buttons are not shown for non-chartable data", async function (assert) {- const content = {- colrender: [],- result_count: 2,- columns: ["user_name"],- rows: [["user1"], ["user2"]],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom(".query-results-modes").doesNotExist();- });-- test("handles no results", async function (assert) {- const content = {- colrender: [],- result_count: 0,- columns: ["user_name", "like_count", "post_count"],- rows: [],- };-- await render(<template><QueryResult @content={{content}} /></template>);-- assert.dom("table tbody tr").doesNotExist("renders no results");- });- }-);+ },+ result_count: 2,+ columns: ["topic_id", "user_id"],+ rows: [+ [1, 10],+ [2, 20],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").doesNotExist();+ });++ test("doesn't render a chart when data contains one column", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name"],+ rows: [["user1"], ["user2"]],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").doesNotExist();+ });++ test("renders a chart when data contains multiple numeric columns", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name", "like_count", "post_count"],+ rows: [+ ["user1", 10, 1],+ ["user2", 20, 2],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").exists();+ });++ test("doesn't render a chart when all non-label columns are relation types", async function (assert) {+ const content = {+ colrender: { 1: "user", 2: "badge" },+ relations: {+ user: [{ id: 1, username: "user1" }],+ badge: [{ id: 1, name: "badge1" }],+ },+ result_count: 1,+ columns: ["topic_id", "user_id", "badge_id"],+ rows: [[1, 1, 1]],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").doesNotExist();+ });++ test("renders a chart for date-based data", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["date", "count"],+ rows: [+ ["2024-01-01", 10],+ ["2024-01-02", 20],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").exists("renders a chart canvas");+ });++ test("renders a multi-series chart", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name", "like_count", "post_count"],+ rows: [+ ["user1", 10, 5],+ ["user2", 20, 15],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").exists("renders a chart canvas for multi-series");+ });++ test("doesn't render a chart when there are text columns alongside numeric columns", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["name", "value", "description"],+ rows: [+ ["item1", 10, "some text"],+ ["item2", 20, "other text"],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").doesNotExist();+ });++ test("toggle buttons independently show and hide chart and table", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name", "like_count"],+ rows: [+ ["user1", 10],+ ["user2", 20],+ ],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("canvas").exists("chart is visible by default");+ assert.dom("table").exists("table is visible by default");++ await click(".query-results-modes .btn:first-child");+ assert.dom("canvas").doesNotExist("chart is hidden after toggle");+ assert.dom("table").exists("table remains visible");++ await click(".query-results-modes .btn:last-child");+ assert.dom("canvas").doesNotExist("chart stays hidden");+ assert.dom("table").doesNotExist("table is hidden after toggle");++ await click(".query-results-modes .btn:first-child");+ assert.dom("canvas").exists("chart is visible again");+ assert.dom("table").doesNotExist("table stays hidden");+ });++ test("persists toggle state per query in localStorage", async function (assert) {+ const query = { id: 42 };+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name", "like_count"],+ rows: [+ ["user1", 10],+ ["user2", 20],+ ],+ };++ await render(+ <template><QueryResult @content={{content}} @query={{query}} /></template>+ );++ assert.dom(".query-results-chart").exists("chart is visible by default");+ assert.dom(".query-results-table").exists("table is visible by default");++ await click(".btn-toggle-chart");+ assert+ .dom(".query-results-chart")+ .doesNotExist("chart is hidden after toggle");++ await render(+ <template><QueryResult @content={{content}} @query={{query}} /></template>+ );++ assert+ .dom(".query-results-chart")+ .doesNotExist("chart state is restored from localStorage");+ assert+ .dom(".query-results-table")+ .exists("table state is restored from localStorage");+ });++ test("toggle buttons are not shown for non-chartable data", async function (assert) {+ const content = {+ colrender: [],+ result_count: 2,+ columns: ["user_name"],+ rows: [["user1"], ["user2"]],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom(".query-results-modes").doesNotExist();+ });++ test("handles no results", async function (assert) {+ const content = {+ colrender: [],+ result_count: 0,+ columns: ["user_name", "like_count", "post_count"],+ rows: [],+ };++ await render(<template><QueryResult @content={{content}} /></template>);++ assert.dom("table tbody tr").doesNotExist("renders no results");+ });+});diff --git a/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjs b/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjsindex 7e7d8f16af0..9c9bf4a7dd7 100644--- a/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjs+++ b/plugins/discourse-lazy-videos/test/javascripts/components/lazy-video-test.gjs@@ -3,7 +3,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import LazyVideo from "../discourse/components/lazy-video";-module("Discourse Lazy Videos | Component | lazy-video", function (hooks) {+module("Component | lazy-video", function (hooks) {setupRenderingTest(hooks);this.attributes = {diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-test.jsindex 608f395911c..5b77baccf94 100644--- a/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-test.js+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-test.js@@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";acceptance(- "Local Dates - Download calendar without default calendar option set",+ "Download calendar without default calendar option set",function (needs) {needs.user({ "user_option.default_calendar": "none_selected" });needs.settings({ discourse_local_dates_enabled: true });@@ -39,40 +39,37 @@ acceptance(});-acceptance(- "Local Dates - Download calendar as an anonymous user",- function (needs) {- needs.settings({ discourse_local_dates_enabled: true });- needs.pretender((server, helper) => {- const response = cloneJSON(fixturesByUrl["/t/281.json"]);- const startDate = moment- .tz("America/Lima")- .add(1, "days")- .format("YYYY-MM-DD");- response.post_stream.posts[0].cooked = `<p><span data-date=\"${startDate}\" data-time=\"13:00:00\" class=\"discourse-local-date\" data-timezone=\"America/Lima\" data-email-preview=\"${startDate}T18:00:00Z UTC\">${startDate}T18:00:00Z</span></p>`;-- server.get("/t/281.json", () => helper.response(response));- });-- test("Display pick calendar modal", async function (assert) {- await visit("/t/local-dates/281");- await click(".discourse-local-date");- await click(".download-calendar");-- assert- .dom("#discourse-modal-title")- .hasText(- i18n("download_calendar.title"),- "it should display modal to select calendar"- );-- assert.dom(".control-group.remember").doesNotExist();- });- }-);+acceptance("Download calendar as an anonymous user", function (needs) {+ needs.settings({ discourse_local_dates_enabled: true });+ needs.pretender((server, helper) => {+ const response = cloneJSON(fixturesByUrl["/t/281.json"]);+ const startDate = moment+ .tz("America/Lima")+ .add(1, "days")+ .format("YYYY-MM-DD");+ response.post_stream.posts[0].cooked = `<p><span data-date=\"${startDate}\" data-time=\"13:00:00\" class=\"discourse-local-date\" data-timezone=\"America/Lima\" data-email-preview=\"${startDate}T18:00:00Z UTC\">${startDate}T18:00:00Z</span></p>`;++ server.get("/t/281.json", () => helper.response(response));+ });++ test("Display pick calendar modal", async function (assert) {+ await visit("/t/local-dates/281");+ await click(".discourse-local-date");+ await click(".download-calendar");++ assert+ .dom("#discourse-modal-title")+ .hasText(+ i18n("download_calendar.title"),+ "it should display modal to select calendar"+ );++ assert.dom(".control-group.remember").doesNotExist();+ });+});acceptance(- "Local Dates - Download calendar is not available for dates in the past",+ "Download calendar is not available for dates in the past",function (needs) {needs.user({ "user_option.default_calendar": "none_selected" });needs.settings({ discourse_local_dates_enabled: true });@@ -98,7 +95,7 @@ acceptance();acceptance(- "Local Dates - Download calendar with default calendar option set",+ "Download calendar with default calendar option set",function (needs) {needs.user({ "user_option.default_calendar": "google" });needs.settings({ discourse_local_dates_enabled: true });diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-with-ics-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-with-ics-test.jsindex ee734bc4219..46f167e7ff8 100644--- a/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-with-ics-test.js+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/download-calendar-with-ics-test.js@@ -5,20 +5,18 @@ import { cloneJSON } from "discourse/lib/object";import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance(- "Local Dates - Download calendar with embedded ICS data",- function (needs) {- needs.user({ "user_option.default_calendar": "none_selected" });- needs.settings({ discourse_local_dates_enabled: true });- needs.pretender((server, helper) => {- const response = cloneJSON(fixturesByUrl["/t/281.json"]);- const startDate = moment- .tz("America/Lima")- .add(1, "days")- .format("YYYY-MM-DD");+acceptance("Download calendar with embedded ICS data", function (needs) {+ needs.user({ "user_option.default_calendar": "none_selected" });+ needs.settings({ discourse_local_dates_enabled: true });+ needs.pretender((server, helper) => {+ const response = cloneJSON(fixturesByUrl["/t/281.json"]);+ const startDate = moment+ .tz("America/Lima")+ .add(1, "days")+ .format("YYYY-MM-DD");- // Create sample ICS data- const icsData = `BEGIN:VCALENDAR+ // Create sample ICS data+ const icsData = `BEGIN:VCALENDARVERSION:2.0PRODID:-//Discourse//ENBEGIN:VEVENT@@ -32,47 +30,46 @@ DESCRIPTION:Test DescriptionEND:VEVENTEND:VCALENDAR`;- // Use shared helper to encode ICS payload for data-ics attribute- const base64url = bbcodeAttributeEncode(icsData);+ // Use shared helper to encode ICS payload for data-ics attribute+ const base64url = bbcodeAttributeEncode(icsData);- response.post_stream.posts[0].cooked = `<p><span data-date="${startDate}" data-time="13:00:00" class="discourse-local-date" data-timezone="America/Lima" data-ics="${base64url}" data-email-preview="${startDate}T18:00:00Z UTC">${startDate}T18:00:00Z</span></p>`;+ response.post_stream.posts[0].cooked = `<p><span data-date="${startDate}" data-time="13:00:00" class="discourse-local-date" data-timezone="America/Lima" data-ics="${base64url}" data-email-preview="${startDate}T18:00:00Z UTC">${startDate}T18:00:00Z</span></p>`;- server.get("/t/281.json", () => helper.response(response));- });+ server.get("/t/281.json", () => helper.response(response));+ });- test("Downloads ICS file with embedded data", async function (assert) {- await visit("/t/local-dates/281");- await click(".discourse-local-date");+ test("Downloads ICS file with embedded data", async function (assert) {+ await visit("/t/local-dates/281");+ await click(".discourse-local-date");- assert- .dom(".download-calendar")- .exists("download calendar button is present");+ assert+ .dom(".download-calendar")+ .exists("download calendar button is present");- // We can't fully test the download without mocking File/Blob APIs- // but we can verify the button has the data-ics attribute- const downloadButton = document.querySelector(".download-calendar");- assert.true(- !!downloadButton.dataset.ics,- "download button has data-ics attribute"- );- assert.true(- downloadButton.dataset.ics.length > 0,- "data-ics attribute is not empty"- );- assert.false(- downloadButton.dataset.ics.includes("+"),- "data-ics uses base64url encoding (no +)"- );- assert.false(- downloadButton.dataset.ics.includes("/"),- "data-ics uses base64url encoding (no /)"- );- });- }-);+ // We can't fully test the download without mocking File/Blob APIs+ // but we can verify the button has the data-ics attribute+ const downloadButton = document.querySelector(".download-calendar");+ assert.true(+ !!downloadButton.dataset.ics,+ "download button has data-ics attribute"+ );+ assert.true(+ downloadButton.dataset.ics.length > 0,+ "data-ics attribute is not empty"+ );+ assert.false(+ downloadButton.dataset.ics.includes("+"),+ "data-ics uses base64url encoding (no +)"+ );+ assert.false(+ downloadButton.dataset.ics.includes("/"),+ "data-ics uses base64url encoding (no /)"+ );+ });+});acceptance(- "Local Dates - Falls back to default ICS generation without embedded data",+ "Falls back to default ICS generation without embedded data",function (needs) {needs.user({ "user_option.default_calendar": "none_selected" });needs.settings({ discourse_local_dates_enabled: true });diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.jsindex 37e26c1d69a..be8eaf1ddd1 100644--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js@@ -6,7 +6,7 @@ import {} from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";-acceptance("Local Dates - composer", function (needs) {+acceptance("composer", function (needs) {needs.user();needs.settings({discourse_local_dates_enabled: true,diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-quoting-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-quoting-test.jsindex 2d2772f824a..6ee43804ff5 100644--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-quoting-test.js+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-quoting-test.js@@ -4,7 +4,7 @@ import { cloneJSON } from "discourse/lib/object";import topicFixtures from "discourse/tests/fixtures/topic";import { acceptance, selectText } from "discourse/tests/helpers/qunit-helpers";-acceptance("Local Dates - quoting", function (needs) {+acceptance("quoting", function (needs) {needs.user();needs.settings({ discourse_local_dates_enabled: true });@@ -55,7 +55,7 @@ This is a test [date=2022-06-17 time=10:00:00 timezone=Australia/Brisbane displa});});-acceptance("Local Dates - quoting range", function (needs) {+acceptance("quoting range", function (needs) {needs.user();needs.settings({ discourse_local_dates_enabled: true });@@ -96,16 +96,14 @@ Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format=LL});});-acceptance(- "Local Dates - quoting with recurring and countdown",- function (needs) {- needs.user();- needs.settings({ discourse_local_dates_enabled: true });+acceptance("quoting with recurring and countdown", function (needs) {+ needs.user();+ needs.settings({ discourse_local_dates_enabled: true });- needs.pretender((server, helper) => {- const topicResponse = cloneJSON(topicFixtures["/t/280/1.json"]);- const firstPost = topicResponse.post_stream.posts[0];- firstPost.cooked += `<div class='select-local-date-test'><p dir="ltr">Testing countdown <span data-date="2022-06-21" data-time="09:30:00" class="discourse-local-date cooked-date" data-format="LL" data-countdown="true" data-timezone="Australia/Brisbane" data-email-preview="2022-06-20T23:30:00Z UTC" aria-label="Brisbane Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 9:30 AM, Paris Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:30 AM, Los Angeles Monday, June 20, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 4:30 PM" data-title="This is a new topic to check on chat quote issues">+ needs.pretender((server, helper) => {+ const topicResponse = cloneJSON(topicFixtures["/t/280/1.json"]);+ const firstPost = topicResponse.post_stream.posts[0];+ firstPost.cooked += `<div class='select-local-date-test'><p dir="ltr">Testing countdown <span data-date="2022-06-21" data-time="09:30:00" class="discourse-local-date cooked-date" data-format="LL" data-countdown="true" data-timezone="Australia/Brisbane" data-email-preview="2022-06-20T23:30:00Z UTC" aria-label="Brisbane Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 9:30 AM, Paris Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:30 AM, Los Angeles Monday, June 20, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 4:30 PM" data-title="This is a new topic to check on chat quote issues"><svg class="fa d-icon d-icon-earth-americas svg-icon" xmlns="http://www.w3.org/2000/svg"><use href="#earth-americas"></use></svg>@@ -118,27 +116,26 @@ acceptance(<span class="relative-time">Wednesday</span></span></p></div>`;- server.get("/t/280.json", () => helper.response(topicResponse));- server.get("/drafts/topic_280.json", () => {- return helper.response({});- });- server.get("/t/280/:post_number.json", () => {- helper.response(topicResponse);- });+ server.get("/t/280.json", () => helper.response(topicResponse));+ server.get("/drafts/topic_280.json", () => {+ return helper.response({});+ });+ server.get("/t/280/:post_number.json", () => {+ helper.response(topicResponse);});+ });- test("quoting single local dates with recurring and countdown options", async function (assert) {- await visit("/t/internationalization-localization/280");- await selectText("#post_1 .select-local-date-test");- await click(".insert-quote");- assert.dom(".d-editor-input").hasValue(- `[quote=\"uwe_keim, post:1, topic:280\"]+ test("quoting single local dates with recurring and countdown options", async function (assert) {+ await visit("/t/internationalization-localization/280");+ await selectText("#post_1 .select-local-date-test");+ await click(".insert-quote");+ assert.dom(".d-editor-input").hasValue(+ `[quote=\"uwe_keim, post:1, topic:280\"]Testing countdown [date=2022-06-21 time=09:30:00 format=LL timezone=Australia/Brisbane countdown=true]Testing recurring [date=2022-06-22 timezone=Australia/Brisbane recurring=2.weeks][/quote]\n\n`,- "converts the dates to markdown with all options correctly"- );- });- }-);+ "converts the dates to markdown with all options correctly"+ );+ });+});diff --git a/plugins/discourse-math/test/javascripts/acceptance/math-composer-test.js b/plugins/discourse-math/test/javascripts/acceptance/math-composer-test.jsindex c7353ede089..6696b1812e2 100644--- a/plugins/discourse-math/test/javascripts/acceptance/math-composer-test.js+++ b/plugins/discourse-math/test/javascripts/acceptance/math-composer-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";-acceptance("Discourse Math - composer", function (needs) {+acceptance("composer", function (needs) {needs.user();needs.settings({discourse_math_enabled: true,diff --git a/plugins/discourse-policy/test/javascripts/acceptance/policy-test.js b/plugins/discourse-policy/test/javascripts/acceptance/policy-test.jsindex 21742b6118d..d8e5cd68703 100644--- a/plugins/discourse-policy/test/javascripts/acceptance/policy-test.js+++ b/plugins/discourse-policy/test/javascripts/acceptance/policy-test.js@@ -14,7 +14,7 @@ import {import selectKit from "discourse/tests/helpers/select-kit-helper";import { i18n } from "discourse-i18n";-acceptance("Discourse Policy - post", function (needs) {+acceptance("post", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.js b/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.jsindex f2c01aafc2c..99e17f09050 100644--- a/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.js+++ b/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.js@@ -8,7 +8,7 @@ import { i18n } from "discourse-i18n";let createAsPostVotingSetInRequest = false;-acceptance("Discourse Post Voting - composer", function (needs) {+acceptance("composer", function (needs) {needs.user();needs.settings({ post_voting_enabled: true });diff --git a/plugins/discourse-post-voting/test/javascripts/acceptance/notifications-test.js b/plugins/discourse-post-voting/test/javascripts/acceptance/notifications-test.jsindex aaf4aa4023a..513bbf3ee9b 100644--- a/plugins/discourse-post-voting/test/javascripts/acceptance/notifications-test.js+++ b/plugins/discourse-post-voting/test/javascripts/acceptance/notifications-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";-acceptance("Discourse Post Voting - notifications", function (needs) {+acceptance("notifications", function (needs) {needs.user();needs.settings({ post_voting_enabled: true });diff --git a/plugins/discourse-post-voting/test/javascripts/acceptance/post-voting-test.js b/plugins/discourse-post-voting/test/javascripts/acceptance/post-voting-test.jsindex 80796d91a90..6153e644ec7 100644--- a/plugins/discourse-post-voting/test/javascripts/acceptance/post-voting-test.js+++ b/plugins/discourse-post-voting/test/javascripts/acceptance/post-voting-test.js@@ -207,7 +207,7 @@ function setupPostVoting(needs) {});}-acceptance(`Discourse Post Voting - anon user`, function (needs) {+acceptance("anon user", function (needs) {setupPostVoting(needs);test("Viewing comments", async function (assert) {@@ -262,7 +262,7 @@ acceptance(`Discourse Post Voting - anon user`, function (needs) {});});-acceptance(`Discourse Post Voting - logged in user`, function (needs) {+acceptance("logged in user", function (needs) {setupPostVoting(needs);needs.user();diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.jsindex e1e7b6da0d6..5039772dfaf 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/deleted-post-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance("Discourse Reactions - Deleted post", function (needs) {+acceptance("Deleted post", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-archived-topic-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-archived-topic-test.jsindex 370d4967073..93f055096db 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-archived-topic-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-archived-topic-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance(`Discourse Reactions - Archived topic`, function (needs) {+acceptance("Archived topic", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.jsindex acca2338668..941fd8a41fc 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance(`Discourse Reactions - Custom Emoji Picker`, function (needs) {+acceptance("Custom Emoji Picker", function (needs) {needs.user();needs.settings({@@ -92,56 +92,53 @@ acceptance(`Discourse Reactions - Custom Emoji Picker`, function (needs) {});});-acceptance(- `Discourse Reactions - Custom Emoji Picker Disabled`,- function (needs) {- needs.user();-- needs.settings({- discourse_reactions_enabled: true,- discourse_reactions_enabled_reactions: "otter|open_mouth|heart",- discourse_reactions_reaction_for_like: "heart",- discourse_reactions_like_icon: "heart",- discourse_reactions_allow_any_emoji: false,- });+acceptance("Custom Emoji Picker Disabled", function (needs) {+ needs.user();- needs.pretender((server, helper) => {- const topicPath = "/t/374.json";- server.get(topicPath, () => helper.response(ReactionsTopics[topicPath]));+ needs.settings({+ discourse_reactions_enabled: true,+ discourse_reactions_enabled_reactions: "otter|open_mouth|heart",+ discourse_reactions_reaction_for_like: "heart",+ discourse_reactions_like_icon: "heart",+ discourse_reactions_allow_any_emoji: false,+ });- server.put(- "/discourse-reactions/posts/:post_id/custom-reactions/:reaction/toggle.json",- () => helper.response({ success: "OK" })- );- });+ needs.pretender((server, helper) => {+ const topicPath = "/t/374.json";+ server.get(topicPath, () => helper.response(ReactionsTopics[topicPath]));- test("Does not show EmojiPicker button when discourse_reactions_allow_any_emoji is disabled", async function (assert) {- await visit("/t/topic_with_reactions_and_likes/374");- await triggerEvent(- "#post_2 button.btn-toggle-reaction-like",- "pointerover",- { pointerType: "mouse" }- );+ server.put(+ "/discourse-reactions/posts/:post_id/custom-reactions/:reaction/toggle.json",+ () => helper.response({ success: "OK" })+ );+ });- assert- .dom(".emoji-picker-trigger")- .doesNotExist(- "EmojiPicker button does not exist when setting is disabled"- );- });+ test("Does not show EmojiPicker button when discourse_reactions_allow_any_emoji is disabled", async function (assert) {+ await visit("/t/topic_with_reactions_and_likes/374");+ await triggerEvent(+ "#post_2 button.btn-toggle-reaction-like",+ "pointerover",+ { pointerType: "mouse" }+ );- test("Reactions picker grid only counts enabled reactions when EmojiPicker is disabled", async function (assert) {- await visit("/t/topic_with_reactions_and_likes/374");- await triggerEvent(- "#post_2 button.btn-toggle-reaction-like",- "pointerover",- { pointerType: "mouse" }+ assert+ .dom(".emoji-picker-trigger")+ .doesNotExist(+ "EmojiPicker button does not exist when setting is disabled");+ });- // With 3 enabled reactions and no emoji picker button = 3 total- assert- .dom(".discourse-reactions-picker-container")- .hasClass("col-3", "Grid has 3 columns without EmojiPicker button");- });- }-);+ test("Reactions picker grid only counts enabled reactions when EmojiPicker is disabled", async function (assert) {+ await visit("/t/topic_with_reactions_and_likes/374");+ await triggerEvent(+ "#post_2 button.btn-toggle-reaction-like",+ "pointerover",+ { pointerType: "mouse" }+ );++ // With 3 enabled reactions and no emoji picker button = 3 total+ assert+ .dom(".discourse-reactions-picker-container")+ .hasClass("col-3", "Grid has 3 columns without EmojiPicker button");+ });+});diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.jsindex ad6efa3958f..ae4ef52ef7f 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-disabled-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance(`Discourse Reactions - Disabled`, function (needs) {+acceptance("Disabled", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.jsindex a85e62764a2..2e22221b767 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-enabled-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance(`Discourse Reactions - Enabled`, function (needs) {+acceptance("Enabled", function (needs) {needs.user();needs.settings({@@ -27,7 +27,7 @@ acceptance(`Discourse Reactions - Enabled`, function (needs) {});});-acceptance(`Discourse Reactions - Enabled | Anonymous user`, function (needs) {+acceptance("Enabled | Anonymous user", function (needs) {needs.settings({discourse_reactions_enabled: true,discourse_reactions_enabled_reactions: "otter|open_mouth",diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-icon-aliases-test.gjs b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-icon-aliases-test.gjsindex d1e448fb57e..112ff50d1ae 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-icon-aliases-test.gjs+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-icon-aliases-test.gjs@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance(`Discourse Reactions - Icon Aliases`, function (needs) {+acceptance("Icon Aliases", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.jsindex 3f6f5d3cb4d..e10ea756f92 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-notifications-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";-acceptance("Discourse Reactions - Notifications", function (needs) {+acceptance("Notifications", function (needs) {needs.user();needs.settings({@@ -243,90 +243,87 @@ acceptance("Discourse Reactions - Notifications", function (needs) {});});-acceptance(- "Discourse Reactions - Notifications | Full Name Setting On",- function (needs) {- needs.user();+acceptance("Notifications | Full Name Setting On", function (needs) {+ needs.user();- needs.settings({- discourse_reactions_enabled: true,- discourse_reactions_enabled_reactions: "otter|open_mouth",- discourse_reactions_reaction_for_like: "heart",- discourse_reactions_like_icon: "heart",- prioritize_full_name_in_ux: true,- });+ needs.settings({+ discourse_reactions_enabled: true,+ discourse_reactions_enabled_reactions: "otter|open_mouth",+ discourse_reactions_reaction_for_like: "heart",+ discourse_reactions_like_icon: "heart",+ prioritize_full_name_in_ux: true,+ });- needs.pretender((server, helper) => {- server.get("/notifications", () => {- return helper.response({- notifications: [- {- id: 842,- user_id: 88,- notification_type: 25,- read: true,- high_priority: false,- created_at: "2021-08-19T23:00:11.166Z",- post_number: 3,- topic_id: 138,- fancy_title: "Topic with 2 likes (total) from 2 users",- slug: "topic-with-2-likes-total-from-2-users",- data: {- topic_title: "Topic with 2 likes (total) from 2 users",- original_post_id: 443,- original_post_type: 1,- original_username: "jammed-radio",- revision_number: null,- display_username: "jammed-radio",- display_name: "Bruce Wayne I",- previous_notification_id: 933,- username2: "broken-radio",- name2: "Brucer Wayner II",- reaction_icon: "heart",- count: 2,- },+ needs.pretender((server, helper) => {+ server.get("/notifications", () => {+ return helper.response({+ notifications: [+ {+ id: 842,+ user_id: 88,+ notification_type: 25,+ read: true,+ high_priority: false,+ created_at: "2021-08-19T23:00:11.166Z",+ post_number: 3,+ topic_id: 138,+ fancy_title: "Topic with 2 likes (total) from 2 users",+ slug: "topic-with-2-likes-total-from-2-users",+ data: {+ topic_title: "Topic with 2 likes (total) from 2 users",+ original_post_id: 443,+ original_post_type: 1,+ original_username: "jammed-radio",+ revision_number: null,+ display_username: "jammed-radio",+ display_name: "Bruce Wayne I",+ previous_notification_id: 933,+ username2: "broken-radio",+ name2: "Brucer Wayner II",+ reaction_icon: "heart",+ count: 2,},- {- id: 2189,- user_id: 88,- notification_type: 25,- read: true,- high_priority: false,- created_at: "2020-11-13T03:10:41.166Z",- post_number: 31,- topic_id: 913,- fancy_title: "Topic with likes and reactions",- slug: "topic-with-likes-and-reactions",- data: {- topic_title: "Topic with likes and reactions",- original_post_id: 384,- original_post_type: 1,- original_username: "nuclear-reactor",- revision_number: null,- display_username: "nuclear-reactor",- display_name: "Monkey D. Luffy",- previous_notification_id: 933,- username2: "solar-engine",- name2: "Roronoa Zoro",- count: 4,- },+ },+ {+ id: 2189,+ user_id: 88,+ notification_type: 25,+ read: true,+ high_priority: false,+ created_at: "2020-11-13T03:10:41.166Z",+ post_number: 31,+ topic_id: 913,+ fancy_title: "Topic with likes and reactions",+ slug: "topic-with-likes-and-reactions",+ data: {+ topic_title: "Topic with likes and reactions",+ original_post_id: 384,+ original_post_type: 1,+ original_username: "nuclear-reactor",+ revision_number: null,+ display_username: "nuclear-reactor",+ display_name: "Monkey D. Luffy",+ previous_notification_id: 933,+ username2: "solar-engine",+ name2: "Roronoa Zoro",+ count: 4,},- ],- });+ },+ ],});});+ });- test("reaction notifications with full name site setting on", async function (assert) {- await visit("/");- await click(".d-header-icons .current-user button");+ test("reaction notifications with full name site setting on", async function (assert) {+ await visit("/");+ await click(".d-header-icons .current-user button");- assert- .dom("li.notification.reaction:nth-child(1) a")- .hasText(/Bruce Wayne I, Brucer Wayner II/);+ assert+ .dom("li.notification.reaction:nth-child(1) a")+ .hasText(/Bruce Wayne I, Brucer Wayner II/);- assert- .dom("li.notification.reaction:nth-child(2) a")- .hasText(/Monkey D. Luffy and 3 others/);- });- }-);+ assert+ .dom("li.notification.reaction:nth-child(2) a")+ .hasText(/Monkey D. Luffy and 3 others/);+ });+});diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.jsindex df0ea9cd139..247c61981c0 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-post-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance(`Discourse Reactions - Post`, function (needs) {+acceptance("Post", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-received-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-received-test.jsindex 8ec126b14d8..5849dc2737d 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-received-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-received-test.js@@ -2,7 +2,7 @@ import { visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-acceptance("Discourse Reactions - Reactions Received Page", function (needs) {+acceptance("Reactions Received Page", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-rollback-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-rollback-test.jsindex 96270019e94..06716227d0f 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-rollback-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-rollback-test.js@@ -3,7 +3,7 @@ import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import ReactionsTopics from "../fixtures/reactions-topic-fixtures";-acceptance("Discourse Reactions - API Error Rollback", function (needs) {+acceptance("API Error Rollback", function (needs) {needs.user();needs.settings({diff --git a/plugins/discourse-solved/test/javascripts/acceptance/discourse-solved-post-menu-test.js b/plugins/discourse-solved/test/javascripts/acceptance/discourse-solved-post-menu-test.jsindex 2bb8ae460dd..9c9a6c73016 100644--- a/plugins/discourse-solved/test/javascripts/acceptance/discourse-solved-post-menu-test.js+++ b/plugins/discourse-solved/test/javascripts/acceptance/discourse-solved-post-menu-test.js@@ -4,50 +4,43 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";import { postStreamWithAcceptedAnswerExcerpt } from "../helpers/discourse-solved-helpers";-acceptance(- "Discourse Solved | Post Menu | Accept and Unaccept",- function (needs) {- needs.user({ admin: true });-- needs.settings({- solved_enabled: true,- allow_solved_on_all_topics: true,- });-- needs.pretender((server, helper) => {- server.post("/solution/accept", () =>- helper.response(- postStreamWithAcceptedAnswerExcerpt(null).accepted_answer- )- );- server.post("/solution/unaccept", () =>- helper.response({ success: "OK" })- );-- server.get("/t/12.json", () =>- helper.response(postStreamWithAcceptedAnswerExcerpt(null))- );- });-- test("accepting and unaccepting a post works", async function (assert) {- await visit("/t/without-excerpt/12");-- assert- .dom("#post_2 .post-action-menu__solved-accepted")- .exists("Unaccept button is visible")- .hasText(i18n("solved.solution"), "Unaccept button has correct text");-- await click("#post_2 .post-action-menu__solved-accepted");-- assert- .dom("#post_2 .post-action-menu__solved-unaccepted")- .exists("Accept button is visible");-- await click("#post_2 .post-action-menu__solved-unaccepted");-- assert- .dom("#post_2 .post-action-menu__solved-accepted")- .exists("Unaccept button is visible again");- });- }-);+acceptance("Post Menu | Accept and Unaccept", function (needs) {+ needs.user({ admin: true });++ needs.settings({+ solved_enabled: true,+ allow_solved_on_all_topics: true,+ });++ needs.pretender((server, helper) => {+ server.post("/solution/accept", () =>+ helper.response(postStreamWithAcceptedAnswerExcerpt(null).accepted_answer)+ );+ server.post("/solution/unaccept", () => helper.response({ success: "OK" }));++ server.get("/t/12.json", () =>+ helper.response(postStreamWithAcceptedAnswerExcerpt(null))+ );+ });++ test("accepting and unaccepting a post works", async function (assert) {+ await visit("/t/without-excerpt/12");++ assert+ .dom("#post_2 .post-action-menu__solved-accepted")+ .exists("Unaccept button is visible")+ .hasText(i18n("solved.solution"), "Unaccept button has correct text");++ await click("#post_2 .post-action-menu__solved-accepted");++ assert+ .dom("#post_2 .post-action-menu__solved-unaccepted")+ .exists("Accept button is visible");++ await click("#post_2 .post-action-menu__solved-unaccepted");++ assert+ .dom("#post_2 .post-action-menu__solved-accepted")+ .exists("Unaccept button is visible again");+ });+});diff --git a/plugins/discourse-solved/test/javascripts/acceptance/no-answer-prompt-test.js b/plugins/discourse-solved/test/javascripts/acceptance/no-answer-prompt-test.jsindex 92b840d3f37..d12c4767e1f 100644--- a/plugins/discourse-solved/test/javascripts/acceptance/no-answer-prompt-test.js+++ b/plugins/discourse-solved/test/javascripts/acceptance/no-answer-prompt-test.js@@ -5,7 +5,7 @@ import pretender, { response } from "discourse/tests/helpers/create-pretender";import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { topicWithNoAnswer } from "../helpers/discourse-solved-helpers";-acceptance("Discourse Solved - No Answer Prompt", function (needs) {+acceptance("No Answer Prompt", function (needs) {needs.user({ id: 1 });needs.settings({solved_enabled: true,diff --git a/plugins/discourse-solved/test/javascripts/acceptance/solved-move-post-test.js b/plugins/discourse-solved/test/javascripts/acceptance/solved-move-post-test.jsindex 7b80809694f..88db939997e 100644--- a/plugins/discourse-solved/test/javascripts/acceptance/solved-move-post-test.js+++ b/plugins/discourse-solved/test/javascripts/acceptance/solved-move-post-test.js@@ -4,7 +4,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";import { postStreamWithAcceptedAnswerExcerpt } from "../helpers/discourse-solved-helpers";-acceptance("Discourse Solved | Move Solution Post", function (needs) {+acceptance("Move Solution Post", function (needs) {needs.user({ admin: true });needs.settings({diff --git a/plugins/discourse-solved/test/javascripts/acceptance/solved-removal-confirmation-test.js b/plugins/discourse-solved/test/javascripts/acceptance/solved-removal-confirmation-test.jsindex 8473ebee62f..e3e63c552c5 100644--- a/plugins/discourse-solved/test/javascripts/acceptance/solved-removal-confirmation-test.js+++ b/plugins/discourse-solved/test/javascripts/acceptance/solved-removal-confirmation-test.js@@ -25,7 +25,7 @@ function unsolvedTopicFixture() {const STORAGE_KEY = "discourse-solved-hide-category-change-confirmation";-acceptance("Discourse Solved | Solved Removal Confirmation", function (needs) {+acceptance("Solved Removal Confirmation", function (needs) {needs.user({ admin: true });needs.settings({diff --git a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjs b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjsindex 1a83c434d2a..7b1eafd5b37 100644--- a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjs+++ b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-options-test.gjs@@ -4,7 +4,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import PaymentOptions from "discourse/plugins/discourse-subscriptions/discourse/components/payment-options";-module("Subscriptions | payment-options", function (hooks) {+module("payment-options", function (hooks) {setupRenderingTest(hooks);test("payment options have no plans", async function (assert) {diff --git a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjs b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjsindex 5966ec32181..f8e46602e05 100644--- a/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjs+++ b/plugins/discourse-subscriptions/test/javascripts/integration/components/payment-plan-test.gjs@@ -4,7 +4,7 @@ import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import PaymentPlan from "discourse/plugins/discourse-subscriptions/discourse/components/payment-plan";-module("Subscriptions | payment-plan", function (hooks) {+module("payment-plan", function (hooks) {setupRenderingTest(hooks);test("Payment plan subscription button rendered", async function (assert) {diff --git a/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.js b/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.jsindex 226592fa076..380766ead85 100644--- a/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.js+++ b/plugins/discourse-subscriptions/test/javascripts/unit/helpers/format-currency-test.js@@ -2,7 +2,7 @@ import { setupTest } from "ember-qunit";import { module, test } from "qunit";import formatCurrency from "discourse/plugins/discourse-subscriptions/discourse/helpers/format-currency";-module("Subscriptions | Unit | Helper | format-currency", function (hooks) {+module("Unit | Helper | format-currency", function (hooks) {setupTest(hooks);test("formats USD correctly", function (assert) {diff --git a/plugins/discourse-subscriptions/test/javascripts/unit/models/plan-test.js b/plugins/discourse-subscriptions/test/javascripts/unit/models/plan-test.jsindex e5c752138e4..f25d4ea01bc 100644--- a/plugins/discourse-subscriptions/test/javascripts/unit/models/plan-test.js+++ b/plugins/discourse-subscriptions/test/javascripts/unit/models/plan-test.js@@ -1,7 +1,7 @@import { module, test } from "qunit";import Plan from "discourse/plugins/discourse-subscriptions/discourse/models/plan";-module("Subscriptions | Unit | Model | plan", function () {+module("Unit | Model | plan", function () {test("subscriptionRate", function (assert) {const plan = Plan.create({unit_amount: "2399",diff --git a/plugins/discourse-templates/test/javascripts/acceptance/templates-test.js b/plugins/discourse-templates/test/javascripts/acceptance/templates-test.jsindex bc91de0e9d6..6a43c9e8caa 100644--- a/plugins/discourse-templates/test/javascripts/acceptance/templates-test.js+++ b/plugins/discourse-templates/test/javascripts/acceptance/templates-test.js@@ -220,35 +220,32 @@ acceptance("discourse-templates", function (needs) {});});-acceptance(- "discourse-templates - with tags disabled in Settings",- function (needs) {- needs.settings({- discourse_templates_enabled: true,- tagging_enabled: false,- });- needs.user({- can_use_templates: true,- });+acceptance("with tags disabled in Settings", function (needs) {+ needs.settings({+ discourse_templates_enabled: true,+ tagging_enabled: false,+ });+ needs.user({+ can_use_templates: true,+ });- needs.pretender(templatesPretender);+ needs.pretender(templatesPretender);- test("Filtering by tags", async function (assert) {- await visit("/");+ test("Filtering by tags", async function (assert) {+ await visit("/");- await click("#create-topic");- await selectCategory();- await click(".toolbar-menu__options-trigger");- await click(`button[title="${i18n("templates.insert_template")}"]`);+ await click("#create-topic");+ await selectCategory();+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("templates.insert_template")}"]`);- assert- .dom(".templates-filter-bar .tag-drop")- .doesNotExist("tag drop down is not displayed");- });- }-);+ assert+ .dom(".templates-filter-bar .tag-drop")+ .doesNotExist("tag drop down is not displayed");+ });+});-acceptance("discourse-templates | keyboard shortcut", function (needs) {+acceptance("keyboard shortcut", function (needs) {needs.settings({discourse_templates_enabled: true,tagging_enabled: true,@@ -429,7 +426,7 @@ acceptance("discourse-templates | keyboard shortcut", function (needs) {});});-acceptance("discourse-templates - buttons on topics", function (needs) {+acceptance("buttons on topics", function (needs) {needs.user();needs.settings({allow_uncategorized_topics: true,diff --git a/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjs b/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjsindex fd8281cfd7a..fa6bdbee728 100644--- a/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-buttons-dropdown-test.gjs@@ -4,7 +4,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";import PollButtonsDropdown from "discourse/plugins/poll/discourse/components/poll-buttons-dropdown";-module("Poll | Component | poll-buttons-dropdown", function (hooks) {+module("Component | poll-buttons-dropdown", function (hooks) {setupRenderingTest(hooks);test("Renders a clickable dropdown menu with a close option", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-info-test.gjs b/plugins/poll/test/javascripts/component/poll-info-test.gjsindex 3e5d9c36c2c..2a9299e1d1c 100644--- a/plugins/poll/test/javascripts/component/poll-info-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-info-test.gjs@@ -10,7 +10,7 @@ const OPTIONS = [{ id: "6c986ebcde3d5822a6e91a695c388094", html: "Other", votes: 5, rank: 0 },];-module("Poll | Component | poll-info", function (hooks) {+module("Component | poll-info", function (hooks) {setupRenderingTest(hooks);test("public multiple poll with results anytime", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-options-test.gjs b/plugins/poll/test/javascripts/component/poll-options-test.gjsindex 835f1669ea4..e4a2e0205e3 100644--- a/plugins/poll/test/javascripts/component/poll-options-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-options-test.gjs@@ -25,7 +25,7 @@ const IMAGE_OPTIONS = [},];-module("Poll | Component | poll-options", function (hooks) {+module("Component | poll-options", function (hooks) {setupRenderingTest(hooks);test("single, not selected", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-results-pie-test.gjs b/plugins/poll/test/javascripts/component/poll-results-pie-test.gjsindex ccb27418234..ad2854be3ba 100644--- a/plugins/poll/test/javascripts/component/poll-results-pie-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-results-pie-test.gjs@@ -11,7 +11,7 @@ const OPTIONS = [const ID = "23";-module("Poll | Component | poll-results-pie", function (hooks) {+module("Component | poll-results-pie", function (hooks) {setupRenderingTest(hooks);test("Renders the pie chart Component correctly", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjs b/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjsindex 33eade92298..fde338320c0 100644--- a/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-results-ranked-choice-test.gjs@@ -30,7 +30,7 @@ const RANKED_CHOICE_OUTCOME = {],};-module("Poll | Component | poll-results-ranked-choice", function (hooks) {+module("Component | poll-results-ranked-choice", function (hooks) {setupRenderingTest(hooks);test("Renders the ranked choice results component correctly", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-results-standard-test.gjs b/plugins/poll/test/javascripts/component/poll-results-standard-test.gjsindex 2770f94289d..1653e488ec3 100644--- a/plugins/poll/test/javascripts/component/poll-results-standard-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-results-standard-test.gjs@@ -34,7 +34,7 @@ const PRELOADEDVOTERS = {],};-module("Poll | Component | poll-results-standard", function (hooks) {+module("Component | poll-results-standard", function (hooks) {setupRenderingTest(hooks);test("Renders the standard results Component correctly", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjs b/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjsindex c9b17cefedb..d33f98b08df 100644--- a/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-results-tabs-test.gjs@@ -55,7 +55,7 @@ const PRELOADEDVOTERS = {],};-module("Poll | Component | poll-results-tabs", function (hooks) {+module("Component | poll-results-tabs", function (hooks) {setupRenderingTest(hooks);test("Renders one tab for non-ranked-choice poll", async function (assert) {diff --git a/plugins/poll/test/javascripts/component/poll-test.gjs b/plugins/poll/test/javascripts/component/poll-test.gjsindex 55ae01d0851..6ddee9008cb 100644--- a/plugins/poll/test/javascripts/component/poll-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-test.gjs@@ -9,7 +9,7 @@ import Poll from "discourse/plugins/poll/discourse/components/poll";let requests = 0;-module("Poll | Component | poll", function (hooks) {+module("Component | poll", function (hooks) {setupRenderingTest(hooks);hooks.beforeEach(function () {diff --git a/plugins/poll/test/javascripts/component/poll-ui-builder-test.gjs b/plugins/poll/test/javascripts/component/poll-ui-builder-test.gjsindex 5faa18d9767..14c8ff8b225 100644--- a/plugins/poll/test/javascripts/component/poll-ui-builder-test.gjs+++ b/plugins/poll/test/javascripts/component/poll-ui-builder-test.gjs@@ -20,7 +20,7 @@ async function setupBuilder() {return results;}-module("Poll | Component | poll-ui-builder", function (hooks) {+module("Component | poll-ui-builder", function (hooks) {setupRenderingTest(hooks);test("Can switch poll type", async function (assert) {diff --git a/plugins/spoiler-alert/test/javascripts/unit/lib/to-markdown-test.js b/plugins/spoiler-alert/test/javascripts/unit/lib/to-markdown-test.jsindex 78453b45255..d1a2af0f39a 100644--- a/plugins/spoiler-alert/test/javascripts/unit/lib/to-markdown-test.js+++ b/plugins/spoiler-alert/test/javascripts/unit/lib/to-markdown-test.js@@ -3,7 +3,7 @@ import { withPluginApi } from "discourse/lib/plugin-api";import toMarkdown from "discourse/lib/to-markdown";import { initializeSpoiler } from "discourse/plugins/spoiler-alert/initializers/spoiler-alert";-module("Spoiler Alert | Unit | to-markdown", function (hooks) {+module("Unit | to-markdown", function (hooks) {hooks.beforeEach(function () {withPluginApi(initializeSpoiler);});