Skip to content

Commit

Permalink
URLSearchParams can result in ? removal from URL now
Browse files Browse the repository at this point in the history
Changes outcome of test added in #6445.

Tests for whatwg/url#336.
  • Loading branch information
annevk committed Jul 14, 2017
1 parent 125950d commit f90eada
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions url/urlsearchparams-delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@
var url = new URL('http://example.com/?param1&param2');
url.searchParams.delete('param1');
url.searchParams.delete('param2');
assert_equals(url.href, 'http://example.com/?', 'url.href has ?');
assert_equals(url.href, 'http://example.com/', 'url.href does not have ?');
assert_equals(url.search, '', 'url.search does not have ?');
}, 'Deleting all params keeps ? in URL');
}, 'Deleting all params removes ? from URL');

test(function() {
var url = new URL('http://example.com/?');
url.searchParams.delete('param1');
assert_equals(url.href, 'http://example.com/', 'url.href does not have ?');
assert_equals(url.search, '', 'url.search does not have ?');
}, 'Removing non-existent param removes ? from URL');
</script>
</head>
</html>
7 changes: 7 additions & 0 deletions url/urlsearchparams-sort.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,11 @@
}
}, "URL parse and sort: " + val.input)
})

test(function() {
const url = new URL("http://example.com/?")
url.searchParams.sort()
assert_equals(url.href, "http://example.com/")
assert_equals(url.search, "")
}, "Sorting non-existent params removes ? from URL")
</script>

0 comments on commit f90eada

Please sign in to comment.