Skip to content

Commit

Permalink
test for #677
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis Abril committed Apr 2, 2014
1 parent 4fc5f4c commit aa0278a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions view/mustache/mustache_test.js
Expand Up @@ -3570,4 +3570,22 @@ steal("can/model", "can/view/mustache", "can/test", function () {
map.attr('showPeople', true);
equal(ul.innerHTML, '<li>Curtis</li><li>Stan</li><li>David</li>', 'List got updated');
});

test('Mustache helper: if w/ each removing all content', function () {
var expected = '123content',
container = new can.Map({
items: [1,2,3]
});

var template = can.view.mustache('{{#if items.length}}{{#each items}}{{this}}{{/each}}content{{/if}}');
var frag = template(container);

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

equal(div.innerHTML, expected);

container.attr('items').replace([]);
equal(div.innerHTML, '');
});
});

0 comments on commit aa0278a

Please sign in to comment.