mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-07 07:04:12 +08:00
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
35 lines
1 KiB
Text
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();
|
|
});
|
|
});
|