Skip to content

Commit

Permalink
Fix with operator in no @DaTa mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Aug 1, 2015
1 parent e2ba22e commit 231a8d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/handlebars/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function registerDefaultHelpers(instance) {

return fn(context, {
data: data,
blockParams: Utils.blockParams([context], [data.contextPath])
blockParams: Utils.blockParams([context], [data && data.contextPath])
});
} else {
return options.inverse(this);
Expand Down
6 changes: 6 additions & 0 deletions spec/builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ describe('builtin helpers', function() {
var string = '{{#with person as |foo|}}{{foo.first}} {{last}}{{/with}}';
shouldCompileTo(string, {person: {first: 'Alan', last: 'Johnson'}}, 'Alan Johnson');
});
it('works when data is disabled', function() {
var template = CompilerContext.compile('{{#with person as |foo|}}{{foo.first}} {{last}}{{/with}}', {data: false});

var result = template({person: {first: 'Alan', last: 'Johnson'}});
equals(result, 'Alan Johnson');
});
});

describe('#each', function() {
Expand Down

0 comments on commit 231a8d7

Please sign in to comment.