discourse/plugins/chat/test/javascripts/components/collapser-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

35 lines
1 KiB
Text

import { htmlSafe } from "@ember/template";
import { click, render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import Collapser from "discourse/plugins/chat/discourse/components/collapser";
module("Discourse Chat | Component | collapser", function (hooks) {
setupRenderingTest(hooks);
test("renders header", async function (assert) {
this.set("header", htmlSafe(`<div class="cat">tomtom</div>`));
await render(<template><Collapser @header={{this.header}} /></template>);
assert.dom(".cat").exists();
});
test("collapses and expands yielded body", async function (assert) {
await render(
<template>
<Collapser>
<div class="cat">body text</div>
</Collapser>
</template>
);
assert.dom(".cat").isVisible();
await click(".chat-message-collapser-opened");
assert.dom(".cat").isNotVisible();
await click(".chat-message-collapser-closed");
assert.dom(".cat").isVisible();
});
});