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-list-plugin-api-test.js
Jarek Radosz 8e809149d2
DEV: Fix "overridden" typos (#16399)
There are still some, but those are in actual code that's used outside core, so the change there would need to go through the deprecation cycle. That's a task for another day.
2022-04-06 23:17:20 +02:00

30 lines
943 B
JavaScript

import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import { clearCustomLastUnreadUrlCallbacks } from "discourse/models/topic";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
import { withPluginApi } from "discourse/lib/plugin-api";
acceptance("Topic list plugin API", function () {
function customLastUnreadUrl(context) {
return `${context.urlForPostNumber(1)}?overridden`;
}
test("Overrides lastUnreadUrl", async function (assert) {
try {
withPluginApi("1.2.0", (api) => {
api.registerCustomLastUnreadUrlCallback(customLastUnreadUrl);
});
await visit("/");
assert.strictEqual(
query(
".topic-list .topic-list-item:first-child a.raw-topic-link"
).getAttribute("href"),
"/t/error-after-upgrade-to-0-9-7-9/11557/1?overridden"
);
} finally {
clearCustomLastUnreadUrlCallbacks();
}
});
});