Skip to content

Commit

Permalink
Adding test for #750
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis Abril authored and daffl committed Apr 9, 2014
1 parent 1ae49ea commit 4e0270f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions view/mustache/mustache_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3571,6 +3571,30 @@ steal("can/model", "can/view/mustache", "can/test", function () {
equal(ul.innerHTML, '<li>Curtis</li><li>Stan</li><li>David</li>', 'List got updated');
});

test('each with child objects (#750)', function() {
var list = new can.List([{
i: 0
}, {
i: 1
}, {
i: 2
}]);

var template = can.view.mustache('{{#each list}}{{i}}{{/each}}');

var frag = template({
list: list
});

var div = document.createElement('div');
div.appendChild(frag);

equal(div.innerHTML, '012');

list.pop();
equal(div.innerHTML, '01');
});

test('Mustache helper: if w/ each removing all content', function () {
var expected = '123content',
container = new can.Map({
Expand Down

0 comments on commit 4e0270f

Please sign in to comment.