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