discourse/plugins/chat/test/javascripts/unit/lib/chat-composer-buttons-test.js
Jarek Radosz b81055a6d4
DEV: Convert more equal assertions (#29554)
…to either qunit-dom or `strictEqual`
2024-11-03 21:04:38 +01:00

39 lines
1005 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.strictEqual(button.id, "bar");
assert.strictEqual(button.label, "fooz");
});
test("chatComposerButtonsDependentKeys", function (assert) {
assert.deepEqual(chatComposerButtonsDependentKeys(), ["test"]);
});
});