Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #571, make asyncif handle error #634

Merged
merged 3 commits into from
Jan 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ var Compiler = Object.extend({
compileIfAsync: function(node, frame) {
this.emit('(function(cb) {');
this.compileIf(node, frame, true);
this.emit('})(function() {');
this.emit('})(' + this.makeCallback());
this.addScopeLevel();
},

Expand Down
14 changes: 14 additions & 0 deletions tests/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,20 @@
finish(done);
});

it('should throw an error when including a file that calls an undefined macro even inside {% if %} tag', function(done) {
render(
'{% if true %}{% include "undefined-macro.html" %}{% endif %}',
{},
{ noThrow: true },
function(err, res) {
expect(res).to.be(undefined);
expect(err).to.match(/Unable to call `\w+`, which is undefined or falsey/);
}
);

finish(done);
});

it('should throw an error when including a file that imports macro that calls an undefined macro', function(done) {
render(
'{% include "import-macro-call-undefined-macro.html" %}',
Expand Down