Skip to content

Commit

Permalink
Upstreaming cl/245273850
Browse files Browse the repository at this point in the history
  • Loading branch information
aomarks committed May 7, 2019
1 parent 3b6f334 commit 413ef2f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/unit/resolveurl.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 413ef2f

Please sign in to comment.