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

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

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
(Empty)
1 description('Test setting the search attribute of the URL in HTMLAnchorElement . ');
2
3 var a = document.createElement('a');
4
5 debug("Set search without '?'");
6 a.href = "https://www.mydomain.com/path/?key=value";
7 a.search = "value=key";
8 shouldBe("a.href", "'https://www.mydomain.com/path/?value=key'");
9
10 // IE8 does not encode spaces in search string
11 debug("Set search that starts with '?' and contains spaces");
12 a.href = "https://www.mydomain.com/path/?key=value";
13 a.search = "?val ue= key?";
14 shouldBe("a.href", "'https://www.mydomain.com/path/?val%20ue=%20key?'");
15
16 debug("Set search to a malformed URL");
17 a.href = "s:www.mydomain.com/path/";
18 a.search = "%";
19 shouldBe("a.href", "'s:www.mydomain.com/path/?%'");
20
21 // IE8 throws "The URL is invalid" exception.
22 debug("Set search containing '#'");
23 try {
24 a.href = "https://www.mydomain.com/path/?key=value#hash";
25 a.search = "?value#key";
26 shouldBe("a.href", "'https://www.mydomain.com/path/?value%23key#hash'");
27 } catch(e) {
28 debug("Exception: " + e.description);
29 }
30
31 debug("Set search to a malformed URL");
32 a.href = "bad:/|/url";
33 a.search = "?value=key";
34 shouldBe("a.href", "'bad:/|/url?value=key'");
35
36 debug("Set search to null");
37 a.href = "https://www.mydomain.com/path/?key=value";
38 a.search = null;
39 shouldBe("a.href", "'https://www.mydomain.com/path/?null'");
40
41 // Firefox 3.5.2 Removes the '?', and it should, per
42 // http://url.spec.whatwg.org/#dom-url-search
43 debug("Set search to empty string");
44 a.href = "https://www.mydomain.com/path/?key=value";
45 a.search = "";
46 shouldBe("a.href", "'https://www.mydomain.com/path/'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698