test_table.html (1935B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Table update tests</title> 5 <link rel="stylesheet" type="text/css" 6 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 7 8 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 9 10 <script type="application/javascript" 11 src="../common.js"></script> 12 <script type="application/javascript" 13 src="../role.js"></script> 14 <script type="application/javascript" 15 src="../events.js"></script> 16 17 <script type="application/javascript"> 18 19 function appendCaption(aTableID) { 20 this.invoke = function appendCaption_invoke() { 21 // append a caption, it should appear as a first element in the 22 // accessible tree. 23 var caption = document.createElement("caption"); 24 caption.textContent = "table caption"; 25 getNode(aTableID).appendChild(caption); 26 }; 27 28 this.eventSeq = [ 29 new invokerChecker(EVENT_REORDER, aTableID), 30 ]; 31 32 this.finalCheck = function appendCaption_finalCheck() { 33 var tree = 34 { TABLE: [ 35 { CAPTION: [ 36 { TEXT_LEAF: [] }, 37 ] }, 38 { ROW: [ 39 { CELL: [ {TEXT_LEAF: [] }]}, 40 { CELL: [ {TEXT_LEAF: [] }]}, 41 ] }, 42 ] }; 43 testAccessibleTree(aTableID, tree); 44 }; 45 46 this.getID = function appendCaption_getID() { 47 return "append caption"; 48 }; 49 } 50 51 function doTest() { 52 const gQueue = new eventQueue(); 53 gQueue.push(new appendCaption("table")); 54 gQueue.invoke(); // Will call SimpleTest.finish(); 55 } 56 57 SimpleTest.waitForExplicitFinish(); 58 addA11yLoadEvent(doTest); 59 </script> 60 </head> 61 <body> 62 <p id="display"></p> 63 <div id="content" style="display: none"></div> 64 <pre id="test"> 65 </pre> 66 67 <table id="table"> 68 <tr> 69 <td>cell1</td> 70 <td>cell2</td> 71 </tr> 72 </table> 73 </body> 74 </html>