2024-04-09 03:00:09 +08:00
|
|
|
import { getOwner } from "@ember/application";
|
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";
|
2024-04-09 03:00:09 +08:00
|
|
|
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
2023-10-31 04:06:31 +08:00
|
|
|
|
|
|
|
module("Discourse Chat | Component | chat-thread-list-item", function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test("it safely renders title", async function (assert) {
|
|
|
|
const title = "<style>body { background: red;}</style>";
|
2024-04-09 03:00:09 +08:00
|
|
|
this.thread = new ChatFabricators(getOwner(this)).thread({ title });
|
2023-10-31 04:06:31 +08:00
|
|
|
|
|
|
|
await render(hbs`
|
|
|
|
<Chat::ThreadList::Item @thread={{this.thread}} />
|
|
|
|
`);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
query(".chat-thread-list-item__title").innerHTML.trim(),
|
|
|
|
"<style>body { background: red;}</style>"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|