2022-12-22 21:35:18 +08:00
|
|
|
import { click, render } from "@ember/test-helpers";
|
2023-10-11 02:38:59 +08:00
|
|
|
import hbs from "htmlbars-inline-precompile";
|
2022-12-22 21:35:18 +08:00
|
|
|
import { module, test } from "qunit";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
|
|
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
2022-11-02 21:41:30 +08:00
|
|
|
|
|
|
|
module("Discourse Chat | Component | chat-composer-dropdown", function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
2022-12-22 21:35:18 +08:00
|
|
|
test("buttons", async function (assert) {
|
2024-09-13 23:50:52 +08:00
|
|
|
this.set("buttons", [{ id: "foo", icon: "xmark", action: () => {} }]);
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2022-12-22 21:35:18 +08:00
|
|
|
await render(hbs`<ChatComposerDropdown @buttons={{this.buttons}} />`);
|
|
|
|
await click(".chat-composer-dropdown__trigger-btn");
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2022-12-22 21:35:18 +08:00
|
|
|
assert.true(exists(".chat-composer-dropdown__item.foo"));
|
|
|
|
assert.true(
|
2024-09-13 23:50:52 +08:00
|
|
|
exists(".chat-composer-dropdown__action-btn.foo .d-icon-xmark")
|
2022-12-22 21:35:18 +08:00
|
|
|
);
|
2022-11-02 21:41:30 +08:00
|
|
|
});
|
|
|
|
});
|