Throw a handlebars exception when attempting to use template partials in VM mode.
This commit is contained in:
@@ -71,8 +71,10 @@ Handlebars.VM = {
|
||||
throw new Handlebars.Exception("The partial " + name + " could not be found");
|
||||
} else if(partial instanceof Function) {
|
||||
return partial(context, {helpers: helpers, partials: partials});
|
||||
} else if (false && !Handlebars.compile) {
|
||||
throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in vm mode");
|
||||
} else {
|
||||
partials[name] = Handlebars.VM.compile(partial);
|
||||
partials[name] = Handlebars.compile(partial);
|
||||
return partials[name](context, {helpers: helpers, partials: partials});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,6 +410,17 @@ test("rendering undefined partial throws an exception", function() {
|
||||
}, Handlebars.Exception, "Should throw exception");
|
||||
});
|
||||
|
||||
|
||||
test("rendering template partial in vm mode throws an exception", function() {
|
||||
shouldThrow(function() {
|
||||
var template = CompilerContext.compile("{{> whatever}}");
|
||||
var string = "Dudes: {{>dude}} {{another_dude}}";
|
||||
var dude = "{{name}}";
|
||||
var hash = {name:"Jeepers", another_dude:"Creepers"};
|
||||
template();
|
||||
}, Handlebars.Exception, "Should throw exception");
|
||||
});
|
||||
|
||||
test("GH-14: a partial preceding a selector", function() {
|
||||
var string = "Dudes: {{>dude}} {{another_dude}}";
|
||||
var dude = "{{name}}";
|
||||
|
||||
Reference in New Issue
Block a user