discourse/plugins/chat/test/javascripts/unit/lib/chat-composer-buttons-test.js
Kris a914d3230b
DEV: remap all core icons for fontawesome 6 upgrade (#28715)
Followup to 7d8974d02f

Co-authored-by: David Taylor <david@taylorhq.com>
2024-09-13 16:50:52 +01:00

39 lines
993 B
JavaScript

import { module, test } from "qunit";
import {
chatComposerButtons,
chatComposerButtonsDependentKeys,
clearChatComposerButtons,
registerChatComposerButton,
} from "discourse/plugins/chat/discourse/lib/chat-composer-buttons";
module("Discourse Chat | Unit | chat-composer-buttons", function (hooks) {
hooks.beforeEach(function () {
registerChatComposerButton({
id: "foo",
icon: "xmark",
dependentKeys: ["test"],
});
registerChatComposerButton({
id: "bar",
translatedLabel() {
return this.baz;
},
});
});
hooks.afterEach(function () {
clearChatComposerButtons();
});
test("chatComposerButtons", function (assert) {
const button = chatComposerButtons({ baz: "fooz" }, "inline")[1];
assert.equal(button.id, "bar");
assert.equal(button.label, "fooz");
});
test("chatComposerButtonsDependentKeys", function (assert) {
assert.deepEqual(chatComposerButtonsDependentKeys(), ["test"]);
});
});