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::MoveMessageToChannel />",
|
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>",
|
|
|
|
});
|
|
|
|
this.selectedMessageIds = [this.channel.id];
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2023-07-10 19:43:33 +08:00
|
|
|
await render(hbs`
|
|
|
|
<Chat::Modal::MoveMessageToChannel
|
|
|
|
@inline={{true}}
|
|
|
|
@model={{hash sourceChannel=this.channel selectedMessageIds=this.selectedMessageIds}}
|
|
|
|
/>
|
|
|
|
`);
|
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-move-message-to-channel").innerHTML.includes(
|
2022-11-02 21:41:30 +08:00
|
|
|
"<script>someeviltitle</script>"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|