Skip to content

Commit

Permalink
Add de-dupe tests for #3356
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jul 12, 2024
1 parent b5a88c6 commit 6db046f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/IdAttributePluginTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import test from "ava";
import { IdAttributePlugin } from "../src/Plugins/IdAttributePlugin.js";
import Eleventy from "../src/Eleventy.js";

test("Using the transform (and the filter too)", async (t) => {
test("Using the IdAttribute plugin #3356", async (t) => {
let elev = new Eleventy("./test/stubs-virtual/", "./test/stubs-virtual/_site", {
config: function (eleventyConfig) {
eleventyConfig.addPlugin(IdAttributePlugin);

eleventyConfig.addTemplate("test.njk", `<h1>This is a heading</h1><h2 id="already">This is another heading</h2>`, {});
eleventyConfig.addTemplate("test.njk", `<h1>This is a heading</h1><h2 id="already">This is another heading</h2><h2>This is another heading</h2><h3>This is another heading</h3>`, {});
},
});

elev.disableLogger();

let results = await elev.toJSON();
t.is(results[0].content, `<h1 id="this-is-a-heading">This is a heading</h1><h2 id="already">This is another heading</h2>`);
t.is(results[0].content, `<h1 id="this-is-a-heading">This is a heading</h1><h2 id="already">This is another heading</h2><h2 id="this-is-another-heading">This is another heading</h2><h3 id="this-is-another-heading-2">This is another heading</h3>`);
});

0 comments on commit 6db046f

Please sign in to comment.