Added tests for templates with regex-significant characters in their delimiters

This commit is contained in:
Rick Fletcher
2010-02-23 23:41:51 -08:00
parent 11e7af06e9
commit 625adb81a3

View File

@@ -55,6 +55,19 @@ $(document).ready(function() {
var customQuote = _.template("It's its, not it's");
equals(customQuote({}), "It's its, not it's");
_.templateSettings = {
start : '<?',
end : '?>',
interpolate : /<\?=(.+?)\?>/g
};
var customWithSpecialChars = _.template("<ul><? for (key in people) { ?><li><?= people[key] ?></li><? } ?></ul>");
result = customWithSpecialChars({people : {moe : "Moe", larry : "Larry", curly : "Curly"}});
equals(result, "<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>", 'can run arbitrary javascript in templates');
var customWithSpecialCharsQuote = _.template("It's its, not it's");
equals(customWithSpecialCharsQuote({}), "It's its, not it's");
_.templateSettings = {
start : '{{',
end : '}}',