mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Added tests for templates with regex-significant characters in their delimiters
This commit is contained in:
@@ -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 : '}}',
|
||||
|
||||
Reference in New Issue
Block a user