| <!DOCTYPE html> |
| <!-- |
| | This test ensures the interfaces that implement URLUtils is correct. |
| --> |
| <html> |
| <head> |
| <title>url-utils-interfaces</title> |
| <style> |
| #result { |
| width: 100px; |
| height:100px; |
| background-color:#0047AB; |
| } |
| </style> |
| </head> |
| <body> |
| |
| <div id="result"></div> |
| |
| <script> |
| function expect(condition) { |
| if (!condition) { |
| document.querySelector('#result').style.display = 'none'; |
| console.assert(); |
| } |
| } |
| |
| a = document.createElement('a'); |
| expect(a.href == ''); |
| expect(!a.hasAttribute('href')); |
| |
| a = document.createElement('a'); |
| a.href = 'http://www.youtube.com/tv'; |
| expect(a.href == 'http://www.youtube.com/tv'); |
| expect(a.getAttribute('href') == 'http://www.youtube.com/tv'); |
| |
| a.protocol = 'file'; |
| expect(a.href == 'file://www.youtube.com/tv'); |
| expect(a.getAttribute('href') == 'file://www.youtube.com/tv'); |
| |
| old_url = location.href; |
| // Due to CSP the following test cannot succeed. |
| // location.hash = 'my-hash'; |
| // expect(location.hash == '#my-hash'); |
| // expect(location.href == old_url + '#my-hash'); |
| </script> |
| |
| </body> |
| </html> |