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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 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 PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script src="script-tests/set-href-attribute-search.js"></script> 7 <script>
8 description('Test setting the search attribute of the URL in HTMLAnchorElement . ');
9
10 var a = document.createElement('a');
11
12 debug("Set search without '?'");
13 a.href = "https://www.mydomain.com/path/?key=value";
14 a.search = "value=key";
15 shouldBe("a.href", "'https://www.mydomain.com/path/?value=key'");
16
17 // IE8 does not encode spaces in search string
18 debug("Set search that starts with '?' and contains spaces");
19 a.href = "https://www.mydomain.com/path/?key=value";
20 a.search = "?val ue= key?";
21 shouldBe("a.href", "'https://www.mydomain.com/path/?val%20ue=%20key?'");
22
23 debug("Set search to a malformed URL");
24 a.href = "s:www.mydomain.com/path/";
25 a.search = "%";
26 shouldBe("a.href", "'s:www.mydomain.com/path/?%'");
27
28 // IE8 throws "The URL is invalid" exception.
29 debug("Set search containing '#'");
30 try {
31 a.href = "https://www.mydomain.com/path/?key=value#hash";
32 a.search = "?value#key";
33 shouldBe("a.href", "'https://www.mydomain.com/path/?value%23key#hash'");
34 } catch(e) {
35 debug("Exception: " + e.description);
36 }
37
38 debug("Set search to a malformed URL");
39 a.href = "bad:/|/url";
40 a.search = "?value=key";
41 shouldBe("a.href", "'bad:/|/url?value=key'");
42
43 debug("Set search to null");
44 a.href = "https://www.mydomain.com/path/?key=value";
45 a.search = null;
46 shouldBe("a.href", "'https://www.mydomain.com/path/?null'");
47
48 // Firefox 3.5.2 Removes the '?', and it should, per
49 // http://url.spec.whatwg.org/#dom-url-search
50 debug("Set search to empty string");
51 a.href = "https://www.mydomain.com/path/?key=value";
52 a.search = "";
53 shouldBe("a.href", "'https://www.mydomain.com/path/'");
54 </script>
8 </body> 55 </body>
9 </html> 56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698