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