1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_base.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<head> 1.6 + <title>Test for base URIs</title> 1.7 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.8 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.9 + <base href="/tests/content/base/" /> 1.10 + <style> 1.11 + #bound { -moz-binding: url("test/file_base_xbl.xml#test"); } 1.12 + </style> 1.13 +</head> 1.14 +<body> 1.15 +<div id="1" xml:base="supercalifragilisticexpialidocious"><p><p xml:base="hello/"><p xml:base="world"><span xml:base="#iamtheverymodelofamodernmajorgeneral">text</span></p></p></p></div> 1.16 +<div id="bound"/> 1.17 +<pre id="test"> 1.18 +<script type="application/javascript"> 1.19 +SimpleTest.waitForExplicitFinish(); 1.20 +addLoadEvent(function() { 1.21 + is(document.baseURI, "http://mochi.test:8888/tests/content/base/", 1.22 + "document base"); 1.23 + is(document.body.baseURI, "http://mochi.test:8888/tests/content/base/", 1.24 + "body base"); 1.25 + 1.26 + var expected = 1.27 + ["http://mochi.test:8888/tests/content/base/supercalifragilisticexpialidocious", 1.28 + "http://mochi.test:8888/tests/content/base/supercalifragilisticexpialidocious", 1.29 + "http://mochi.test:8888/tests/content/base/hello/", 1.30 + "http://mochi.test:8888/tests/content/base/hello/world", 1.31 + "http://mochi.test:8888/tests/content/base/hello/world#iamtheverymodelofamodernmajorgeneral", 1.32 + "http://mochi.test:8888/tests/content/base/hello/world#iamtheverymodelofamodernmajorgeneral", 1.33 + ]; 1.34 + var node = document.getElementById("1"); 1.35 + while(node) { 1.36 + is(node.baseURI, expected.shift(), "node base"); 1.37 + node = node.firstChild; 1.38 + } 1.39 + is(expected.length, 0, "found all expected nodes"); 1.40 + 1.41 + var svgExpected = 1.42 + ["http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml", 1.43 + "http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml", 1.44 + "http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml#shesellsseashellsbytheseashore", 1.45 + ]; 1.46 + node = SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById("bound"))[0]; 1.47 + while(node) { 1.48 + is(node.baseURI, svgExpected.shift(), "node base"); 1.49 + node = node.firstChild; 1.50 + } 1.51 + is(svgExpected.length, 0, "found all expected nodes"); 1.52 + 1.53 + SimpleTest.finish(); 1.54 +}); 1.55 +</script> 1.56 +</pre> 1.57 +</body> 1.58 +</html>