Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / domurl / url-search.html
blob79e169d3442da168958544a381140ed6aaa707eb
1 <!DOCTYPE HTML>
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-search">
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script>
7 test(function() {
8 var url = new URL('http://www.domain.com/');
9 assert_equals(url.search, '');
11 url = new URL('http://www.domain.com/?');
12 assert_equals(url.search, '');
14 url = new URL('http://www.domain.com/?a');
15 assert_equals(url.search, '?a');
17 url.search = '';
18 assert_equals(url.search, '');
19 assert_equals(url.toString(), 'http://www.domain.com/');
21 url.search = '?';
22 assert_equals(url.search, '');
23 assert_equals(url.toString(), 'http://www.domain.com/');
25 url.search = 'a';
26 assert_equals(url.search, '?a');
28 url.search = '?a';
29 assert_equals(url.search, '?a');
31 url.search = 'a#b';
32 assert_equals(url.search, '?a%23b');
34 url.search = 'a?b';
35 assert_equals(url.search, '?a?b');
36 }, 'Basic search');
38 test(function() {
39 var url = new URL('mailto:foo@bar.com');
40 assert_equals(url.search, '');
42 url.search = 'a';
43 assert_equals(url.search, '?a');
44 }, 'non hierarchical');
46 test(function() {
47 var url = new URL('http://abc.de:8080/path/file?query#fragment');
48 url.href = 'invalid';
49 assert_equals(url.search, '');
51 url.search = 'changed';
52 assert_equals(url.search, '');
53 assert_equals(url.href, 'invalid');
54 }, 'search property invalid URL');
56 </script>