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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-get.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-get">
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_equals(params.get('a'), 'b');
13 assert_equals(params.get('c'), 'd');
14 assert_equals(params.get('e'), null);
15 params = new URLSearchParams('a=b&c=d&a=e');
16 assert_equals(params.get('a'), 'b');
17 params = new URLSearchParams('=b&c=d');
18 assert_equals(params.get(''), 'b');
19 params = new URLSearchParams('a=&c=d&a=e');
20 assert_equals(params.get('a'), '');
21 }, 'Get basics');
22
23 test(function() {
24 var params = new URLSearchParams('first=second&third&&');
25 assert_true(params != null, 'constructor returned non-null value.');
26 assert_true(params.has('first'), 'Search params object has name "first"');
27 assert_equals(params.get('first'), 'second', 'Search params object has name "first" with value "second"');
28 assert_equals(params.get('third'), '', 'Search params object has name "third " with the empty value.');
29 assert_equals(params.get('fourth'), null, 'Search params object has no "four th" name and value.');
30 }, 'More get() basics');
31 </script>
32 </head>
33 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698