@@ -272,7 +272,7 @@ Compiler.prototype = {
|
||||
|
||||
if (this.options.knownHelpers[name]) {
|
||||
this.opcode('invokeKnownHelper', params.length, name);
|
||||
} else if (this.knownHelpersOnly) {
|
||||
} else if (this.options.knownHelpersOnly) {
|
||||
throw new Error("You specified knownHelpersOnly, but used the unknown helper " + name);
|
||||
} else {
|
||||
this.opcode('invokeHelper', params.length, name);
|
||||
|
||||
@@ -709,6 +709,11 @@ test("Functions are bound to the context in knownHelpers only mode", function()
|
||||
var result = template({foo: function() { return this.bar; }, bar: 'bar'});
|
||||
equal(result, "bar", "'bar' should === '" + result);
|
||||
});
|
||||
test("Unknown helper call in knownHelpers only mode should throw", function() {
|
||||
shouldThrow(function() {
|
||||
CompilerContext.compile("{{typeof hello}}", {knownHelpersOnly: true});
|
||||
}, Error, 'specified knownHelpersOnly');
|
||||
});
|
||||
|
||||
suite("blockHelperMissing");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user