diff --git a/test/TemplateTest.js b/test/TemplateTest.js index 0b2bb54fa..e3dcd43c1 100644 --- a/test/TemplateTest.js +++ b/test/TemplateTest.js @@ -320,6 +320,45 @@ test("One Layout (_layoutContent deprecated but supported)", async (t) => { t.is(data.keylayout, "valuelayout"); }); +test("Liquid shortcode with multiple arguments(issue #2348)", async (t) => { + // NOTE issue #2348 was only active when you were processing multiple templates at the same time. + + let eleventyConfig = new TemplateConfig(); + eleventyConfig.userConfig.addShortcode("simplelink", function (text, url) { + return `${text} (${url})`; + }); + + let dataObj = new TemplateData("./test/stubs/", eleventyConfig); + + let tmpl = getNewTemplate( + "./test/stubs/templateWithLiquidShortcodeMultipleArguments.liquid", + "./test/stubs/", + "dist", + dataObj, + null, + eleventyConfig + ); + + t.is( + (await tmpl.getFrontMatter()).data[tmpl.config.keys.layout], + "layoutLiquid.liquid" + ); + + let data = await tmpl.getData(); + t.is(data[tmpl.config.keys.layout], "layoutLiquid.liquid"); + + t.is( + normalizeNewLines(cleanHtml(await tmpl.renderLayout(tmpl, data))), + `
+

Hello.

+ world (/somepage) +
` + ); + + t.is(data.keymain, "valuemain"); + t.is(data.keylayout, "valuelayout"); +}); + test("One Layout (liquid test)", async (t) => { let eleventyConfig = new TemplateConfig(); let dataObj = new TemplateData("./test/stubs/", eleventyConfig); diff --git a/test/stubs/templateWithLiquidShortcodeMultipleArguments.liquid b/test/stubs/templateWithLiquidShortcodeMultipleArguments.liquid new file mode 100644 index 000000000..ca2eefe84 --- /dev/null +++ b/test/stubs/templateWithLiquidShortcodeMultipleArguments.liquid @@ -0,0 +1,9 @@ +--- +layout: layoutLiquid.liquid +keymain: valuemain +title: 'Font Aliasing, or How to Rename a Font in CSS' +permalink: /rename-font2/ +--- + +

Hello.

+{% simplelink "world", "/somepage" %} \ No newline at end of file