diff --git a/test/unit/resolveurl.html b/test/unit/resolveurl.html
index d5fec3440a..e1349cc369 100644
--- a/test/unit/resolveurl.html
+++ b/test/unit/resolveurl.html
@@ -14,10 +14,9 @@
-
@@ -56,10 +55,10 @@
import { setRootPath } from '../../lib/utils/settings.js';
suite('ResolveUrl', function() {
- const testStylesAndAttributes = (elementName, folder) => () => {
+ const testStylesAndAttributes = (elementName) => () => {
var el = document.createElement(elementName);
document.body.appendChild(el);
- var resolvedUrl = new RegExp(`${folder}/foo\\.z`);
+ var resolvedUrl = /sub\/foo\.z/;
var styleHashUrl = /url\('#bar'\)/;
var styleAbsUrl = /url\('\/zot'\)/;
var style = el.shadowRoot.querySelector('style') || document.querySelector(`style[scope=${elementName}]`);
@@ -84,11 +83,9 @@
document.body.removeChild(el);
};
- test('Urls in styles and attributes', testStylesAndAttributes('p-r', 'sub'));
-
- test('Urls in styles and attributes (importMeta)', testStylesAndAttributes('p-r-im', 'http://class.com/mymodule'));
+ test('Urls in styles and attributes', testStylesAndAttributes('p-r'));
- test('Urls in styles and attributes (importMeta, hybrid)', testStylesAndAttributes('p-r-hybrid', 'http://hybrid.com/mymodule'));
+ test('Urls in styles and attributes (hybrid)', testStylesAndAttributes('p-r-hybrid'));
test('url changes via setting importPath/rootPath on element instance', function() {
var el = document.createElement('p-r');
diff --git a/test/unit/sub/resolveurl-elements.js b/test/unit/sub/resolveurl-elements.js
index f82193096a..11b2e40f88 100644
--- a/test/unit/sub/resolveurl-elements.js
+++ b/test/unit/sub/resolveurl-elements.js
@@ -12,12 +12,14 @@ import { html } from '../../../lib/utils/html-tag.js';
import { PolymerElement } from '../../../polymer-element.js';
import { DomModule } from '../../../lib/elements/dom-module.js';
import { Polymer } from '../../../lib/legacy/polymer-fn.js';
-import { pathFromUrl } from '../utils/resolve-url.js';
+import { pathFromUrl } from '../../../lib/utils/resolve-url.js';
+
const $_documentContainer = document.createElement('div');
$_documentContainer.setAttribute('style', 'display: none;');
const baseAssetPath = pathFromUrl(import.meta.url);
$_documentContainer.innerHTML = ``;
document.head.appendChild($_documentContainer);
+
class PR extends PolymerElement {
static get template() {
return html`
@@ -44,29 +46,17 @@ class PR extends PolymerElement {
Foo
`;
}
-
static get is() { return 'p-r'; }
-}
-customElements.define(PR.is, PR);
-
-class PRImportMeta extends PolymerElement {
- static get template() {
- return PR.template;
- }
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' };
+ return import.meta;
}
}
-customElements.define('p-r-im', PRImportMeta);
+customElements.define(PR.is, PR);
const PRHybrid = Polymer({
is: 'p-r-hybrid',
_template: PR.template,
- // 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' }
+ importMeta: import.meta
});
class PRAp extends PolymerElement {