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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-set.html

Issue 1442643008: Implement 'URLSearchParams' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf8">
5 <link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-set">
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 <script src="resources/testharness-extras.js"></script>
9 <script>
10 test(function() {
11 var params = new URLSearchParams('a=b&c=d');
12 params.set('a', 'B');
13 assert_equals(params + '', 'a=B&c=d');
14 params = new URLSearchParams('a=b&c=d&a=e');
15 params.set('a', 'B');
16 assert_equals(params + '', 'a=B&c=d')
17 params.set('e', 'f');
18 assert_equals(params + '', 'a=B&c=d&e=f')
19 }, 'Set basics');
20
21 test(function() {
22 var params = new URLSearchParams('a=1&a=2&a=3');
23 assert_true(params.has('a'), 'Search params object has name "a"');
24 assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"');
25 params.set('first', 4);
26 assert_true(params.has('a'), 'Search params object has name "a"');
27 assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"');
28 params.set('a', 4);
29 assert_true(params.has('a'), 'Search params object has name "a"');
30 assert_equals(params.get('a'), '4', 'Search params object has name "a" with value "4"');
31 }, 'URLSearchParams.set');
32 </script>
33 </head>
34 </html>
35
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698