1 module('micro-templating'); 2 3 test("list template", 1, function(){ 4 template = [ 5 "<ul>", 6 "<% for (var i=0; i < users.length; i++) { %>", 7 "<li><%= users[i].name %></li>", 8 "<% } %>", 9 "</ul>" 10 ]; 11 template = template.join(""); 12 list_users = tmpl(template); 13 data = {users: [{name:'me'}, {name: 'myself'}]} 14 equals(list_users(data), "<ul><li>me</li><li>myself</li></ul>"); 15 });