browser_treeupdate_visibility.js (7691B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /* import-globals-from ../../mochitest/role.js */ 8 loadScripts({ name: "role.js", dir: MOCHITESTS_DIR }); 9 10 async function testTreeOnHide(browser, accDoc, containerID, id, before, after) { 11 let acc = findAccessibleChildByID(accDoc, containerID); 12 testAccessibleTree(acc, before); 13 14 let onReorder = waitForEvent(EVENT_REORDER, containerID); 15 await invokeSetStyle(browser, id, "visibility", "hidden"); 16 await onReorder; 17 18 testAccessibleTree(acc, after); 19 } 20 21 async function test3(browser, accessible) { 22 let tree = { 23 SECTION: [ 24 // container 25 { 26 SECTION: [ 27 // parent 28 { 29 SECTION: [ 30 // child 31 { TEXT_LEAF: [] }, 32 ], 33 }, 34 ], 35 }, 36 { 37 SECTION: [ 38 // parent2 39 { 40 SECTION: [ 41 // child2 42 { TEXT_LEAF: [] }, 43 ], 44 }, 45 ], 46 }, 47 ], 48 }; 49 testAccessibleTree(accessible, tree); 50 51 let onReorder = waitForEvent(EVENT_REORDER, "t3_container"); 52 await invokeContentTask(browser, [], () => { 53 let doc = content.document; 54 doc.getElementById("t3_container").style.color = "red"; 55 doc.getElementById("t3_parent").style.visibility = "hidden"; 56 doc.getElementById("t3_parent2").style.visibility = "hidden"; 57 }); 58 await onReorder; 59 60 tree = { 61 SECTION: [ 62 // container 63 { 64 SECTION: [ 65 // child 66 { TEXT_LEAF: [] }, 67 ], 68 }, 69 { 70 SECTION: [ 71 // child2 72 { TEXT_LEAF: [] }, 73 ], 74 }, 75 ], 76 }; 77 testAccessibleTree(accessible, tree); 78 } 79 80 async function test4(browser, accessible) { 81 let tree = { 82 SECTION: [{ TABLE: [{ ROW: [{ CELL: [] }] }] }], 83 }; 84 testAccessibleTree(accessible, tree); 85 86 let onReorder = waitForEvent(EVENT_REORDER, "t4_parent"); 87 await invokeContentTask(browser, [], () => { 88 let doc = content.document; 89 doc.getElementById("t4_container").style.color = "red"; 90 doc.getElementById("t4_child").style.visibility = "visible"; 91 }); 92 await onReorder; 93 94 tree = { 95 SECTION: [ 96 { 97 TABLE: [ 98 { 99 ROW: [ 100 { 101 CELL: [ 102 { 103 SECTION: [ 104 { 105 TEXT_LEAF: [], 106 }, 107 ], 108 }, 109 ], 110 }, 111 ], 112 }, 113 ], 114 }, 115 ], 116 }; 117 testAccessibleTree(accessible, tree); 118 } 119 120 addAccessibleTask( 121 "e10s/doc_treeupdate_visibility.html", 122 async function (browser, accDoc) { 123 let t3Container = findAccessibleChildByID(accDoc, "t3_container"); 124 let t4Container = findAccessibleChildByID(accDoc, "t4_container"); 125 126 await testTreeOnHide( 127 browser, 128 accDoc, 129 "t1_container", 130 "t1_parent", 131 { 132 SECTION: [ 133 { 134 SECTION: [ 135 { 136 SECTION: [{ TEXT_LEAF: [] }], 137 }, 138 ], 139 }, 140 ], 141 }, 142 { 143 SECTION: [ 144 { 145 SECTION: [{ TEXT_LEAF: [] }], 146 }, 147 ], 148 } 149 ); 150 151 await testTreeOnHide( 152 browser, 153 accDoc, 154 "t2_container", 155 "t2_grandparent", 156 { 157 SECTION: [ 158 { 159 // container 160 SECTION: [ 161 { 162 // grand parent 163 SECTION: [ 164 { 165 SECTION: [ 166 { 167 // child 168 TEXT_LEAF: [], 169 }, 170 ], 171 }, 172 { 173 SECTION: [ 174 { 175 // child2 176 TEXT_LEAF: [], 177 }, 178 ], 179 }, 180 ], 181 }, 182 ], 183 }, 184 ], 185 }, 186 { 187 SECTION: [ 188 { 189 // container 190 SECTION: [ 191 { 192 // child 193 TEXT_LEAF: [], 194 }, 195 ], 196 }, 197 { 198 SECTION: [ 199 { 200 // child2 201 TEXT_LEAF: [], 202 }, 203 ], 204 }, 205 ], 206 } 207 ); 208 209 await test3(browser, t3Container); 210 await test4(browser, t4Container); 211 212 await testTreeOnHide( 213 browser, 214 accDoc, 215 "t5_container", 216 "t5_subcontainer", 217 { 218 SECTION: [ 219 { 220 // container 221 SECTION: [ 222 { 223 // subcontainer 224 TABLE: [ 225 { 226 ROW: [ 227 { 228 CELL: [ 229 { 230 SECTION: [ 231 { 232 // child 233 TEXT_LEAF: [], 234 }, 235 ], 236 }, 237 ], 238 }, 239 ], 240 }, 241 ], 242 }, 243 ], 244 }, 245 ], 246 }, 247 { 248 SECTION: [ 249 { 250 // container 251 SECTION: [ 252 { 253 // child 254 TEXT_LEAF: [], 255 }, 256 ], 257 }, 258 ], 259 } 260 ); 261 262 await testTreeOnHide( 263 browser, 264 accDoc, 265 "t6_container", 266 "t6_subcontainer", 267 { 268 SECTION: [ 269 { 270 // container 271 SECTION: [ 272 { 273 // subcontainer 274 TABLE: [ 275 { 276 ROW: [ 277 { 278 CELL: [ 279 { 280 TABLE: [ 281 { 282 // nested table 283 ROW: [ 284 { 285 CELL: [ 286 { 287 SECTION: [ 288 { 289 // child 290 TEXT_LEAF: [], 291 }, 292 ], 293 }, 294 ], 295 }, 296 ], 297 }, 298 ], 299 }, 300 ], 301 }, 302 ], 303 }, 304 ], 305 }, 306 { 307 SECTION: [ 308 { 309 // child2 310 TEXT_LEAF: [], 311 }, 312 ], 313 }, 314 ], 315 }, 316 ], 317 }, 318 { 319 SECTION: [ 320 { 321 // container 322 SECTION: [ 323 { 324 // child 325 TEXT_LEAF: [], 326 }, 327 ], 328 }, 329 { 330 SECTION: [ 331 { 332 // child2 333 TEXT_LEAF: [], 334 }, 335 ], 336 }, 337 ], 338 } 339 ); 340 }, 341 { iframe: true, remoteIframe: true } 342 );