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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/domurl/url-search.html

Issue 1860623002: Add support for URL.searchParams getter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-search"> 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-search">
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <script> 5 <script>
6
7 test(function() { 6 test(function() {
8 var url = new URL('http://www.domain.com/'); 7 var url = new URL('http://www.domain.com/');
9 assert_equals(url.search, ''); 8 assert_equals(url.search, '');
10 9
11 url = new URL('http://www.domain.com/?'); 10 url = new URL('http://www.domain.com/?');
12 assert_equals(url.search, ''); 11 assert_equals(url.search, '');
13 12
14 url = new URL('http://www.domain.com/?a'); 13 url = new URL('http://www.domain.com/?a');
15 assert_equals(url.search, '?a'); 14 assert_equals(url.search, '?a');
16 15
17 url.search = ''; 16 url.search = '';
18 assert_equals(url.search, ''); 17 assert_equals(url.search, '');
19 assert_equals(url.toString(), 'http://www.domain.com/'); 18 assert_equals(url.toString(), 'http://www.domain.com/');
20 19
21 url.search = '?'; 20 url.search = '?';
22 assert_equals(url.search, ''); 21 assert_equals(url.search, '');
23 assert_equals(url.toString(), 'http://www.domain.com/'); 22 assert_equals(url.toString(), 'http://www.domain.com/');
24 23
25 url.search = 'a'; 24 url.search = 'a';
26 assert_equals(url.search, '?a'); 25 assert_equals(url.search, '?a');
27 26
28 url.search = '?a'; 27 url.search = '?b';
29 assert_equals(url.search, '?a'); 28 assert_equals(url.search, '?b');
30 29
31 url.search = 'a#b'; 30 url.search = 'a#b';
32 assert_equals(url.search, '?a%23b'); 31 assert_equals(url.search, '?a%23b');
33 32
34 url.search = 'a?b'; 33 url.search = 'a?b';
35 assert_equals(url.search, '?a?b'); 34 assert_equals(url.search, '?a?b');
36 }, 'Basic search'); 35 }, 'Basic search');
37 36
38 test(function() { 37 test(function() {
39 var url = new URL('mailto:foo@bar.com'); 38 var url = new URL('mailto:foo@bar.com');
40 assert_equals(url.search, ''); 39 assert_equals(url.search, '');
41 40
42 url.search = 'a'; 41 url.search = 'a';
43 assert_equals(url.search, '?a'); 42 assert_equals(url.search, '?a');
44 }, 'non hierarchical'); 43 }, 'non hierarchical');
45 44
46 test(function() { 45 test(function() {
47 var url = new URL('http://abc.de:8080/path/file?query#fragment'); 46 var url = new URL('http://abc.de:8080/path/file?query#fragment');
48 url.href = 'invalid'; 47 url.href = 'invalid';
49 assert_equals(url.search, ''); 48 assert_equals(url.search, '');
50 49
51 url.search = 'changed'; 50 url.search = 'changed';
52 assert_equals(url.search, ''); 51 assert_equals(url.search, '');
53 assert_equals(url.href, 'invalid'); 52 assert_equals(url.href, 'invalid');
54 }, 'search property invalid URL'); 53 }, 'search property invalid URL');
55
56 </script> 54 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698