DEV: Remove a use of discourseModule (#29996)

This commit is contained in:
Jarek Radosz 2024-11-29 18:16:21 +01:00 committed by GitHub
parent f20db92512
commit 52b7280ad4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,9 @@
import { test } from "qunit"; import { module, test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api"; import { withPluginApi } from "discourse/lib/plugin-api";
import toMarkdown from "discourse/lib/to-markdown"; import toMarkdown from "discourse/lib/to-markdown";
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
import { initializeSpoiler } from "discourse/plugins/spoiler-alert/initializers/spoiler-alert"; import { initializeSpoiler } from "discourse/plugins/spoiler-alert/initializers/spoiler-alert";
discourseModule("Spoiler Alert | Unit | to-markdown", function (hooks) { module("Spoiler Alert | Unit | to-markdown", function (hooks) {
hooks.beforeEach(function () { hooks.beforeEach(function () {
withPluginApi("0.5", initializeSpoiler); withPluginApi("0.5", initializeSpoiler);
}); });
@ -13,18 +12,14 @@ discourseModule("Spoiler Alert | Unit | to-markdown", function (hooks) {
let html = `<div>Text with a</div><div class="spoiled spoiler-blurred">spoiled</div><div>word.</div>`; let html = `<div>Text with a</div><div class="spoiled spoiler-blurred">spoiled</div><div>word.</div>`;
let markdown = `Text with a\n\n[spoiler]\nspoiled\n[/spoiler]\n\nword.`; let markdown = `Text with a\n\n[spoiler]\nspoiled\n[/spoiler]\n\nword.`;
assert.strictEqual( assert.strictEqual(toMarkdown(html), markdown, "creates block spoiler tag");
toMarkdown(html),
markdown,
"it should create block spoiler tag"
);
html = `Inline <span class="spoiled">spoiled</span> word.`; html = `Inline <span class="spoiled">spoiled</span> word.`;
markdown = `Inline [spoiler]spoiled[/spoiler] word.`; markdown = `Inline [spoiler]spoiled[/spoiler] word.`;
assert.strictEqual( assert.strictEqual(
toMarkdown(html), toMarkdown(html),
markdown, markdown,
"it should create inline spoiler tag" "creates inline spoiler tag"
); );
}); });
}); });