mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 03:36:20 +08:00
aa2d040526
Also fixes missed imports in core.
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import I18n from "I18n";
|
|
import selectKit from "helpers/select-kit-helper";
|
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
|
import { clearTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
let _test;
|
|
|
|
acceptance("Topic footer buttons mobile", {
|
|
loggedIn: true,
|
|
mobileView: true,
|
|
beforeEach() {
|
|
I18n.translations[I18n.locale].js.test = {
|
|
title: "My title",
|
|
label: "My Label"
|
|
};
|
|
|
|
withPluginApi("0.8.28", api => {
|
|
api.registerTopicFooterButton({
|
|
id: "my-button",
|
|
icon: "user",
|
|
label: "test.label",
|
|
title: "test.title",
|
|
dropdown: true,
|
|
action() {
|
|
_test = 2;
|
|
}
|
|
});
|
|
});
|
|
},
|
|
|
|
afterEach() {
|
|
clearTopicFooterButtons();
|
|
_test = undefined;
|
|
}
|
|
});
|
|
|
|
QUnit.test("default", async assert => {
|
|
await visit("/t/internationalization-localization/280");
|
|
|
|
assert.equal(_test, null);
|
|
|
|
const subject = selectKit(".topic-footer-mobile-dropdown");
|
|
await subject.expand();
|
|
await subject.selectRowByValue("my-button");
|
|
|
|
assert.equal(_test, 2);
|
|
});
|