mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
3927b27f34
In 53b3d2f0dc
we introduced a stricter BBCode Tag parser. It prevents having "values" with spaces when they're not surrounded by a valid pair of quotes.
The `[details=` BBCode Tag is popular enough that it's worth adding a special case for it (especially since it doesn't support other parameters).
This also adds the Finnish pair of quotes.
Context - https://meta.discourse.org/t/details-accepts-only-one-word-as-summary/313019
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
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"
|
|
);
|
|
|
|
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"
|
|
);
|
|
});
|
|
});
|