Skip to content

Commit

Permalink
Add test for empty anonymous foreach templates too
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Dec 1, 2013
1 parent 8312dc7 commit 306e181
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/defaultBindings/foreachBehaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ describe('Binding: Foreach', function() {
expect(testNode.childNodes[0]).toContainHtml('<span data-bind="text: childprop">first child</span><span data-bind="text: childprop">second child</span>');
});

it('Should reject bindings where no template content is specified', function () {
testNode.innerHTML = "<div data-bind='foreach: [1, 2, 3]'></div>";
expect(function () {
ko.applyBindings({}, testNode);
}).toThrowContaining("no template content");
});

it('Should clean away any data values attached to the original template nodes before use', function() {
// Represents issue https://github.com/SteveSanderson/knockout/pull/420
testNode.innerHTML = "<div data-bind='foreach: [1, 2]'><span></span></div>";
Expand Down

0 comments on commit 306e181

Please sign in to comment.