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

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

Issue 1442643008: Implement 'URLSearchParams' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. 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="https://url.spec.whatwg.org/#dom-urlsearchparams-append">
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();
12 params.append('a', 'b');
13 assert_equals(params + '', 'a=b');
14 params.append('a', 'b');
15 assert_equals(params + '', 'a=b&a=b');
16 params.append('a', 'c');
17 assert_equals(params + '', 'a=b&a=b&a=c');
18 }, 'Append same name');
19
20 test(function() {
21 var params = new URLSearchParams();
22 params.append('', '');
23 assert_equals(params + '', '=');
24 params.append('', '');
25 assert_equals(params + '', '=&=');
26 }, 'Append empty strings');
27
28 test(function() {
29 var params = new URLSearchParams();
30 params.append(null, null);
31 assert_equals(params + '', 'null=null');
32 params.append(null, null);
33 assert_equals(params + '', 'null=null&null=null');
34 }, 'Append null');
35
36 test(function() {
37 var params = new URLSearchParams();
38 params.append('first', 1);
39 params.append('second', 2);
40 params.append('third', '');
41 params.append('first', 10);
42 assert_true(params.has('first'), 'Search params object has name "first"');
43 assert_equals(params.get('first'), '1', 'Search params object has name "firs t" with value "1"');
44 assert_equals(params.get('second'), '2', 'Search params object has name "sec ond" with value "2"');
45 assert_equals(params.get('third'), '', 'Search params object has name "third " with value ""');
46 params.append('first', 10);
47 assert_equals(params.get('first'), '1', 'Search params object has name "firs t" with value "1"');
48 }, 'Append multiple');
49 </script>
50 </head>
51 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698