This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/acceptance/topic-footer-button-api-test.js
Joffrey JAFFEUX 362c47ce6a
DEV: adds a new topic footer dropdown api (#14747)
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
2021-11-12 10:21:34 +01:00

28 lines
801 B
JavaScript

import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api";
acceptance("Topic - Plugin API - registerTopicFooterButton", function (needs) {
needs.user();
test("adds topic footer button through API", async function (assert) {
const done = assert.async();
withPluginApi("0.13.1", (api) => {
api.registerTopicFooterButton({
id: "my-button",
icon: "cog",
action() {
assert.step("action called");
done();
},
});
});
await visit("/t/internationalization-localization/280");
await click("#topic-footer-button-my-button");
assert.verifySteps(["action called"]);
});
});