2024-04-09 03:00:09 +08:00
|
|
|
import { getOwner } from "@ember/application";
|
2022-11-02 21:41:30 +08:00
|
|
|
import { render } from "@ember/test-helpers";
|
2023-10-11 02:38:59 +08:00
|
|
|
import hbs from "htmlbars-inline-precompile";
|
2022-11-02 21:41:30 +08:00
|
|
|
import { module, test } from "qunit";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
2024-04-09 03:00:09 +08:00
|
|
|
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
2022-11-02 21:41:30 +08:00
|
|
|
|
|
|
|
module(
|
2023-07-10 19:43:33 +08:00
|
|
|
"Discourse Chat | Component | <Chat::Modal::ArchiveChannel>",
|
2022-11-02 21:41:30 +08:00
|
|
|
function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test("channel title is escaped in instructions correctly", async function (assert) {
|
2024-04-09 03:00:09 +08:00
|
|
|
this.channel = new ChatFabricators(getOwner(this)).channel({
|
2023-07-10 19:43:33 +08:00
|
|
|
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::ArchiveChannel @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-archive-channel").innerHTML.includes(
|
2022-11-02 21:41:30 +08:00
|
|
|
"<script>someeviltitle</script>"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|