test_table_2.html (2614B)
1 <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en"> 2 <html> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 5 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 6 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 7 8 <script type="application/javascript" 9 src="../common.js"></script> 10 <script type="application/javascript" 11 src="../role.js"></script> 12 13 <script type="text/javascript"> 14 15 function doTest() { 16 // Test table with role=alert. 17 var tableInterfaceExposed = true; 18 var accTable3 = getAccessible("table3", [nsIAccessibleTable], null, DONOTFAIL_IF_NO_INTERFACE); 19 if (!accTable3) 20 tableInterfaceExposed = false; 21 ok(tableInterfaceExposed, "table interface is not exposed"); 22 23 if (tableInterfaceExposed) { 24 testRole(accTable3, ROLE_ALERT); 25 26 is(accTable3.getCellAt(0, 0).firstChild.name, "cell0", "wrong cell"); 27 is(accTable3.getCellAt(0, 1).firstChild.name, "cell1", "wrong cell"); 28 } 29 30 // Test table with role=log and aria property in tr. We create accessible for 31 // tr in this case. 32 tableInterfaceExposed = true; 33 var accTable4 = getAccessible("table4", [nsIAccessibleTable], null, DONOTFAIL_IF_NO_INTERFACE); 34 if (!accTable4) 35 tableInterfaceExposed = false; 36 ok(tableInterfaceExposed, "table interface is not exposed"); 37 38 if (tableInterfaceExposed) { 39 let accNotCreated = (!isAccessible("tr")); 40 ok(!accNotCreated, "missed tr accessible"); 41 42 testRole(accTable4, ROLE_TABLE); 43 44 is(accTable4.getCellAt(0, 0).firstChild.name, "cell0", "wrong cell"); 45 is(accTable4.getCellAt(0, 1).firstChild.name, "cell1", "wrong cell"); 46 is(accTable4.getCellAt(1, 0).firstChild.name, "cell2", "wrong cell"); 47 is(accTable4.getCellAt(1, 1).firstChild.name, "cell3", "wrong cell"); 48 } 49 50 SimpleTest.finish(); 51 } 52 SimpleTest.waitForExplicitFinish(); 53 addA11yLoadEvent(doTest); 54 </script> 55 </head> 56 57 <body > 58 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=419811">Mozilla Bug 419811</a> 59 <p id="display"></p> 60 <div id="content" style="display: none"></div> 61 <pre id="test"> 62 </pre> 63 64 <!-- Test Table --> 65 <br><br><b> Testing Table:</b><br><br> 66 <center> 67 <table id="table3" border="1" role="alert"> 68 <tr> 69 <td>cell0</td> 70 <td>cell1</td> 71 </tr> 72 </table> 73 74 <table id="table4" border="1" role="log"> 75 <tr aria-live="polite" id="tr"> 76 <td>cell0</td> 77 <td>cell1</td> 78 </tr> 79 <tr> 80 <td>cell2</td> 81 <td>cell3</td> 82 </tr> 83 </table> 84 85 </center> 86 </body> 87 </html>