mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 22:26:26 +08:00
4859340b2d
Prior to this fix, titles with a quote `'` for example, would be rendered as: `'`
25 lines
899 B
JavaScript
25 lines
899 B
JavaScript
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}} />
|
|
`);
|
|
|
|
assert.equal(
|
|
query(".chat-thread-header__label").innerHTML.trim(),
|
|
"<style>body { background: red;}</style>"
|
|
);
|
|
});
|
|
});
|