Skip to content

Commit

Permalink
add unit test for disableNunjucks property of renderer; PR #3573 #3573
Browse files Browse the repository at this point in the history
  • Loading branch information
think-in-universe committed Jun 13, 2019
1 parent 995097e commit d21aa32
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/fixtures/post_render.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ exports.expected = [
'<blockquote><p>quote content</p>\n',
'<footer><strong>Hello World</strong></footer></blockquote>'
].join('');

exports.expected_disable_nunjucks = [
'<h1 id="Title"><a href="#Title" class="headerlink" title="Title"></a>Title</h1>',
util.highlight(code, {lang: 'python'}),
'\n\n<p>some content</p>\n',
'<h2 id="Another-title"><a href="#Another-title" class="headerlink" title="Another title"></a>Another title</h2>',
'<p>{% blockquote %}<br>',
'quote content<br>',
'{% endblockquote %}</p>\n',
'<p>{% quote Hello World %}<br>',
'quote content<br>',
'{% endquote %}</p>'
].join('');
17 changes: 17 additions & 0 deletions test/scripts/hexo/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,4 +686,21 @@ describe('Post', () => {
callback();
});
});

// test for PR [#3573](https://github.com/hexojs/hexo/pull/3573)
it('render() - disableNunjucks', () => {
const renderer = hexo.render.renderer.get('markdown');
renderer.disableNunjucks = true;

return post.render(null, {
content: fixture.content,
engine: 'markdown'
}).then(data => {
data.content.trim().should.eql(fixture.expected_disable_nunjucks);
}).then(data => {
renderer.disableNunjucks = false;
});

});

});

0 comments on commit d21aa32

Please sign in to comment.