mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: Modernize chat's component tests (#19577)
1. `test()` and `render()` instead of `componentTest()` 2. Angle brackets 3. `strictEqual()`/`true()`/`false()` assertions This removes all remaining uses of `componentTest` from core
This commit is contained in:
@ -1,26 +1,23 @@
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module } from "qunit";
|
||||
import { module, test } from "qunit";
|
||||
import { render } from "@ember/test-helpers";
|
||||
|
||||
module(
|
||||
"Discourse Chat | Component | chat-composer-inline-buttons",
|
||||
function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
componentTest("buttons", {
|
||||
template: hbs`{{chat-composer-inline-buttons buttons=buttons}}`,
|
||||
test("buttons", async function (assert) {
|
||||
this.set("buttons", [{ id: "foo", icon: "times", action: () => {} }]);
|
||||
|
||||
async beforeEach() {
|
||||
this.set("buttons", [{ id: "foo", icon: "times", action: () => {} }]);
|
||||
},
|
||||
await render(
|
||||
hbs`<ChatComposerInlineButtons @buttons={{this.buttons}} />`
|
||||
);
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(exists(".chat-composer-inline-button.foo"));
|
||||
assert.ok(exists(".chat-composer-inline-button.foo .d-icon-times"));
|
||||
},
|
||||
assert.true(exists(".chat-composer-inline-button.foo"));
|
||||
assert.true(exists(".chat-composer-inline-button.foo .d-icon-times"));
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user