This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
153 additions
and
34 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
tests/html/polyfillWrapFlushCallback/upgradeInDefineCallOrder.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>customElements#polyfillWrapFlushCallback</title> | ||
<script> | ||
(window.customElements = window.customElements || {}).forcePolyfill = true; | ||
</script> | ||
<script src="../../../../es6-promise/dist/es6-promise.auto.min.js"></script> | ||
<script src="../../../../web-component-tester/browser.js"></script> | ||
<script src="../../../custom-elements.min.js"></script> | ||
</head> | ||
<body> | ||
<custom-element-0 id="elt_0_0"> | ||
<custom-element-1 id="elt_1_0"> | ||
<custom-element-2 id="elt_2_0"></custom-element-2> | ||
<custom-element-0 id="elt_0_1"> | ||
</custom-element-0> | ||
</custom-element-1> | ||
<custom-element-2 id="elt_2_1"> | ||
<custom-element-2 id="elt_2_2"></custom-element-2> | ||
</custom-element-2> | ||
<custom-element-0 id="elt_0_2"> | ||
<custom-element-1 id="elt_1_1"> | ||
</custom-element-1> | ||
<custom-element-2 id="elt_2_3"></custom-element-2> | ||
</custom-element-0> | ||
<custom-element-1 id="elt_1_2"></custom-element-1> | ||
</custom-element-0> | ||
<script> | ||
/** | ||
* @license | ||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
|
||
test('When a flush callback is installed and multiple calls to define are ' + | ||
'made calling the flush callback causes elements to upgrade in define-call ' + | ||
'order and then document order.', function() { | ||
let flush = undefined; | ||
customElements.polyfillWrapFlushCallback(fn => { | ||
flush = fn; | ||
}); | ||
|
||
const upgradeLog = []; | ||
class LogIDOnConstruct extends HTMLElement { | ||
constructor() { | ||
super(); | ||
upgradeLog.push(this.id); | ||
} | ||
} | ||
|
||
customElements.define('custom-element-0', class extends LogIDOnConstruct {}); | ||
customElements.define('custom-element-1', class extends LogIDOnConstruct {}); | ||
customElements.define('custom-element-2', class extends LogIDOnConstruct {}); | ||
|
||
assert.deepEqual(upgradeLog, []); | ||
|
||
flush(); | ||
|
||
assert.deepEqual(upgradeLog, [ | ||
"elt_0_0", | ||
"elt_0_1", | ||
"elt_0_2", | ||
"elt_1_0", | ||
"elt_1_1", | ||
"elt_1_2", | ||
"elt_2_0", | ||
"elt_2_1", | ||
"elt_2_2", | ||
"elt_2_3", | ||
]); | ||
}); | ||
</script> | ||
</body> | ||
</html> |