2022-11-02 09:41:30 -04:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
|
|
import fabricators from "../helpers/fabricators";
|
|
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
|
|
|
import hbs from "htmlbars-inline-precompile";
|
|
|
|
import { render } from "@ember/test-helpers";
|
|
|
|
import { module, test } from "qunit";
|
|
|
|
|
|
|
|
module(
|
|
|
|
"Discourse Chat | Component | chat-channel-archive-modal-inner",
|
|
|
|
function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test("channel title is escaped in instructions correctly", async function (assert) {
|
2022-12-22 08:35:18 -05:00
|
|
|
this.set(
|
|
|
|
"channel",
|
|
|
|
fabricators.chatChannel({
|
|
|
|
title: `<script>someeviltitle</script>`,
|
|
|
|
})
|
|
|
|
);
|
2022-11-02 09:41:30 -04:00
|
|
|
|
|
|
|
await render(
|
2022-12-22 08:35:18 -05:00
|
|
|
hbs`<ChatChannelArchiveModalInner @chatChannel={{this.channel}} />`
|
2022-11-02 09:41:30 -04:00
|
|
|
);
|
|
|
|
|
2022-12-22 08:35:18 -05:00
|
|
|
assert.true(
|
2022-11-02 09:41:30 -04:00
|
|
|
query(".chat-channel-archive-modal-instructions").innerHTML.includes(
|
|
|
|
"<script>someeviltitle</script>"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|