FIX: ensure [date-range don't clashes with checklist

Adding the "→" was not setting the proper token nesting hierarchy.
This commit is contained in:
Régis Hanol
2024-04-06 22:35:24 +02:00
parent d3f7b3b5f9
commit 36659531f7
2 changed files with 25 additions and 3 deletions

View File

@@ -10,7 +10,10 @@ let currentRaw;
async function prepare(raw) {
const cooked = await cook(raw, {
siteSettings: { checklist_enabled: true },
siteSettings: {
checklist_enabled: true,
discourse_local_dates_enabled: true,
},
});
const widget = { attrs: {}, scheduleRerender() {} };
@@ -38,6 +41,23 @@ acceptance("discourse-checklist | checklist", function (needs) {
]);
});
test("does not clash with date-range bbcode", async function (assert) {
const [$elem, updated] = await prepare(`
[date-range from=2024-03-22 to=2024-03-23]
[ ] task 1
[ ] task 2
[x] task 3
`);
assert.equal($elem.find(".discourse-local-date").length, 2);
assert.equal($elem.find(".chcklst-box").length, 3);
$elem.find(".chcklst-box")[0].click();
const output = await updated;
assert.ok(output.includes("[x] task 1"));
});
test("does not check an image URL", async function (assert) {
const [$elem, updated] = await prepare(`
![](upload://zLd8FtsWc2ZSg3cZKIhwvhYxTcn.jpg)