diff options
Diffstat (limited to 'testing/web-platform/tests/url/urlsearchparams-has.html')
-rw-r--r-- | testing/web-platform/tests/url/urlsearchparams-has.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/web-platform/tests/url/urlsearchparams-has.html b/testing/web-platform/tests/url/urlsearchparams-has.html new file mode 100644 index 000000000..1e583c6cf --- /dev/null +++ b/testing/web-platform/tests/url/urlsearchparams-has.html @@ -0,0 +1,36 @@ +<!doctype html> +<html> +<head> +<meta charset="utf8"> +<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-has"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/testharness-extras.js"></script> +<script> +test(function() { + var params = new URLSearchParams('a=b&c=d'); + assert_true(params.has('a')); + assert_true(params.has('c')); + assert_false(params.has('e')); + params = new URLSearchParams('a=b&c=d&a=e'); + assert_true(params.has('a')); + params = new URLSearchParams('=b&c=d'); + assert_true(params.has('')); + params = new URLSearchParams('null=a'); + assert_true(params.has(null)); +}, 'Has basics'); + +test(function() { + var params = new URLSearchParams('a=b&c=d&&'); + params.append('first', 1); + params.append('first', 2); + assert_true(params.has('a'), 'Search params object has name "a"'); + assert_true(params.has('c'), 'Search params object has name "c"'); + assert_true(params.has('first'), 'Search params object has name "first"'); + assert_false(params.has('d'), 'Search params object has no name "d"'); + params.delete('first'); + assert_false(params.has('first'), 'Search params object has no name "first"'); +}, 'has() following delete()'); +</script> +</head> +</html> |