2022-11-02 21:41:30 +08:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
2023-05-17 23:49:52 +08:00
|
|
|
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
2022-11-02 21:41:30 +08: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(
|
2023-07-10 19:43:33 +08:00
|
|
|
"Discourse Chat | Component | <Chat::Modal::DeleteChannel />",
|
2022-11-02 21:41:30 +08:00
|
|
|
function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test("channel title is escaped in instructions correctly", async function (assert) {
|
2023-07-10 19:43:33 +08:00
|
|
|
this.channel = fabricators.channel({
|
|
|
|
title: `<script>someeviltitle</script>`,
|
|
|
|
});
|
2022-11-02 21:41:30 +08:00
|
|
|
|
|
|
|
await render(
|
2023-07-10 19:43:33 +08:00
|
|
|
hbs`<Chat::Modal::DeleteChannel @inline={{true}} @model={{hash channel=this.channel}} />`
|
2022-11-02 21:41:30 +08:00
|
|
|
);
|
|
|
|
|
2022-12-22 21:35:18 +08:00
|
|
|
assert.true(
|
2023-07-10 19:43:33 +08:00
|
|
|
query(".chat-modal-delete-channel__instructions").innerHTML.includes(
|
2022-11-02 21:41:30 +08:00
|
|
|
"<script>someeviltitle</script>"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|