diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index c702d00bf..db0f39cd8 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -276,7 +276,7 @@ Compiler.prototype = { throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); } else { this.ID(id); - this.opcode('invokeHelper', params.length, name, sexpr.isRoot); + this.opcode('invokeHelper', params.length, id.original, sexpr.isRoot); } }, diff --git a/spec/helpers.js b/spec/helpers.js index ccde982ba..6ba368e4d 100644 --- a/spec/helpers.js +++ b/spec/helpers.js @@ -291,6 +291,7 @@ describe('helpers', function() { shouldCompileTo(string, [hash, helpers], "Message: Goodbye cruel world", "block helpers with multiple params"); }); }); + describe('hash', function() { it("helpers can take an optional hash", function() { var template = CompilerContext.compile('{{goodbye cruel="CRUEL" world="WORLD" times=12}}'); @@ -473,6 +474,9 @@ describe('helpers', function() { blockHelperMissing: function() { return 'missing: ' + arguments[arguments.length-1].name; }, + helperMissing: function() { + return 'helper missing: ' + arguments[arguments.length-1].name; + }, helper: function() { return 'ran: ' + arguments[arguments.length-1].name; } @@ -502,6 +506,10 @@ describe('helpers', function() { it('should include full id', function() { shouldCompileTo('{{#foo.helper}}{{/foo.helper}}', [{foo: {}}, helpers], 'missing: foo.helper'); }); + + it('should include full id if a hash is passed', function() { + shouldCompileTo('{{#foo.helper bar=baz}}{{/foo.helper}}', [{foo: {}}, helpers], 'helper missing: foo.helper'); + }); }); describe('name conflicts', function() {