From 32397993952c1616ca70fc306e926b91f26ffee7 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 7 Jul 2017 17:47:47 +0800 Subject: [PATCH] URL: ensure deleting all params keeps ? in URL --- url/urlsearchparams-delete.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/url/urlsearchparams-delete.html b/url/urlsearchparams-delete.html index fca64621a02899..afc9c60c621992 100644 --- a/url/urlsearchparams-delete.html +++ b/url/urlsearchparams-delete.html @@ -36,6 +36,14 @@ params.delete('first'); assert_false(params.has('first'), 'Search params object has no "first" name'); }, 'Deleting appended multiple'); + +test(function() { + var url = new URL('http://example.com/?param1¶m2'); + url.searchParams.delete('param1'); + url.searchParams.delete('param2'); + assert_equals(url.href, 'http://example.com/?', 'url.href has ?'); + assert_equals(url.search, '', 'url.search does not have ?'); +}, 'Deleting all params keeps ? in URL');