test_txtcntr.html (5838B)
1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <title>HTML text containers tests</title> 6 <link rel="stylesheet" type="text/css" 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 11 <script type="application/javascript" 12 src="../common.js"></script> 13 <script type="application/javascript" 14 src="../role.js"></script> 15 16 <script type="application/javascript"> 17 function doTest() { 18 var accTree = { 19 role: ROLE_SECTION, 20 children: [ 21 { // text child 22 role: ROLE_TEXT_LEAF, 23 children: [], 24 }, 25 ], 26 }; 27 28 testAccessibleTree("c1", accTree); 29 testAccessibleTree("c2", accTree); 30 31 accTree = { 32 role: ROLE_SECTION, 33 children: [ 34 { 35 role: ROLE_TEXT_LEAF, 36 name: "Hello1", 37 }, 38 { 39 role: ROLE_WHITESPACE, 40 }, 41 { 42 role: ROLE_TEXT_LEAF, 43 name: "Hello2", 44 }, 45 { 46 role: ROLE_SEPARATOR, 47 }, 48 { 49 role: ROLE_TEXT_LEAF, 50 name: "Hello3 ", 51 }, 52 { 53 role: ROLE_PARAGRAPH, 54 children: [ 55 { 56 role: ROLE_TEXT_LEAF, 57 name: "Hello4 ", 58 }, 59 ], 60 }, 61 ], 62 }; 63 64 testAccessibleTree("c3", accTree); 65 66 // contentEditable div 67 accTree = { 68 role: ROLE_SECTION, 69 children: [ 70 { 71 role: ROLE_TEXT_LEAF, 72 name: "helllo ", 73 }, 74 { 75 role: ROLE_PARAGRAPH, 76 children: [ 77 { 78 role: ROLE_TEXT_LEAF, 79 name: "blabla", 80 }, 81 ], 82 }, 83 { 84 role: ROLE_TEXT_LEAF, 85 name: "hello ", 86 }, 87 ], 88 }; 89 90 testAccessibleTree("c4", accTree); 91 92 // blockquote 93 accTree = { 94 role: ROLE_SECTION, 95 children: [ 96 { // block quote 97 role: ROLE_BLOCKQUOTE, 98 children: [ 99 { // text child 100 role: ROLE_TEXT_LEAF, 101 name: "Hello", 102 children: [], 103 }, 104 ], 105 }, 106 ], 107 }; 108 109 testAccessibleTree("c5", accTree); 110 111 // abbreviation tag 112 accTree = { 113 role: ROLE_SECTION, 114 children: [ 115 { // text leaf 116 role: ROLE_TEXT_LEAF, 117 name: "This ", 118 children: [], 119 }, 120 { // abbr tag 121 role: ROLE_TEXT, 122 name: "accessibility", 123 children: [ 124 { // text leaf with actual text 125 role: ROLE_TEXT_LEAF, 126 name: "a11y", 127 children: [], 128 }, 129 ], 130 }, 131 { // text leaf 132 role: ROLE_TEXT_LEAF, 133 name: " test", 134 children: [], 135 }, 136 ], 137 }; 138 139 testAccessibleTree("c6", accTree); 140 141 // acronym tag 142 accTree = { 143 role: ROLE_SECTION, 144 children: [ 145 { // text leaf 146 role: ROLE_TEXT_LEAF, 147 name: "This ", 148 children: [], 149 }, 150 { // acronym tag 151 role: ROLE_TEXT, 152 name: "personal computer", 153 children: [ 154 { // text leaf with actual text 155 role: ROLE_TEXT_LEAF, 156 name: "PC", 157 children: [], 158 }, 159 ], 160 }, 161 { // text leaf 162 role: ROLE_TEXT_LEAF, 163 name: " is broken", 164 children: [], 165 }, 166 ], 167 }; 168 169 testAccessibleTree("c7", accTree); 170 171 // only whitespace between images should be exposed 172 accTree = { 173 SECTION: [ 174 { GRAPHIC: [] }, 175 { TEXT_LEAF: [] }, 176 { GRAPHIC: [] }, 177 ], 178 }; 179 testAccessibleTree("c8", accTree); 180 181 SimpleTest.finish(); 182 } 183 184 SimpleTest.waitForExplicitFinish(); 185 addA11yLoadEvent(doTest); 186 </script> 187 </head> 188 <body> 189 190 <a target="_blank" 191 title="overflowed content doesn't expose child text accessibles" 192 href="https://bugzilla.mozilla.org/show_bug.cgi?id=489306"> 193 Mozilla Bug 489306</a> 194 <a target="_blank" 195 title="Create child accessibles for text controls from native anonymous content" 196 href="https://bugzilla.mozilla.org/show_bug.cgi?id=542824"> 197 Mozilla Bug 542824</a> 198 <a target="_blank" 199 title="Update accessible tree on content insertion after layout" 200 href="https://bugzilla.mozilla.org/show_bug.cgi?id=498015"> 201 Mozilla Bug 498015</a> 202 203 <p id="display"></p> 204 <div id="content" style="display: none"></div> 205 <pre id="test"> 206 </pre> 207 208 <div id="c1" style="width: 100px; height: 100px; overflow: auto;"> 209 1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello 210 </div> 211 <div id="c2"> 212 1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello 213 </div> 214 <div id="c3"> 215 Hello1<br> 216 Hello2<hr> 217 Hello3 218 <p> 219 Hello4 220 </p> 221 </div> 222 <div id="c4" contentEditable="true"> 223 helllo <p>blabla</p> hello 224 </div> 225 <div id="c5"><blockquote>Hello</blockquote></div> 226 <div id="c6">This <abbr title="accessibility">a11y</abbr> test</div> 227 <div id="c7">This <acronym title="personal computer">PC</acronym> is broken</div> 228 229 <!-- Whitespace between images should be exposed. Whitespace between the 230 div and img tags will be inconsistent depending on the image cache 231 state and what optimizations layout was able to apply. --> 232 <div id="c8"><img src="../moz.png"> <img src="../moz.png"></div> 233 </body> 234 </html>