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

Unified Diff: LayoutTests/fast/domurl/url-searchparams-has.html

Issue 143313002: Implement URLSearchParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 4 months 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: LayoutTests/fast/domurl/url-searchparams-has.html
diff --git a/LayoutTests/fast/domurl/url-searchparams-has.html b/LayoutTests/fast/domurl/url-searchparams-has.html
new file mode 100644
index 0000000000000000000000000000000000000000..3f44c78b0960ae1cf6d18727a64e859755907cdd
--- /dev/null
+++ b/LayoutTests/fast/domurl/url-searchparams-has.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<link rel="help" href="http://url.spec.whatwg.org/#interface-urlsearchparams-has">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.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>
« no previous file with comments | « LayoutTests/fast/domurl/url-searchparams-getAll.html ('k') | LayoutTests/fast/domurl/url-searchparams-set.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698