Merge pull request #823 from fractal-surfing/with-inverse

Support inverse sections on the with helper
This commit is contained in:
Kevin Decker
2014-07-29 09:25:45 -05:00
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -185,6 +185,8 @@ function registerDefaultHelpers(instance) {
}
return fn(context, options);
} else {
return options.inverse(this);
}
});
+4
View File
@@ -44,6 +44,10 @@ describe('builtin helpers', function() {
var string = "{{#with person}}{{first}} {{last}}{{/with}}";
shouldCompileTo(string, {person: function() { return {first: "Alan", last: "Johnson"};}}, "Alan Johnson");
});
it("with with else", function() {
var string = "{{#with person}}Person is present{{else}}Person is not present{{/with}}";
shouldCompileTo(string, {}, "Person is not present");
});
});
describe('#each', function() {