Fixed bug where compiler was continuing to think it was looking at partials after the partial tag was done. Closes GH-14.

This commit is contained in:
Alan Johnson
2010-09-26 17:18:57 -04:00
parent f288a75e39
commit 4989f38ba2
2 changed files with 11 additions and 2 deletions
+9 -2
View File
@@ -325,7 +325,7 @@ test("basic partials", function() {
});
test("partials with context", function() {
var string = "Dudes: {{> dude dudes}}";
var string = "Dudes: {{>dude dudes}}";
var partial = "{{#this}}{{name}} ({{url}}) {{/this}}";
var hash = {dudes: [{name: "Yehuda", url: "http://yehuda"}, {name: "Alan", url: "http://alan"}]};
shouldCompileTo(string, [hash, {partials: {dude: partial}}], "Dudes: Yehuda (http://yehuda) Alan (http://alan) ",
@@ -333,7 +333,7 @@ test("partials with context", function() {
});
test("partial in a partial", function() {
var string = "Dudes: {{#dudes}}{{> dude}}{{/dudes}}";
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"}]};
@@ -347,6 +347,13 @@ test("rendering undefined partial throws an exception", function() {
}, Handlebars.Exception, "Should throw exception");
});
test("GH-14: a partial preceding a selector", function() {
var string = "Dudes: {{>dude}} {{another_dude}}";
var dude = "{{name}}";
var hash = {name:"Jeepers", another_dude:"Creepers"};
shouldCompileTo(string, [hash, {partials: {dude:dude}}], "Dudes: Jeepers Creepers", "Regular selectors can follow a partial");
});
module("safestring");
test("constructing a safestring from a string and checking its type", function() {