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.

33 lines
1.0 KiB
JavaScript
Raw Normal View History

import { setupTest } from "ember-qunit";
import { module, test } from "qunit";
import { cook } from "discourse/lib/text";
module("lib:details-cooked-test", (hooks) => {
setupTest(hooks);
test("details", async (assert) => {
const testCooked = async (input, expected, text) => {
const cooked = (await cook(input)).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-16 00:42:20 +08:00
);
await testCooked(
`[details=test'ing all the things]\ntest\n[/details]`,
`<details>\n<summary>\ntest'ing all the things</summary>\n<p>test</p>\n</details>`,
"details with spaces and a single quote"
);
await testCooked(
`[details=”test'ing all the things”]\ntest\n[/details]`,
`<details>\n<summary>\ntest'ing all the things</summary>\n<p>test</p>\n</details>`,
"details surrounded by finnish double quotes"
);
});
2016-07-21 01:26:23 +08:00
});