Skip to content

Commit 2cd9429

Browse files
committed
Test for #75
1 parent 1016319 commit 2cd9429

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

test/EleventyTest.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const test = require("ava");
2+
const Eleventy = require('@11ty/eleventy');
3+
4+
test("Diff output escaped #75", async t => {
5+
let elev = new Eleventy("./test/issue-75/", "./test/issue-75/_site/", {
6+
configPath: "./test/issue-75/.eleventy.js"
7+
});
8+
let json = await elev.toJSON();
9+
10+
t.is(json.length, 1);
11+
t.is(json[0].content.trim(), `<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>Hello<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span></code></pre>
12+
<pre class="language-diff-html"><code class="language-diff-html"><span class="token deleted-sign deleted language-html"><span class="token prefix deleted">-</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>Hello<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span></span></code></pre>`);
13+
});

test/JavaScriptFunctionTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test("JavaScript Function", async t => {
1212
t.is(`<pre class="language-js"><code class="language-js"><span class="token keyword">var</span> test<span class="token punctuation">;</span></code></pre>`, rendered);
1313
});
1414

15-
test("JavaScript Function Diff", async t => {
15+
test("JavaScript Function Diff #76", async t => {
1616
let elev = new Eleventy("./test/11tyjs-diff/", "./test/11tyjs-diff/_site/", {
1717
configPath: "./test/11tyjs-diff/.eleventy.js"
1818
});

test/issue-75/.eleventy.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const syntaxHighlight = require("../../");
2+
3+
module.exports = function(eleventyConfig) {
4+
eleventyConfig.addPlugin(syntaxHighlight);
5+
};

test/issue-75/index.njk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% highlight "html" %}
2+
<p>Hello</p>
3+
{% endhighlight %}
4+
{% highlight "diff-html" %}
5+
-<p>Hello</p>
6+
{% endhighlight %}

0 commit comments

Comments
 (0)