mirror of
https://github.com/discourse/discourse.git
synced 2025-06-23 19:11:36 +08:00

Updated using `@embroider/template-tag-codemod`, plus some manual fixups. Co-authored-by: Jarek Radosz <jarek@cvx.dev>
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();
|
|
});
|
|
});
|