mirror of
https://github.com/discourse/discourse.git
synced 2025-02-19 13:42:55 +08:00

This api allows to add a dropdown at the bottom of a topic, note that this API is mobile only for now. Also included in the commit: - various doc fixes - adding tests for both buttons and dropdowns APIs - uses thrown instead of @ember/error to ensure execution is halted when incorrect parameters are given
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
|
import { test } from "qunit";
|
|
import { visit } from "@ember/test-helpers";
|
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
|
|
|
acceptance(
|
|
"Topic - Plugin API - registerTopicFooterButton (mobile)",
|
|
function (needs) {
|
|
needs.user();
|
|
|
|
needs.mobileView();
|
|
|
|
test("adds topic footer button as a dropdown through API", async function (assert) {
|
|
const done = assert.async();
|
|
withPluginApi("0.13.1", (api) => {
|
|
api.registerTopicFooterButton({
|
|
id: "foo",
|
|
icon: "cog",
|
|
action() {
|
|
assert.step(`action called`);
|
|
done();
|
|
},
|
|
dropdown: true,
|
|
});
|
|
});
|
|
|
|
await visit("/t/internationalization-localization/280");
|
|
const subject = selectKit(".topic-footer-mobile-dropdown");
|
|
await subject.expand();
|
|
await subject.selectRowByValue("foo");
|
|
|
|
assert.verifySteps(["action called"]);
|
|
});
|
|
}
|
|
);
|