Skip to content

Commit

Permalink
Add test for 11ty#1242
Browse files Browse the repository at this point in the history
This commit adds an additional testcase for 11ty#1242 to avoid future regressions.

Signed-off-by: Raphael Höser <raphael@hoeser.info>
  • Loading branch information
Snapstromegon committed Jul 29, 2021
1 parent 05468df commit 69c37b4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/TemplateDataTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,29 @@ test("Parent directory for data (Issue #337)", async (t) => {
});
});

test("Dots in datafile path (Issue #1242)", async (t) => {
let eleventyConfig = new TemplateConfig({
dataTemplateEngine: false,
dir: {
input: "./test/stubs-1242/",
data: "_data/",
},
});
let dataObj = new TemplateData("./test/stubs-1242/", eleventyConfig);
dataObj.setInputDir("./test/stubs-1242/");

let data = await dataObj.getData();

t.deepEqual(data, {
"xyz.dottest": {
hi: "bye",
test: {
abc: 42,
},
},
});
});

test("addGlobalData values", async (t) => {
let eleventyConfig = new TemplateConfig();
eleventyConfig.userConfig.addGlobalData("myFunction", () => "fn-value");
Expand Down
3 changes: 3 additions & 0 deletions test/stubs-1242/_data/xyz.dottest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"hi": "bye"
}
3 changes: 3 additions & 0 deletions test/stubs-1242/_data/xyz.dottest/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"abc": 42
}
Empty file added test/stubs-1242/empty.md
Empty file.

0 comments on commit 69c37b4

Please sign in to comment.