Fix bug where inverse section was being passed to subsequent helpers
This commit is contained in:
@@ -181,6 +181,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
this.declare('inverse', programGuid);
|
||||
|
||||
this.opcode('invokeProgram', null, params.length, !!block.mustache.hash);
|
||||
this.declare('inverse', null);
|
||||
this.opcode('append');
|
||||
},
|
||||
|
||||
|
||||
+10
-1
@@ -983,4 +983,13 @@ test("GH-94: Cannot read property of undefined", function() {
|
||||
var string = "{{#books}}{{title}}{{author.name}}{{/books}}";
|
||||
shouldCompileTo(string, data, "The origin of speciesCharles DarwinLazarillo de Tormes",
|
||||
"Renders without an undefined property error");
|
||||
});
|
||||
});
|
||||
|
||||
test("GH-150: Inverted sections print when they shouldn't", function() {
|
||||
var string = "{{^set}}not set{{/set}} :: {{#set}}set{{/set}}";
|
||||
|
||||
shouldCompileTo(string, {}, "not set :: ", "inverted sections run when property isn't present in context");
|
||||
shouldCompileTo(string, {set: undefined}, "not set :: ", "inverted sections run when property is undefined");
|
||||
shouldCompileTo(string, {set: false}, "not set :: ", "inverted sections run when property is false");
|
||||
shouldCompileTo(string, {set: true}, " :: set", "inverted sections don't run when property is true");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user