Skip to content

Commit

Permalink
Add tests for html entities encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetf committed Apr 13, 2021
1 parent daf5020 commit d90c387
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/without-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ let posts = [
<!-- more -->
<p>block 2 <span>123</span></p>
<div>block3</div>`.trim()
},
{
path: '',
title: 'post with html entities',
excerpt: '',
layout: '',
content: `
<p>block 1 &lt;span&gt;</p>
<p>2</p><p>3</p><p>4</p>
<p>5</p><p>6</p><p>7</p>
<p>8</p><p>9</p><p>10</p>
<p>block 11 &lt;span&gt;</p>
`.trim()
}
];

Expand All @@ -73,4 +86,9 @@ describe('Automatic excerpt generator with default depth config', () => {
generatedPosts[2].data.excerpt.should.equal('');
});

it('post with html entities should have them intact', () => {
generatedPosts[3].data.excerpt.should.equal('<p>block 1 &lt;span&gt;</p>\n<p>2</p><p>3</p><p>4</p>\n<p>5</p><p>6</p><p>7</p>\n<p>8</p><p>9</p><p>10</p>');
generatedPosts[3].data.more.should.equal('\n<p>block 11 &lt;span&gt;</p>');
});

});

0 comments on commit d90c387

Please sign in to comment.