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";
|
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
|
|
|
|
2024-11-09 03:27:32 +08:00
|
|
|
assert.dom(".chat-composer-dropdown__item.foo").exists();
|
|
|
|
assert
|
|
|
|
.dom(".chat-composer-dropdown__action-btn.foo .d-icon-xmark")
|
|
|
|
.exists();
|
2022-11-02 21:41:30 +08:00
|
|
|
});
|
|
|
|
});
|