Skip to content

Commit 09f6acf

Browse files
committed
Merge pull request #16 from PolymerElements/bicknellr/issue-9
#9: Adds test for comment node removal.
2 parents 6bf61f7 + 9ad29ca commit 09f6acf

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/test-fixture.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@
5555
<div id="QuxSibling"></div>
5656
</template>
5757
</test-fixture>
58+
<test-fixture id="CommentedSingleChildFixture">
59+
<template>
60+
<!-- comment -->
61+
<!-- comment -->
62+
<div id="Foo"></div>
63+
<!-- comment -->
64+
</template>
65+
</test-fixture>
66+
<test-fixture id="CommentedMultiChildFixture">
67+
<template>
68+
<!-- comment -->
69+
<div id="Bar">
70+
<div id="BarChild"></div>
71+
</div>
72+
<!-- comment -->
73+
<!-- comment -->
74+
<div id="BarSibling"></div>
75+
<!-- comment -->
76+
<div id="Baz"></div>
77+
</template>
78+
</test-fixture>
5879
<test-fixture id="AttachedFixture">
5980
<template>
6081
<x-custom></x-custom>
@@ -65,17 +86,23 @@
6586
var trivialFixture;
6687
var complexDomFixture;
6788
var multiTemplateFixture;
89+
var commentedSingleChildFixture;
90+
var commentedMultiChildFixture;
6891

6992
beforeEach(function () {
7093
trivialFixture = document.getElementById('TrivialFixture');
7194
complexDomFixture = document.getElementById('ComplexDomFixture');
7295
multiTemplateFixture = document.getElementById('MultiTemplateFixture');
96+
commentedSingleChildFixture = document.getElementById('CommentedSingleChildFixture');
97+
commentedMultiChildFixture = document.getElementById('CommentedMultiChildFixture');
7398
});
7499

75100
afterEach(function () {
76101
trivialFixture.restore();
77102
complexDomFixture.restore();
78103
multiTemplateFixture.restore();
104+
commentedSingleChildFixture.restore();
105+
commentedMultiChildFixture.restore();
79106
});
80107

81108
describe('an stamped-out fixture', function () {
@@ -179,6 +206,25 @@
179206
expect(groups[1][1]).to.be.instanceOf(HTMLElement);
180207
});
181208
});
209+
210+
describe('when there are comments in the template', function() {
211+
var el;
212+
var els;
213+
214+
beforeEach(function () {
215+
el = commentedSingleChildFixture.create();
216+
els = commentedMultiChildFixture.create();
217+
});
218+
219+
it('returns a single element if the template has a single child', function() {
220+
expect(el).to.be.instanceOf(HTMLElement);
221+
});
222+
223+
it('returns multiple elements if the template has multiple children', function() {
224+
expect(els).to.be.instanceOf(Array);
225+
expect(els.length).to.equal(3);
226+
});
227+
});
182228
});
183229

184230
describe('when the fixture global is called', function () {

0 commit comments

Comments
 (0)