Skip to content

Commit

Permalink
Fix test under shadydom. Slight logic refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Apr 2, 2018
1 parent fb741ee commit 2128ebe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions lib/mixins/element-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,8 @@
this._importPath = meta.url.slice(0, meta.url.lastIndexOf('/') + 1);
} else {
const module = Polymer.DomModule && Polymer.DomModule.import(/** @type {PolymerElementConstructor} */ (this).is);
if (module) {
this._importPath = module ? module.assetpath : '';
} else {
this._importPath = Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.importPath;
}
this._importPath = (module && module.assetpath) ||
Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.importPath;
}
}
return this._importPath;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/resolveurl.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
var resolvedUrl = new RegExp(`${folder}/foo\\.z`);
var styleHashUrl = /url\('#bar'\)/;
var styleAbsUrl = /url\('\/zot'\)/;
var style = el.shadowRoot.querySelector('style') || document.querySelector('style[scope=p-r]');
var style = el.shadowRoot.querySelector('style') || document.querySelector(`style[scope=${elementName}]`);
assert.match(style.textContent, resolvedUrl, 'url not relative to main document');
assert.match(style.textContent, styleHashUrl, 'hash url incorrectly resolved');
assert.match(style.textContent, styleAbsUrl, 'absolute url incorrectly resolved');
Expand Down

0 comments on commit 2128ebe

Please sign in to comment.