2024-07-25 15:09:06 +02:00
|
|
|
import { getOwner } from "@ember/owner";
|
2022-11-02 10:41:30 -03:00
|
|
|
import { render } from "@ember/test-helpers";
|
2023-10-10 19:38:59 +01:00
|
|
|
import hbs from "htmlbars-inline-precompile";
|
2022-11-02 10:41:30 -03:00
|
|
|
import { module, test } from "qunit";
|
2023-10-10 19:38:59 +01:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
2024-04-08 21:00:09 +02:00
|
|
|
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
2022-11-02 10:41:30 -03:00
|
|
|
|
|
|
|
module(
|
2023-07-10 13:43:33 +02:00
|
|
|
"Discourse Chat | Component | <Chat::Modal::DeleteChannel />",
|
2022-11-02 10:41:30 -03:00
|
|
|
function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test("channel title is escaped in instructions correctly", async function (assert) {
|
2024-04-08 21:00:09 +02:00
|
|
|
this.channel = new ChatFabricators(getOwner(this)).channel({
|
2023-07-10 13:43:33 +02:00
|
|
|
title: `<script>someeviltitle</script>`,
|
|
|
|
});
|
2022-11-02 10:41:30 -03:00
|
|
|
|
|
|
|
await render(
|
2023-07-10 13:43:33 +02:00
|
|
|
hbs`<Chat::Modal::DeleteChannel @inline={{true}} @model={{hash channel=this.channel}} />`
|
2022-11-02 10:41:30 -03:00
|
|
|
);
|
|
|
|
|
2024-11-11 13:06:12 +01:00
|
|
|
assert
|
|
|
|
.dom(".chat-modal-delete-channel__instructions")
|
|
|
|
.includesHtml("<script>someeviltitle</script>");
|
2022-11-02 10:41:30 -03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|