Skip to content

Commit

Permalink
Add extra test for firstChild comment parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Sep 30, 2017
1 parent c051902 commit 37a6cde
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions spec/bindingAttributeBehaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,22 @@ describe('Binding attribute syntax', function() {
expect(testNode).toContainText('Hello Bert, Goodbye');
});

it('Should reject closing virtual bindings, when found as first child', function() {
testNode.innerHTML = "<!-- /ko -->";
it('Should reject closing virtual bindings without matching open, when found as a sibling', function() {
testNode.innerHTML = "<div></div><!-- /ko -->";
expect(function() {
ko.applyBindings(null, testNode);
}).toThrow();
});

it('Should reject closing virtual bindings without matching open, when found as a sibling', function() {
testNode.innerHTML = "<div></div><!-- /ko -->";
it('Should reject closing virtual bindings without matching open, when found as a a first child', function() {
testNode.innerHTML = "<div><!-- /ko --></div>";
expect(function() {
ko.applyBindings(null, testNode);
}).toThrow();
});

it('Should reject closing virtual bindings, when found as first child at the top level', function() {
testNode.innerHTML = "<!-- /ko -->";
expect(function() {
ko.applyBindings(null, testNode);
}).toThrow();
Expand All @@ -287,7 +294,6 @@ describe('Binding attribute syntax', function() {
}).toThrow();
});


it('Should reject opening virtual bindings that are not closed', function() {
testNode.innerHTML = "<!-- ko if: true -->";
expect(function() {
Expand Down

0 comments on commit 37a6cde

Please sign in to comment.