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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search.html
index 668f9f802f6d6dee4873869260407449a89fc5ca..f37951b964c9bc44d9cc275756aeb18f55f5f0d3 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search.html
@@ -4,6 +4,53 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/set-href-attribute-search.js"></script>
+<script>
+description('Test setting the search attribute of the URL in HTMLAnchorElement .');
+
+var a = document.createElement('a');
+
+debug("Set search without '?'");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = "value=key";
+shouldBe("a.href", "'https://www.mydomain.com/path/?value=key'");
+
+// IE8 does not encode spaces in search string
+debug("Set search that starts with '?' and contains spaces");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = "?val ue= key?";
+shouldBe("a.href", "'https://www.mydomain.com/path/?val%20ue=%20key?'");
+
+debug("Set search to a malformed URL");
+a.href = "s:www.mydomain.com/path/";
+a.search = "%";
+shouldBe("a.href", "'s:www.mydomain.com/path/?%'");
+
+// IE8 throws "The URL is invalid" exception.
+debug("Set search containing '#'");
+try {
+a.href = "https://www.mydomain.com/path/?key=value#hash";
+a.search = "?value#key";
+shouldBe("a.href", "'https://www.mydomain.com/path/?value%23key#hash'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+debug("Set search to a malformed URL");
+a.href = "bad:/|/url";
+a.search = "?value=key";
+shouldBe("a.href", "'bad:/|/url?value=key'");
+
+debug("Set search to null");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = null;
+shouldBe("a.href", "'https://www.mydomain.com/path/?null'");
+
+// Firefox 3.5.2 Removes the '?', and it should, per
+// http://url.spec.whatwg.org/#dom-url-search
+debug("Set search to empty string");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = "";
+shouldBe("a.href", "'https://www.mydomain.com/path/'");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698