mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 01:53:39 +08:00
dc3473fe06
1. `test()` and `render()` instead of `componentTest()` 2. Angle brackets 3. `strictEqual()`/`true()`/`false()` assertions This removes all remaining uses of `componentTest` from core
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import { click, render } from "@ember/test-helpers";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { exists, visible } from "discourse/tests/helpers/qunit-helpers";
|
|
import { module, test } from "qunit";
|
|
import { htmlSafe } from "@ember/template";
|
|
|
|
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));
|
|
});
|
|
});
|