accessible/tests/mochitest/table/test_table_2.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/table/test_table_2.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,99 @@
     1.4 +<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
     1.5 +<html>
     1.6 + <head>
     1.7 +  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     1.8 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     1.9 +  <script type="application/javascript"
    1.10 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="../common.js"></script>
    1.14 +  <script type="application/javascript"
    1.15 +          src="../role.js"></script>
    1.16 +
    1.17 +  <script type="text/javascript">
    1.18 +
    1.19 +function doTest()
    1.20 +{
    1.21 +  // Test table with role=alert. 
    1.22 +  var tableInterfaceExposed = true;
    1.23 +  var accTable3 = getAccessible("table3", [nsIAccessibleTable], null, DONOTFAIL_IF_NO_INTERFACE);
    1.24 +  if (!accTable3)
    1.25 +    tableInterfaceExposed = false;  
    1.26 +  ok(tableInterfaceExposed, "table interface is not exposed");
    1.27 +
    1.28 +  if (tableInterfaceExposed) {
    1.29 +    testRole(accTable3, ROLE_ALERT);
    1.30 +
    1.31 +    is(accTable3.getCellAt(0,0).firstChild.name, "cell0", "wrong cell");
    1.32 +    is(accTable3.getCellAt(0,1).firstChild.name, "cell1", "wrong cell");
    1.33 +  }
    1.34 +
    1.35 +  // Test table with role=log and aria property in tr. We create accessible for
    1.36 +  // tr in this case.
    1.37 +  tableInterfaceExposed = true;
    1.38 +  var accTable4 = getAccessible("table4", [nsIAccessibleTable], null, DONOTFAIL_IF_NO_INTERFACE);
    1.39 +  if (!accTable4)
    1.40 +    tableInterfaceExposed = false;
    1.41 +  ok(tableInterfaceExposed, "table interface is not exposed");
    1.42 +
    1.43 +  if (tableInterfaceExposed) {
    1.44 +    accNotCreated = (!isAccessible("tr"));
    1.45 +    ok(!accNotCreated, "missed tr accessible");
    1.46 +
    1.47 +    testRole(accTable4, ROLE_TABLE);
    1.48 +
    1.49 +    is(accTable4.getCellAt(0,0).firstChild.name, "cell0", "wrong cell");
    1.50 +    is(accTable4.getCellAt(0,1).firstChild.name, "cell1", "wrong cell");
    1.51 +    is(accTable4.getCellAt(1,0).firstChild.name, "cell2", "wrong cell");
    1.52 +    is(accTable4.getCellAt(1,1).firstChild.name, "cell3", "wrong cell");
    1.53 +  }
    1.54 +
    1.55 +  // test crazy table
    1.56 +  var table6 = getAccessible("table6", [nsIAccessibleTable]);
    1.57 +  ok(!table6.getCellAt(0, 0),
    1.58 +     "We don't expect cell accessible for crazy table 6!");
    1.59 +
    1.60 +  SimpleTest.finish();
    1.61 +}
    1.62 +SimpleTest.waitForExplicitFinish();
    1.63 +addA11yLoadEvent(doTest);
    1.64 +  </script>
    1.65 + </head>
    1.66 +
    1.67 + <body >
    1.68 +  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=419811">Mozilla Bug 419811</a>
    1.69 +  <p id="display"></p>
    1.70 +  <div id="content" style="display: none"></div>
    1.71 +  <pre id="test">
    1.72 +  </pre>
    1.73 +
    1.74 +  <!-- Test Table -->
    1.75 +  <br><br><b> Testing Table:</b><br><br>
    1.76 +  <center>
    1.77 +   <table id="table3" border="1" role="alert">
    1.78 +    <tr>
    1.79 +     <td>cell0</td>
    1.80 +     <td>cell1</td>
    1.81 +    </tr>
    1.82 +   </table>
    1.83 +
    1.84 +   <table id="table4" border="1" role="log">
    1.85 +    <tr aria-live="polite" id="tr">
    1.86 +     <td>cell0</td>
    1.87 +     <td>cell1</td>
    1.88 +    </tr>
    1.89 +    <tr>
    1.90 +     <td>cell2</td>
    1.91 +     <td>cell3</td>
    1.92 +    </tr>
    1.93 +   </table>
    1.94 +
    1.95 +  <div style="display:table;" id="table6">
    1.96 +    <input type="checkbox">
    1.97 +    <a href="bar">Bad checkbox</a>
    1.98 +  </div>
    1.99 +
   1.100 +  </center>
   1.101 + </body>
   1.102 +</html>

mercurial