test_svg.html (2676B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>SVG Tree Tests</title> 5 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 6 7 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 8 9 <script type="application/javascript" 10 src="../common.js"></script> 11 <script type="application/javascript" 12 src="../role.js"></script> 13 14 <script type="application/javascript"> 15 function doTest() { 16 // svgText 17 var accTree = { 18 role: ROLE_DIAGRAM, 19 children: [ 20 { 21 role: ROLE_TEXT_CONTAINER, 22 children: [ 23 { 24 role: ROLE_TEXT_LEAF, 25 }, 26 ], 27 }, 28 ], 29 }; 30 testAccessibleTree("svgText", accTree); 31 32 // svg1 33 accTree = { 34 role: ROLE_DIAGRAM, 35 children: [] 36 }; 37 testAccessibleTree("svg1", accTree); 38 39 // svg2 40 accTree = { 41 role: ROLE_DIAGRAM, 42 children: [ 43 { 44 role: ROLE_GROUPING, 45 children: [] 46 } 47 ] 48 }; 49 testAccessibleTree("svg2", accTree); 50 51 // svg3 52 accTree = { 53 role: ROLE_DIAGRAM, 54 children: [ 55 { 56 role: ROLE_GRAPHIC, 57 children: [] 58 } 59 ] 60 }; 61 testAccessibleTree("svg3", accTree); 62 63 // svg4 64 accTree = { 65 role: ROLE_DIAGRAM, 66 children: [ 67 { 68 role: ROLE_GROUPING, 69 children: [ 70 { 71 role: ROLE_GRAPHIC, 72 children: [] 73 } 74 ] 75 } 76 ] 77 }; 78 testAccessibleTree("svg4", accTree); 79 80 SimpleTest.finish(); 81 } 82 83 SimpleTest.waitForExplicitFinish(); 84 addA11yLoadEvent(doTest); 85 </script> 86 </head> 87 <body> 88 <p id="display"></p> 89 <div id="content" style="display: none"></div> 90 <pre id="test"> 91 </pre> 92 <svg id="svgText"> 93 <text>This is some text</text> 94 </svg> 95 96 <!-- no accessible objects --> 97 <svg id="svg1"> 98 <g id="g1"> 99 <rect width="300" height="100" id="rect1" style="fill:#00f" /> 100 </g> 101 </svg> 102 103 <svg id="svg2"> 104 <g id="g2"> 105 <title>g</title> 106 <rect width="300" height="100" id="rect2" style="fill:#00f" /> 107 </g> 108 </svg> 109 110 <svg id="svg3"> 111 <g id="g3"> 112 <rect width="300" height="100" id="rect3" style="fill:#00f"> 113 <title>rect</title> 114 </rect> 115 </g> 116 </svg> 117 118 <svg id="svg4"> 119 <g id="g4"> 120 <title>g</title> 121 <rect width="300" height="100" id="rect4" style="fill:#00f"> 122 <title>rect</title> 123 </rect> 124 </g> 125 </svg> 126 </body> 127 </html>