Skip to content

Commit 5128734

Browse files
committed
deal with HTMLElement override done by customElements polyfill
1 parent 2c5bce4 commit 5128734

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

test/test-fixture-v1.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
<head>
1313
<title>test-fixture</title>
1414

15+
<script>
16+
// Save original HTMLElement constructor since customElements v1 polyfill
17+
// overrides it https://github.com/webcomponents/webcomponentsjs/issues/623
18+
var _HTMLElement = window.HTMLElement;
19+
</script>
20+
1521
<script src="../../webcomponentsjs-v1/webcomponents-lite.js"></script>
1622
<script src="../../web-component-tester/browser.js"></script>
1723

@@ -21,10 +27,6 @@
2127
<body>
2228
<script>
2329
(function() {
24-
// Flag to enable takeRecords/flush for CustomElements v1 polyfill.
25-
// https://github.com/webcomponents/custom-elements#differences-from-spec
26-
customElements.enableFlush = true;
27-
2830
function XCustom() {
2931
if (window.Reflect) {
3032
return Reflect.construct(HTMLElement, [], XCustom)
@@ -177,7 +179,7 @@
177179

178180
describe('for a dom with a single root element', function () {
179181
it('returns a reference to the root element', function () {
180-
expect(el).to.be.instanceOf(HTMLElement);
182+
expect(el).to.be.instanceOf(_HTMLElement);
181183
});
182184
});
183185

@@ -196,8 +198,8 @@
196198

197199
it('returns an array of root elements', function () {
198200
expect(els).to.be.instanceOf(Array);
199-
expect(els[0]).to.be.instanceOf(HTMLElement);
200-
expect(els[1]).to.be.instanceOf(HTMLElement);
201+
expect(els[0]).to.be.instanceOf(_HTMLElement);
202+
expect(els[1]).to.be.instanceOf(_HTMLElement);
201203
});
202204
});
203205

@@ -215,10 +217,10 @@
215217

216218
it('returns an array with elements grouped by template', function () {
217219
expect(groups).to.be.instanceOf(Array);
218-
expect(groups[0]).to.be.instanceOf(HTMLElement);
220+
expect(groups[0]).to.be.instanceOf(_HTMLElement);
219221
expect(groups[1]).to.be.instanceOf(Array);
220-
expect(groups[1][0]).to.be.instanceOf(HTMLElement);
221-
expect(groups[1][1]).to.be.instanceOf(HTMLElement);
222+
expect(groups[1][0]).to.be.instanceOf(_HTMLElement);
223+
expect(groups[1][1]).to.be.instanceOf(_HTMLElement);
222224
});
223225
});
224226

@@ -232,7 +234,7 @@
232234
});
233235

234236
it('returns a single element if the template has a single child', function() {
235-
expect(el).to.be.instanceOf(HTMLElement);
237+
expect(el).to.be.instanceOf(_HTMLElement);
236238
});
237239

238240
it('returns multiple elements if the template has multiple children', function() {

0 commit comments

Comments
 (0)