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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-getall.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-getAll">
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 assert_array_equals(params.getAll('a'), ['b']);
13 assert_array_equals(params.getAll('c'), ['d']);
14 assert_array_equals(params.getAll('e'), []);
15 params = new URLSearchParams('a=b&c=d&a=e');
16 assert_array_equals(params.getAll('a'), ['b', 'e']);
17 params = new URLSearchParams('=b&c=d');
18 assert_array_equals(params.getAll(''), ['b']);
19 params = new URLSearchParams('a=&c=d&a=e');
20 assert_array_equals(params.getAll('a'), ['', 'e']);
21 }, 'getAll() basics');
22
23 test(function() {
24 var params = new URLSearchParams('a=1&a=2&a=3&a');
25 assert_true(params.has('a'), 'Search params object has name "a"');
26 var matches = params.getAll('a');
27 assert_true(matches && matches.length == 4, 'Search params object has values for name "a"');
28 assert_array_equals(matches, ['1', '2', '3', ''], 'Search params object has expected name "a" values');
29 params.set('a', 'one');
30 assert_equals(params.get('a'), 'one', 'Search params object has name "a" wit h value "one"');
31 var matches = params.getAll('a');
32 assert_true(matches && matches.length == 1, 'Search params object has values for name "a"');
33 assert_array_equals(matches, ['one'], 'Search params object has expected nam e "a" values');
34 }, 'getAll() multiples');
35 </script>
36 </head>
37 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698