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

Side by Side Diff: LayoutTests/fast/domurl/url-searchparams-append.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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-append">
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script>
6 test(function() {
7 var params = new URLSearchParams();
8 params.append('a', 'b');
9 assert_equals(params + '', 'a=b');
10 params.append('a', 'b');
11 assert_equals(params + '', 'a=b&a=b');
12 params.append('a', 'c');
13 assert_equals(params + '', 'a=b&a=b&a=c');
14 }, 'Append same name');
15
16 test(function() {
17 var params = new URLSearchParams();
18 params.append('', '');
19 assert_equals(params + '', '=');
20 params.append('', '');
21 assert_equals(params + '', '=&=');
22 }, 'Append empty strings');
23
24 test(function() {
25 var params = new URLSearchParams();
26 params.append(null, null);
27 assert_equals(params + '', 'null=null');
28 params.append(null, null);
29 assert_equals(params + '', 'null=null&null=null');
30 }, 'Append null');
31
32 test(function() {
33 var params = new URLSearchParams();
34 params.append('first', 1);
35 params.append('second', 2);
36 params.append('third', '');
37 params.append('first', 10);
38 assert_true(params.has('first'), 'Search params object has name "first"');
39 assert_equals(params.get('first'), '1', 'Search params object has name "firs t" with value "1"');
40 assert_equals(params.get('second'), '2', 'Search params object has name "sec ond" with value "2"');
41 assert_equals(params.get('third'), '', 'Search params object has name "secon d" with value "2"');
42 params.append('first', 10);
43 assert_equals(params.get('first'), '1', 'Search params object has name "firs t" with value "1"');
44 }, 'Append multiple');
45 </script>
OLDNEW
« no previous file with comments | « LayoutTests/fast/domurl/url-searchparams.html ('k') | LayoutTests/fast/domurl/url-searchparams-constructor.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698