Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-has.html

Issue 1442643008: Implement 'URLSearchParams' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-has.html
diff --git a/third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-has.html b/third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-has.html
new file mode 100644
index 0000000000000000000000000000000000000000..e0202539dfd2a0d36e74d44be2defc17eb060bfc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-has.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf8">
+<link rel="help" href="https://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>

Powered by Google App Engine
This is Rietveld 408576698