mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
add a searchParamsSetHref test according to href setter change
This commit is contained in:
@@ -64,6 +64,23 @@
|
|||||||
testing.expectEqual(null, url.searchParams.get('a'));
|
testing.expectEqual(null, url.searchParams.get('a'));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script id=searchParamsSetHref>
|
||||||
|
url = new URL("https://foo.bar");
|
||||||
|
const searchParams = url.searchParams;
|
||||||
|
|
||||||
|
// SearchParams should be empty.
|
||||||
|
testing.expectEqual(0, searchParams.size);
|
||||||
|
|
||||||
|
url.href = "https://lightpanda.io?over=9000&light=panda";
|
||||||
|
// It won't hurt to check href and host too.
|
||||||
|
testing.expectEqual("https://lightpanda.io/?over=9000&light=panda", url.href);
|
||||||
|
testing.expectEqual("lightpanda.io", url.host);
|
||||||
|
// SearchParams should be updated too when URL is set.
|
||||||
|
testing.expectEqual(2, searchParams.size);
|
||||||
|
testing.expectEqual("9000", searchParams.get("over"));
|
||||||
|
testing.expectEqual("panda", searchParams.get("light"));
|
||||||
|
</script>
|
||||||
|
|
||||||
<script id=base>
|
<script id=base>
|
||||||
url = new URL('over?9000', 'https://lightpanda.io');
|
url = new URL('over?9000', 'https://lightpanda.io');
|
||||||
testing.expectEqual("https://lightpanda.io/over?9000", url.href);
|
testing.expectEqual("https://lightpanda.io/over?9000", url.href);
|
||||||
|
|||||||
Reference in New Issue
Block a user