discourse/plugins/chat/test/javascripts/components/collapser-test.js
David Taylor 48193767bf DEV: Sort imports
Automatically generated by `eslint --fix` to satisfy the updated configuration
2023-10-10 21:46:54 +01:00

39 lines
1.1 KiB
JavaScript

import { htmlSafe } from "@ember/template";
import { click, 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 { exists, visible } from "discourse/tests/helpers/qunit-helpers";
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(hbs`<Collapser @header={{this.header}} />`);
assert.true(exists(".cat"));
});
test("collapses and expands yielded body", async function (assert) {
await render(hbs`
<Collapser>
<div class="cat">body text</div>
</Collapser>
`);
const openButton = ".chat-message-collapser-closed";
const closeButton = ".chat-message-collapser-opened";
const body = ".cat";
assert.true(visible(body));
await click(closeButton);
assert.false(visible(body));
await click(openButton);
assert.true(visible(body));
});
});