2022-11-02 09:41:30 -04:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
2023-05-17 11:49:52 -04:00
|
|
|
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
2022-11-02 09:41:30 -04:00
|
|
|
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-delete-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",
|
2023-05-17 11:49:52 -04:00
|
|
|
fabricators.channel({
|
2022-12-22 08:35:18 -05:00
|
|
|
title: `<script>someeviltitle</script>`,
|
|
|
|
})
|
|
|
|
);
|
2022-11-02 09:41:30 -04:00
|
|
|
|
|
|
|
await render(
|
2022-12-22 08:35:18 -05:00
|
|
|
hbs`<ChatChannelDeleteModalInner @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-delete-modal-instructions").innerHTML.includes(
|
|
|
|
"<script>someeviltitle</script>"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|