Fix with operator in no @data mode

This commit is contained in:
kpdecker
2015-08-01 16:29:45 -05:00
parent e2ba22eaad
commit 231a8d7256
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -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);
+6
View File
@@ -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() {