diff --git a/test/unit/resolveurl.html b/test/unit/resolveurl.html index 26d708b682..1794c28725 100644 --- a/test/unit/resolveurl.html +++ b/test/unit/resolveurl.html @@ -170,6 +170,38 @@ assert.equal(actual, expected); }); + test('resolveUrl when called with relative url and a bad baseURI', function () { + const el = document.querySelector('x-resolve'); + const expected = 'relative/path.png'; + const actual = + el.resolveUrl('relative/path.png', '/not/a/full/uri'); + assert.equal(actual, expected); + }); + + test('resolveUrl when called with a full url and a bad baseURI', function () { + const el = document.querySelector('x-resolve'); + const expected = 'https://example.com/foo.png'; + const actual = + el.resolveUrl('https://example.com/foo.png', '/not/a/full/uri'); + assert.equal(actual, expected); + }); + + test('resolveUrl when called with a protocol-relative url and a bad baseURI', function () { + const el = document.querySelector('x-resolve'); + const expected = '//example.com/foo.png'; + const actual = + el.resolveUrl('//example.com/foo.png', '/not/a/full/uri'); + assert.equal(actual, expected); + }); + + test('resolveUrl when called with a garbage url', function () { + const el = document.querySelector('x-resolve'); + const expected = '.../foo.png'; + const actual = + el.resolveUrl('.../foo.png', 'https://example.org/bar'); + assert.equal(actual, expected); + }); + test('resolveUrl api with assetpath', function() { var el = document.createElement('p-r-ap'); // Manually calculate expected URL, to avoid dependence on