discourse/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs
Joffrey JAFFEUX b546c31b7f
UI: simplify chat thread title (#29998)
We were using a complex logic to make it change size based on scroll position but this was imperfect and not visually pleasing. Also the title had been made a button which was causing the ellipsis to not work correctly, and I would prefer to not mix page knowledge (thread) with title component so I made this click logic directly in the chat-thread component.

---------

Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2024-11-29 22:39:18 +01:00

31 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { getOwner } from "@ember/owner";
import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
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) {
setupRenderingTest(hooks);
test("it renders the title", async function (assert) {
const thread = new ChatFabricators(getOwner(this)).thread({
title: "A nice thread title",
});
await render(<template><ChatThreadHeading @thread={{thread}} /></template>);
assert.dom(".chat-thread__heading-title").hasText("A nice thread title");
});
test("it doesnt render heading when no title", async function (assert) {
const thread = new ChatFabricators(getOwner(this)).thread({
title: null,
});
await render(<template><ChatThreadHeading @thread={{thread}} /></template>);
assert.dom(".chat-thread__heading").doesNotExist();
});
});