discourse/plugins/discourse-details/test/javascripts/lib/details-cooked-test.js.es6
Penar Musaraj 45c5fd2172
DEV: Remove JoyPixels emoji option (#12197)
- removes the option from site settings
- deletes the site setting on existing sites that have it
- marks posts using emojis as requiring a rebake

Note that the actual image files are not removed here, the plan is to
remove them in a few weeks/months (when presumably the rebaking of old
posts has been completed).
2021-02-26 07:44:52 -05:00

39 lines
865 B
JavaScript

import PrettyText, { buildOptions } from "pretty-text/pretty-text";
module("lib:details-cooked-test");
const defaultOpts = buildOptions({
siteSettings: {
enable_emoji: true,
emoji_set: "google_classic",
highlighted_languages: "json|ruby|javascript",
default_code_lang: "auto",
},
censoredWords: "shucks|whiz|whizzer",
getURL: (url) => url,
});
test("details", function (assert) {
const cooked = (input, expected, text) => {
assert.equal(
new PrettyText(defaultOpts).cook(input),
expected.replace(/\/>/g, ">"),
text
);
};
cooked(
`<details><summary>Info</summary>coucou</details>`,
`<details><summary>Info</summary>coucou</details>`,
"manual HTML for details"
);
cooked(
"[details=testing]\ntest\n[/details]",
`<details>
<summary>
testing</summary>
<p>test</p>
</details>`
);
});