Skip to content

Commit

Permalink
add test for issue mozilla#1029
Browse files Browse the repository at this point in the history
  • Loading branch information
devoidfury committed Jan 8, 2018
1 parent 77f0e2f commit 0509111
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/api.js
Expand Up @@ -44,6 +44,17 @@
expect(util.normEOL(test.render())).to.be('Test1\nTest2');
});

it('should only call the callback once when conditional import fails', function(done) {
var env = new Environment(new Loader(templatesPath));
var called = 0;
env.render('broken-conditional-include.njk',
function() {
expect(++called).to.be(1);
}
);
setTimeout(done, 0);
});

it('should handle correctly relative paths in renderString', function() {
var env = new Environment(new Loader(templatesPath));
expect(env.renderString('{% extends "./relative/test1.njk" %}{% block block1 %}Test3{% endblock %}', {}, {
Expand Down
3 changes: 3 additions & 0 deletions tests/templates/broken-conditional-include.njk
@@ -0,0 +1,3 @@
{% if not whatever %}
{% include "throws.njk" %}
{% endif %}
1 change: 1 addition & 0 deletions tests/templates/throws.njk
@@ -0,0 +1 @@
{{ nonExistentFn() }}

0 comments on commit 0509111

Please sign in to comment.