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

Unified Diff: LayoutTests/fast/domurl/url-searchparams-set.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-set.html
diff --git a/LayoutTests/fast/domurl/url-searchparams-set.html b/LayoutTests/fast/domurl/url-searchparams-set.html
new file mode 100644
index 0000000000000000000000000000000000000000..f4c1747af28e8a03878722e9ca70da3805a700ce
--- /dev/null
+++ b/LayoutTests/fast/domurl/url-searchparams-set.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<link rel="help" href="http://url.spec.whatwg.org/#interface-urlsearchparams-set">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ var params = new URLSearchParams('a=b&c=d');
+ params.set('a', 'B');
+ assert_equals(params + '', 'a=B&c=d');
+ params = new URLSearchParams('a=b&c=d&a=e');
+ params.set('a', 'B');
+ assert_equals(params + '', 'a=B&c=d')
+ params.set('e', 'f');
+ assert_equals(params + '', 'a=B&c=d&e=f')
+}, 'Set basics');
+
+test(function() {
+ var params = new URLSearchParams('a=1&a=2&a=3');
+ assert_true(params.has('a'), 'Search params object has name "a"');
+ assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"');
+ params.set('first', 4);
+ assert_true(params.has('a'), 'Search params object has name "a"');
+ assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"');
+ params.set('a', 4);
+ assert_true(params.has('a'), 'Search params object has name "a"');
+ assert_equals(params.get('a'), '4', 'Search params object has name "a" with value "4"');
+}, 'URLSearchParams.set');
+</script>
« no previous file with comments | « LayoutTests/fast/domurl/url-searchparams-has.html ('k') | LayoutTests/fast/domurl/url-searchparams-toString.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698