Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for pr #2367 #2369

Merged
merged 1 commit into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions test/TemplateTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<a href="${url}">${text} (${url})</a>`;
});

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))),
`<div id="layout">
<p>Hello.</p>
<a href="/somepage">world (/somepage)</a>
</div>`
);

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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
layout: layoutLiquid.liquid
keymain: valuemain
title: 'Font Aliasing, or How to Rename a Font in CSS'
permalink: /rename-font2/
---

<p>Hello.</p>
{% simplelink "world", "/somepage" %}