Skip to content

Commit 2c5bce4

Browse files
committed
Test polyfills
1 parent 1156dd9 commit 2c5bce4

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

test-fixture.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,15 @@
235235

236236
forcePolyfillAttachedStateSynchrony: function () {
237237
// Force synchrony in attachedCallback and detachedCallback where
238-
// implemented, in the event that we are dealing with the async Web
239-
// Components Polyfill.
240-
if (window.CustomElements && window.CustomElements.takeRecords) {
238+
// implemented, in the event that we are dealing with one of these async
239+
// polyfills:
240+
// 1. Web Components CustomElements polyfill (v1 or v0).
241+
if (window.customElements && window.customElements.flush) {
242+
window.customElements.flush();
243+
} else if (window.CustomElements && window.CustomElements.takeRecords) {
241244
window.CustomElements.takeRecords();
242245
}
243-
// Force synchrony in ShadyDOM in case we are dealing with the polyfill.
246+
// 2. ShadyDOM polyfill.
244247
if (window.ShadyDOM) {
245248
window.ShadyDOM.flush();
246249
}

test/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
1616
<script src="../../web-component-tester/browser.js"></script>
1717

18-
<link rel="import" href="../../polymer/polymer.html">
19-
2018
</head>
2119
<body>
2220
<script>
2321
WCT.loadSuites([
24-
'test-fixture.html',
25-
'test-fixture-v1.html',
26-
'handle-multiple-registrations.html'
22+
'test-fixture.html', // shady
23+
'test-fixture.html?dom=shadow', // shadow
24+
'test-fixture-v1.html?wc-shadydom=true&wc-ce=true', // shady
25+
'test-fixture-v1.html', // shadow
26+
'handle-multiple-registrations.html',
2727
]);
2828
</script>
2929
</body>

test/test-fixture-v1.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
<body>
2222
<script>
2323
(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+
2428
function XCustom() {
2529
if (window.Reflect) {
2630
return Reflect.construct(HTMLElement, [], XCustom)

0 commit comments

Comments
 (0)