From fc60f16475c3a204849371f485c9316af40765e7 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 6 Jan 2014 02:40:43 -0600 Subject: [PATCH] Fix DATA value in stringParams mode Fixes #699 --- lib/handlebars/compiler/ast.js | 1 + spec/string-params.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index 002fd3be6..dda682e7e 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -189,6 +189,7 @@ var AST = { LocationInfo.call(this, locInfo); this.type = "DATA"; this.id = id; + this.stringModeValue = id.stringModeValue; }, StringNode: function(string, locInfo) { diff --git a/spec/string-params.js b/spec/string-params.js index 920b85592..1cebc6f08 100644 --- a/spec/string-params.js +++ b/spec/string-params.js @@ -158,4 +158,19 @@ describe('string params mode', function() { var result = template({}, {helpers: helpers}); equals(result, "WITH"); }); + + it('should handle DATA', function() { + var template = CompilerContext.compile('{{foo @bar}}', { stringParams: true }); + + var helpers = { + foo: function(bar, options) { + equal(bar, 'bar'); + equal(options.types[0], 'DATA'); + return 'Foo!'; + } + }; + + var result = template({}, { helpers: helpers }); + equal(result, 'Foo!'); + }); });