2023-10-31 04:06:31 +08:00
|
|
|
import { render } from "@ember/test-helpers";
|
|
|
|
import hbs from "htmlbars-inline-precompile";
|
|
|
|
import { module, test } from "qunit";
|
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
|
|
|
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
|
|
|
|
|
|
|
module("Discourse Chat | Component | chat-thread-header", function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test("it safely renders title", async function (assert) {
|
|
|
|
const title = "<style>body { background: red;}</style>";
|
|
|
|
this.thread = fabricators.thread({ title });
|
|
|
|
|
|
|
|
await render(hbs`
|
|
|
|
<Chat::Thread::Header @thread={{this.thread}} @channel={{this.thread.channel}} />
|
|
|
|
`);
|
|
|
|
|
2023-12-19 00:49:58 +08:00
|
|
|
assert.ok(
|
|
|
|
query(".c-navbar__title")
|
|
|
|
.innerHTML.trim()
|
|
|
|
.includes("<style>body { background: red;}</style>")
|
2023-10-31 04:06:31 +08:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|