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