DEV: allows to decorate topic list item (#9294)

Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
Joffrey JAFFEUX
2020-03-27 16:50:31 +01:00
committed by GitHub
parent c721bdb300
commit 38e347aee6
5 changed files with 94 additions and 2 deletions

View File

@ -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"
);
});