1 description('Test setting the href attribute of an HTMLAnchorElement to a URL with leading and trailing whitespace.');
3 var a
= document
.createElement('a');
5 debug("Set href that starts with a space");
6 a
.href
= " https://www.mydomain.com/path/testurl.html?key=value";
7 shouldBe("a.hostname", "'www.mydomain.com'");
9 debug("Set href that starts with a newline");
10 a
.href
= "\nhttps://www.mydomain.com/path/testurl.html?key=value";
11 shouldBe("a.hostname", "'www.mydomain.com'");
13 debug("Set href that starts with a tab");
14 a
.href
= "\thttps://www.mydomain.com/path/testurl.html?key=value";
15 shouldBe("a.hostname", "'www.mydomain.com'");
17 debug("Set href that starts with a carriage return");
18 a
.href
= "\rhttps://www.mydomain.com/path/testurl.html?key=value";
19 shouldBe("a.hostname", "'www.mydomain.com'");
21 debug("Set href that starts with a combination of newlines, spaces and tabs");
22 a
.href
= "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value";
23 shouldBe("a.hostname", "'www.mydomain.com'");
25 debug("Set href that ends with a space");
26 a
.href
= "https://www.mydomain.com/path/testurl.html?key=value ";
27 shouldBe("a.hostname", "'www.mydomain.com'");
29 debug("Set href that ends with a newline");
30 a
.href
= "https://www.mydomain.com/path/testurl.html?key=value\n";
31 shouldBe("a.hostname", "'www.mydomain.com'");
33 debug("Set href that ends with a tab");
34 a
.href
= "https://www.mydomain.com/path/testurl.html?key=value\t";
35 shouldBe("a.hostname", "'www.mydomain.com'");
37 debug("Set href that ends with a carriage return");
38 a
.href
= "https://www.mydomain.com/path/testurl.html?key=value\r";
39 shouldBe("a.hostname", "'www.mydomain.com'");
41 debug("Set href that ends with a combination of newlines, spaces and tabs");
42 a
.href
= "https://www.mydomain.com/path/testurl.html?key=value\n \t\r \n";
43 shouldBe("a.hostname", "'www.mydomain.com'");
45 debug("Set href that starts and ends with a combination of newlines, spaces and tabs");
46 a
.href
= "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value\n \t\r \n";
47 shouldBe("a.hostname", "'www.mydomain.com'");