browser_treeupdate_table.js (1377B)
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 addAccessibleTask( 11 ` 12 <table id="table"> 13 <tr> 14 <td>cell1</td> 15 <td>cell2</td> 16 </tr> 17 </table>`, 18 async function (browser, accDoc) { 19 let table = findAccessibleChildByID(accDoc, "table"); 20 21 let tree = { 22 TABLE: [ 23 { ROW: [{ CELL: [{ TEXT_LEAF: [] }] }, { CELL: [{ TEXT_LEAF: [] }] }] }, 24 ], 25 }; 26 testAccessibleTree(table, tree); 27 28 let onReorder = waitForEvent(EVENT_REORDER, "table"); 29 await invokeContentTask(browser, [], () => { 30 // append a caption, it should appear as a first element in the 31 // accessible tree. 32 let doc = content.document; 33 let caption = doc.createElement("caption"); 34 caption.textContent = "table caption"; 35 doc.getElementById("table").appendChild(caption); 36 }); 37 await onReorder; 38 39 tree = { 40 TABLE: [ 41 { CAPTION: [{ TEXT_LEAF: [] }] }, 42 { ROW: [{ CELL: [{ TEXT_LEAF: [] }] }, { CELL: [{ TEXT_LEAF: [] }] }] }, 43 ], 44 }; 45 testAccessibleTree(table, tree); 46 }, 47 { iframe: true, remoteIframe: true } 48 );