mirror of
https://github.com/discourse/discourse.git
synced 2024-12-17 03:53:42 +08:00
0a5f548635
As part of this move, we are also renaming `discourse-chat` to `chat`.
39 lines
993 B
JavaScript
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: "times",
|
|
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"]);
|
|
});
|
|
});
|