Add username / password attributes to HTMLAnchorElement / HTMLAreaElement
[WebKit-https.git] / LayoutTests / fast / dom / HTMLAnchorElement / set-href-attribute-user-pass.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <script>
8 description('Test setting the username / password attributes of the URL in HTMLAnchorElement.');
9
10 var a = document.createElement('a');
11
12 a.href = "https://www.mydomain.com:8080/path/testurl.html#middle";
13 a.username = "user";
14 shouldBe("a.href", "'https://user@www.mydomain.com:8080/path/testurl.html#middle'");
15
16 a.password = "password";
17 shouldBe("a.href", "'https://user:password@www.mydomain.com:8080/path/testurl.html#middle'");
18
19 a.username = null;
20 shouldBe("a.href", "'https://null:password@www.mydomain.com:8080/path/testurl.html#middle'");
21
22 a.password = null;
23 shouldBe("a.href", "'https://null:null@www.mydomain.com:8080/path/testurl.html#middle'");
24 </script>
25 <script src="../../../resources/js-test-post.js"></script>
26 </body>
27 </html>