discourse/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs
David Taylor 9322a46fa4
DEV: Remove unneeded const self = this; from qunit tests (#35632)
This was required in older versions of Ember. But now, bare template
tags can access `this.`. This commit was created by upgrading lint-configs, and then running 
`pnpm lint:js:fix && pnpm lint:prettier:fix`

Rule development: https://github.com/discourse/lint-configs/pull/154
2025-10-27 18:07:22 +00:00

33 lines
1.1 KiB
Text
Vendored

import { hash } from "@ember/helper";
import { getOwner } from "@ember/owner";
import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import ArchiveChannel from "discourse/plugins/chat/discourse/components/chat/modal/archive-channel";
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
module(
"Discourse Chat | Component | <Chat::Modal::ArchiveChannel>",
function (hooks) {
setupRenderingTest(hooks);
test("channel title is escaped in instructions correctly", async function (assert) {
this.channel = new ChatFabricators(getOwner(this)).channel({
title: `<script>someeviltitle</script>`,
});
await render(
<template>
<ArchiveChannel
@inline={{true}}
@model={{hash channel=this.channel}}
/>
</template>
);
assert
.dom(".chat-modal-archive-channel")
.includesHtml("&lt;script&gt;someeviltitle&lt;/script&gt;");
});
}
);