discourse/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
917 B
JavaScript
Raw Normal View History

import { module, test } from "qunit";
import { cook } from "discourse/lib/text";
const opts = {
siteSettings: {
enable_emoji: true,
emoji_set: "twitter",
2018-06-15 11:42:20 -05:00
highlighted_languages: "json|ruby|javascript",
default_code_lang: "auto",
},
2018-06-15 11:42:20 -05:00
censoredWords: "shucks|whiz|whizzer",
getURL: (url) => url,
};
module("lib:details-cooked-test", function () {
test("details", async function (assert) {
const testCooked = async (input, expected, text) => {
const cooked = (await cook(input, opts)).toString();
assert.strictEqual(cooked, expected, text);
};
await testCooked(
`<details><summary>Info</summary>coucou</details>`,
`<details><summary>Info</summary>coucou</details>`,
"manual HTML for details"
2018-06-15 11:42:20 -05:00
);
await testCooked(
"[details=testing]\ntest\n[/details]",
`<details>
<summary>
testing</summary>
<p>test</p>
2018-06-15 11:42:20 -05:00
</details>`
);
});
2016-07-20 12:26:23 -05:00
});