Skip to content

Commit e64bd0b

Browse files
committed
Don't rely on dom-module synchronously until WCR.
1 parent 412bb1e commit e64bd0b

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

test/unit/sub/resolveurl-elements.html

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,33 @@
3434
</template>
3535
</dom-module>
3636
<script>
37-
class PR extends Polymer.Element {
38-
static get is() { return 'p-r'; }
39-
}
40-
customElements.define(PR.is, PR);
37+
window.addEventListener('WebComponentsReady', () => {
38+
class PR extends Polymer.Element {
39+
static get is() { return 'p-r'; }
40+
}
41+
customElements.define(PR.is, PR);
4142

42-
class PRImportMeta extends Polymer.Element {
43-
static get template() {
44-
return Polymer.DomModule.import('p-r', 'template').cloneNode(true);
43+
class PRImportMeta extends Polymer.Element {
44+
static get template() {
45+
return Polymer.DomModule.import('p-r', 'template').cloneNode(true);
46+
}
47+
static get importMeta() {
48+
// Idiomatically, this would be `return import.meta`, but for purposes
49+
// of stubbing the test without actual modules, it's shimmed
50+
return { url: 'http://class.com/mymodule/index.js' };
51+
}
4552
}
46-
static get importMeta() {
53+
customElements.define('p-r-im', PRImportMeta);
54+
55+
const PRHybrid = Polymer({
56+
is: 'p-r-hybrid',
57+
_template: Polymer.DomModule.import('p-r', 'template').cloneNode(true),
4758
// Idiomatically, this would be `return import.meta`, but for purposes
4859
// of stubbing the test without actual modules, it's shimmed
49-
return { url: 'http://class.com/mymodule/index.js' };
50-
}
51-
}
52-
customElements.define('p-r-im', PRImportMeta);
60+
importMeta: { url: 'http://hybrid.com/mymodule/index.js' }
61+
});
5362

54-
const PRHybrid = Polymer({
55-
is: 'p-r-hybrid',
56-
_template: Polymer.DomModule.import('p-r', 'template').cloneNode(true),
57-
// Idiomatically, this would be `return import.meta`, but for purposes
58-
// of stubbing the test without actual modules, it's shimmed
59-
importMeta: { url: 'http://hybrid.com/mymodule/index.js' }
6063
});
61-
6264
</script>
6365

6466
<dom-module id="p-r-ap" assetpath="../../assets/"></dom-module>

0 commit comments

Comments
 (0)