2024-07-25 21:09:06 +08:00
|
|
|
import { getOwner } from "@ember/owner";
|
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";
|
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
|
|
|
);
|
|
|
|
|
2024-11-11 20:06:12 +08:00
|
|
|
assert
|
|
|
|
.dom(".chat-modal-archive-channel")
|
|
|
|
.includesHtml("<script>someeviltitle</script>");
|
2022-11-02 21:41:30 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|