DEV: allows to decorate topic list item (#9294)
Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { IMAGE_VERSION as v } from "pretty-text/emoji/version";
|
||||
@@ -358,3 +359,30 @@ QUnit.test("Bookmarks Modal", async assert => {
|
||||
await click(".topic-post:first-child button.bookmark");
|
||||
assert.ok(exists("#bookmark-reminder-modal"), "it shows the bookmark modal");
|
||||
});
|
||||
|
||||
acceptance("Topic with title decorated", {
|
||||
loggedIn: true,
|
||||
beforeEach() {
|
||||
withPluginApi("0.8.40", api => {
|
||||
api.decorateTopicTitle((topic, node, topicTitleType) => {
|
||||
node.innerText = `${node.innerText}-${topic.id}-${topicTitleType}`;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("Decorate topic title", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
find(".fancy-title")[0].innerText.endsWith("-280-topic-title"),
|
||||
"it decorates topic title"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find(".raw-topic-link:nth-child(1)")[0].innerText.endsWith(
|
||||
"-27331-topic-list-item-title"
|
||||
),
|
||||
"it decorates topic list item title"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ import { clearRewrites } from "discourse/lib/url";
|
||||
import { initSearchData } from "discourse/widgets/search-menu";
|
||||
import { resetDecorators } from "discourse/widgets/widget";
|
||||
import { resetWidgetCleanCallbacks } from "discourse/components/mount-widget";
|
||||
import { resetTopicTitleDecorators } from "discourse/components/topic-title";
|
||||
import { resetDecorators as resetPostCookedDecorators } from "discourse/widgets/post-cooked";
|
||||
import { resetDecorators as resetPluginOutletDecorators } from "discourse/components/plugin-connector";
|
||||
import { resetCache as resetOneboxCache } from "pretty-text/oneboxer";
|
||||
@@ -129,6 +130,7 @@ export function acceptance(name, options) {
|
||||
resetDecorators();
|
||||
resetPostCookedDecorators();
|
||||
resetPluginOutletDecorators();
|
||||
resetTopicTitleDecorators();
|
||||
resetOneboxCache();
|
||||
resetCustomPostMessageCallbacks();
|
||||
Discourse._runInitializer("instanceInitializers", function(
|
||||
|
||||
Reference in New Issue
Block a user