diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index a8a68446..fd6cdc5a 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -117,7 +117,7 @@ var Handlebars = require('./base'); Handlebars.AST.BooleanNode = function(bool) { this.type = "BOOLEAN"; this.bool = bool; - this.stringModeValue = Boolean(bool); + this.stringModeValue = bool === "true"; }; Handlebars.AST.CommentNode = function(comment) { diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js index 6bc5a436..fb78c37c 100644 --- a/spec/qunit_spec.js +++ b/spec/qunit_spec.js @@ -1194,16 +1194,17 @@ test("when inside a block in String mode, .. passes the appropriate context in t }); test("in string mode, information about the types is passed along", function() { - var template = CompilerContext.compile('{{tomdale "need" dad.joke true}}', { stringParams: true }); + var template = CompilerContext.compile('{{tomdale "need" dad.joke true false}}', { stringParams: true }); var helpers = { - tomdale: function(desire, noun, bool, options) { + tomdale: function(desire, noun, trueBool, falseBool, options) { equal(options.types[0], 'STRING', "the string type is passed"); equal(options.types[1], 'ID', "the expression type is passed"); equal(options.types[2], 'BOOLEAN', "the expression type is passed"); equal(desire, "need", "the string form is passed for strings"); equal(noun, "dad.joke", "the string form is passed for expressions"); - equal(bool, true, "raw booleans are passed through"); + equal(trueBool, true, "raw booleans are passed through"); + equal(falseBool, false, "raw booleans are passed through"); return "Helper called"; } };