mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 15:00:58 +08:00

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>
31 lines
1.1 KiB
Plaintext
31 lines
1.1 KiB
Plaintext
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 doesn’t 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();
|
|
});
|
|
});
|