diff --git a/test/test.js b/test/test.js index 793c2e9..a782c05 100644 --- a/test/test.js +++ b/test/test.js @@ -459,3 +459,26 @@ test.skip("Custom permalink JS, `dynamicPermalink: false` issue #32", async t => t.is(result.url, "/page.html") }); + +test("WebC components in liquid layout, issue #35", async t => { + let elev = new Eleventy("./test/webc-component-in-layout/page.liquid", "./test/webc-component-in-layout/_site", { + configPath: "./test/webc-component-in-layout/eleventy.config.js" + }); + + let results = await elev.toJSON(); + let [result] = results; + + t.is(normalize(result.content), ` + + + + + + + + + +Hello + +`); +}); diff --git a/test/webc-component-in-layout/_components/twitter-share.webc b/test/webc-component-in-layout/_components/twitter-share.webc new file mode 100644 index 0000000..b4fb152 --- /dev/null +++ b/test/webc-component-in-layout/_components/twitter-share.webc @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/test/webc-component-in-layout/_includes/layout.liquid b/test/webc-component-in-layout/_includes/layout.liquid new file mode 100644 index 0000000..603e77b --- /dev/null +++ b/test/webc-component-in-layout/_includes/layout.liquid @@ -0,0 +1,9 @@ + + + + + +{% renderTemplate "webc" %}{% endrenderTemplate %} +{{ content }} + + \ No newline at end of file diff --git a/test/webc-component-in-layout/eleventy.config.js b/test/webc-component-in-layout/eleventy.config.js new file mode 100644 index 0000000..6690722 --- /dev/null +++ b/test/webc-component-in-layout/eleventy.config.js @@ -0,0 +1,16 @@ +const { EleventyRenderPlugin } = require("@11ty/eleventy"); +const EleventyWebcPlugin = require("../../eleventyWebcPlugin.js"); + +module.exports = function(eleventyConfig) { + eleventyConfig.addPlugin(EleventyRenderPlugin); + + eleventyConfig.addPlugin(EleventyWebcPlugin, { + components: "./test/webc-component-in-layout/_components/*.webc" + }); + + return { + dir: { + includes: "_includes", + } + } +} diff --git a/test/webc-component-in-layout/page.liquid b/test/webc-component-in-layout/page.liquid new file mode 100644 index 0000000..a4f653a --- /dev/null +++ b/test/webc-component-in-layout/page.liquid @@ -0,0 +1,4 @@ +--- +layout: layout.liquid +--- +Hello \ No newline at end of file