Ensure _.template supports single line comments in "evaluate" delimiters in minified builds. [closes #361]

This commit is contained in:
John-David Dalton
2013-10-05 23:21:47 -07:00
parent 624e4bca40
commit ba5e512d10
4 changed files with 9 additions and 4 deletions

View File

@@ -3975,12 +3975,17 @@
strictEqual(compiled({}), '1');
});
test('should coerce `text` argument to a string', function() {
test('should coerce `text` argument to a string', 1, function() {
var data = { 'a': 1 },
object = { 'toString': function() { return '<%= a %>'; } };
strictEqual(_.template(object, data), '1');
});
test('should support single line comments in "evaluate" delimiters (test production builds)', 1, function() {
var compiled = _.template('<% // comment %><% if (value) { %>yap<% } else { %>nope<% } %>');
equal(compiled({ 'value': true }), 'yap');
});
}());
/*--------------------------------------------------------------------------*/