Skip to content

Commit

Permalink
Fix DATA value in stringParams mode
Browse files Browse the repository at this point in the history
Fixes #699
  • Loading branch information
kpdecker committed Jan 6, 2014
1 parent 08fab25 commit fc60f16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/handlebars/compiler/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ var AST = {
LocationInfo.call(this, locInfo);
this.type = "DATA";
this.id = id;
this.stringModeValue = id.stringModeValue;
},

StringNode: function(string, locInfo) {
Expand Down
15 changes: 15 additions & 0 deletions spec/string-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
});

0 comments on commit fc60f16

Please sign in to comment.