Added test for a partial inside of a partial.
This commit is contained in:
@@ -2,6 +2,8 @@ Handlebars = {
|
||||
compile: function(string) {
|
||||
var compiler = new Handlebars.Compiler(string);
|
||||
var result = compiler.compile();
|
||||
console.log("Template: " + string);
|
||||
console.log("Code: " + result);
|
||||
return new Function("context", "fallback", "fallback = fallback || {}; var stack = [];var partials = {};" + result);
|
||||
},
|
||||
|
||||
|
||||
@@ -198,6 +198,14 @@ test("partials with context", function() {
|
||||
"Partials can be passed a context");
|
||||
});
|
||||
|
||||
test("partial in a partial", function() {
|
||||
var string = "Dudes: {{#dudes}}{{> dude}}{{/dudes}}";
|
||||
var dude = "{{name}} {{> url}} ";
|
||||
var url = "<a href={{url}}>{{url}}</a>";
|
||||
var hash = {dudes: [{name: "Yehuda", url: "http://yehuda"}, {name: "Alan", url: "http://alan"}]};
|
||||
shouldCompileTo(string, [hash, {partials: {dude: dude, url: url}}], "Dudes: Yehuda <a href=http://yehuda>http://yehuda</a> Alan <a href=http://alan>http://alan</a> ", "Partials are rendered inside of other partials");
|
||||
});
|
||||
|
||||
module("safestring");
|
||||
|
||||
test("constructing a safestring from a string and checking its type", function() {
|
||||
|
||||
Reference in New Issue
Block a user