mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 23:06:28 +08:00
038e5deb2a
* `@ember/owner` instead of `@ember/application` * `discourse-i18n` instead of `I18n` * `{ service } from "@ember/service"` instead of `inject as service`
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
import { getOwner } from "@ember/owner";
|
|
import { render } from "@ember/test-helpers";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
|
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
|
|
|
module(
|
|
"Discourse Chat | Component | <Chat::Modal::DeleteChannel />",
|
|
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(
|
|
hbs`<Chat::Modal::DeleteChannel @inline={{true}} @model={{hash channel=this.channel}} />`
|
|
);
|
|
|
|
assert.true(
|
|
query(".chat-modal-delete-channel__instructions").innerHTML.includes(
|
|
"<script>someeviltitle</script>"
|
|
)
|
|
);
|
|
});
|
|
}
|
|
);
|