discourse/plugins/chat/test/javascripts/components/chat-thread-list-item-test.js
Jarek Radosz 038e5deb2a
DEV: Clean up imports (#28060)
* `@ember/owner` instead of `@ember/application`
* `discourse-i18n` instead of `I18n`
* `{ service } from "@ember/service"` instead of `inject as service`
2024-07-25 15:09:06 +02:00

26 lines
943 B
JavaScript

import { getOwner } from "@ember/owner";
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 ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
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>";
this.thread = new ChatFabricators(getOwner(this)).thread({ title });
await render(hbs`
<Chat::ThreadList::Item @thread={{this.thread}} />
`);
assert.equal(
query(".chat-thread-list-item__title").innerHTML.trim(),
"&lt;style&gt;body { background: red;}&lt;/style&gt;"
);
});
});