Skip to content

Commit

Permalink
Don't rely on dom-module synchronously until WCR.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Apr 5, 2018
1 parent 412bb1e commit e64bd0b
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions test/unit/sub/resolveurl-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,33 @@
</template>
</dom-module>
<script>
class PR extends Polymer.Element {
static get is() { return 'p-r'; }
}
customElements.define(PR.is, PR);
window.addEventListener('WebComponentsReady', () => {
class PR extends Polymer.Element {
static get is() { return 'p-r'; }
}
customElements.define(PR.is, PR);

class PRImportMeta extends Polymer.Element {
static get template() {
return Polymer.DomModule.import('p-r', 'template').cloneNode(true);
class PRImportMeta extends Polymer.Element {
static get template() {
return Polymer.DomModule.import('p-r', 'template').cloneNode(true);
}
static get importMeta() {
// Idiomatically, this would be `return import.meta`, but for purposes
// of stubbing the test without actual modules, it's shimmed
return { url: 'http://class.com/mymodule/index.js' };
}
}
static get importMeta() {
customElements.define('p-r-im', PRImportMeta);

const PRHybrid = Polymer({
is: 'p-r-hybrid',
_template: Polymer.DomModule.import('p-r', 'template').cloneNode(true),
// Idiomatically, this would be `return import.meta`, but for purposes
// of stubbing the test without actual modules, it's shimmed
return { url: 'http://class.com/mymodule/index.js' };
}
}
customElements.define('p-r-im', PRImportMeta);
importMeta: { url: 'http://hybrid.com/mymodule/index.js' }
});

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

</script>

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

0 comments on commit e64bd0b

Please sign in to comment.