2021-06-09 09:58:55 -05:00
|
|
|
import { module, test } from "qunit";
|
2023-11-06 10:59:49 -06:00
|
|
|
import { cook } from "discourse/lib/text";
|
2016-07-19 15:20:59 -05:00
|
|
|
|
2023-11-06 10:59:49 -06:00
|
|
|
const opts = {
|
2016-07-19 15:20:59 -05:00
|
|
|
siteSettings: {
|
|
|
|
enable_emoji: true,
|
2022-11-07 17:17:43 -06:00
|
|
|
emoji_set: "twitter",
|
2018-06-15 11:42:20 -05:00
|
|
|
highlighted_languages: "json|ruby|javascript",
|
2020-09-04 13:01:14 -05:00
|
|
|
default_code_lang: "auto",
|
2016-07-19 15:20:59 -05:00
|
|
|
},
|
2018-06-15 11:42:20 -05:00
|
|
|
censoredWords: "shucks|whiz|whizzer",
|
2020-09-04 13:01:14 -05:00
|
|
|
getURL: (url) => url,
|
2023-11-06 10:59:49 -06:00
|
|
|
};
|
2016-07-19 15:20:59 -05:00
|
|
|
|
2022-06-20 08:42:10 -05:00
|
|
|
module("lib:details-cooked-test", function () {
|
2023-11-06 10:59:49 -06:00
|
|
|
test("details", async function (assert) {
|
|
|
|
const testCooked = async (input, expected, text) => {
|
|
|
|
const cooked = (await cook(input, opts)).toString();
|
|
|
|
assert.strictEqual(cooked, expected, text);
|
2022-06-20 08:42:10 -05:00
|
|
|
};
|
2023-11-06 10:59:49 -06:00
|
|
|
await testCooked(
|
2022-06-20 08:42:10 -05:00
|
|
|
`<details><summary>Info</summary>coucou</details>`,
|
|
|
|
`<details><summary>Info</summary>coucou</details>`,
|
|
|
|
"manual HTML for details"
|
2018-06-15 11:42:20 -05:00
|
|
|
);
|
2016-07-19 15:20:59 -05:00
|
|
|
|
2023-11-06 10:59:49 -06:00
|
|
|
await testCooked(
|
2022-06-20 08:42:10 -05:00
|
|
|
"[details=testing]\ntest\n[/details]",
|
|
|
|
`<details>
|
2017-07-14 07:27:28 -05:00
|
|
|
<summary>
|
|
|
|
testing</summary>
|
|
|
|
<p>test</p>
|
2018-06-15 11:42:20 -05:00
|
|
|
</details>`
|
2022-06-20 08:42:10 -05:00
|
|
|
);
|
|
|
|
});
|
2016-07-20 12:26:23 -05:00
|
|
|
});
|