diff --git a/src/standard/resolveUrl.html b/src/standard/resolveUrl.html index f58ff0142d..9332798ec2 100644 --- a/src/standard/resolveUrl.html +++ b/src/standard/resolveUrl.html @@ -21,7 +21,7 @@ * @return {string} Rewritten URL relative to the import */ resolveUrl: function(url) { - return Polymer.ResolveUrl.resolveUrl(url, this.importPath); + return Polymer.ResolveUrl.resolveUrl(url, this._importPath); } }); diff --git a/test/unit/resolveurl.html b/test/unit/resolveurl.html index 416b720ef3..aa2bc651e6 100644 --- a/test/unit/resolveurl.html +++ b/test/unit/resolveurl.html @@ -119,6 +119,15 @@ assert.equal(actual, expected); }); + test('resolveUrl used in property default', function() { + var el = document.createElement('p-r'); + var expected = document.baseURI.replace(/[?#].*$/, ''); + expected = expected.split('/'); + expected.pop(); + expected = expected.join('/') + '/sub/foo.png'; + assert.equal(el.resolvedDefault, expected); + }); + test('Hybrid: Urls in styles and attributes', function() { var el = document.createElement('p-r-hybrid'); document.body.appendChild(el); @@ -138,6 +147,13 @@ assert.equal(el.$.hash.getAttribute('href'), '#foo.z', 'hash-only url should not be resolved'); assert.equal(el.$.absolute.getAttribute('href'), '/foo.z', 'absolute urls should not be resolved'); assert.equal(el.$.protocol.getAttribute('href'), 'data:foo.z', 'urls with other protocols should not be resolved'); + el.$.if.render(); + assert.match(Polymer.dom(el.root).querySelector('#importIf') + .getAttribute('url'), rx, 'url url not relative to main document'); + assert.match(Polymer.dom(el.root).querySelector('#resolveUrlIf') + .getAttribute('url'), rx, 'url url not relative to main document'); + assert.notMatch(Polymer.dom(el.root).querySelector('#rootIf') + .getAttribute('url'), rx, 'url url not relative to main document'); document.body.removeChild(el); }); diff --git a/test/unit/sub/resolveurl-elements.html b/test/unit/sub/resolveurl-elements.html index 6503acb256..ddb1c04296 100644 --- a/test/unit/sub/resolveurl-elements.html +++ b/test/unit/sub/resolveurl-elements.html @@ -28,7 +28,16 @@ @@ -50,6 +59,11 @@ Foo Foo Foo +