mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: correctly display escaped thread titles (#24159)
Prior to this fix, titles with a quote `'` for example, would be rendered as: `'`
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
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-list-item", 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::ThreadList::Item @thread={{this.thread}} />
|
||||
`);
|
||||
|
||||
assert.equal(
|
||||
query(".chat-thread-list-item__title").innerHTML.trim(),
|
||||
"<style>body { background: red;}</style>"
|
||||
);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user