tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_struct_table.html (6261B)


      1 <!DOCTYPE html>
      2 <html>
      3 
      4 <head>
      5  <title>Table accessible tree and table interface tests for HTML tables</title>
      6  <link rel="stylesheet" type="text/css"
      7        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     10 
     11  <script type="application/javascript"
     12          src="../common.js"></script>
     13  <script type="application/javascript"
     14          src="../role.js"></script>
     15  <script type="application/javascript"
     16          src="../table.js"></script>
     17 
     18  <script type="application/javascript">
     19    function doTest() {
     20      // ////////////////////////////////////////////////////////////////////////
     21      // column headers from thead and tfoot
     22 
     23      cellsArray = [
     24        [kColHeaderCell, kColHeaderCell, kColSpanned],
     25        [kRowSpanned,    kColHeaderCell, kColHeaderCell],
     26        [kDataCell,      kDataCell,      kDataCell],
     27        [kColHeaderCell, kColHeaderCell, kColHeaderCell],
     28      ];
     29 
     30      testTableStruct("table1", cellsArray);
     31 
     32      // ////////////////////////////////////////////////////////////////////////
     33      // row and column headers from thead and @scope
     34 
     35      var cellsArray = [
     36        [kColHeaderCell, kColHeaderCell, kColHeaderCell],
     37        [kRowHeaderCell, kDataCell, kDataCell],
     38        [kRowHeaderCell, kDataCell, kDataCell],
     39      ];
     40 
     41      testTableStruct("table2", cellsArray);
     42 
     43      // ////////////////////////////////////////////////////////////////////////
     44      // caption and @summary
     45 
     46      cellsArray = [
     47        [kColHeaderCell, kColHeaderCell, kColHeaderCell, kColHeaderCell],
     48        [kRowHeaderCell, kDataCell,      kDataCell,      kDataCell],
     49        [kRowHeaderCell, kDataCell,      kDataCell,      kDataCell],
     50      ];
     51 
     52      testTableStruct("table3", cellsArray, kNoColumnHeader,
     53                      "Test Table",
     54                      "this is a test table for nsIAccessibleTable");
     55 
     56      // ////////////////////////////////////////////////////////////////////////
     57      // row and column spans
     58 
     59      cellsArray = [
     60        [kDataCell, kDataCell,   kDataCell,   kColSpanned, kDataCell, kDataCell,   kDataCell, kDataCell],
     61        [kDataCell, kDataCell,   kDataCell,   kDataCell,   kDataCell, kDataCell,   kDataCell, kRowSpanned],
     62        [kDataCell, kDataCell,   kColSpanned, kDataCell,   kDataCell, kDataCell,   kDataCell, kRowSpanned],
     63        [kDataCell, kRowSpanned, kSpanned,    kDataCell,   kDataCell, kRowSpanned, kDataCell, kRowSpanned],
     64      ];
     65 
     66      testTableStruct("table4", cellsArray);
     67 
     68      // ////////////////////////////////////////////////////////////////////////
     69      // Table with a cell that has display: block; style
     70 
     71      cellsArray = [
     72        [kRowHeaderCell, kDataCell],
     73      ];
     74 
     75      testTableStruct("table5", cellsArray);
     76 
     77      SimpleTest.finish();
     78    }
     79 
     80    SimpleTest.waitForExplicitFinish();
     81    addA11yLoadEvent(doTest);
     82  </script>
     83 </head>
     84 <body>
     85 
     86  <a target="_blank"
     87     title="Fix our nsHTMLAccessibleTable class so GetIndexAt and GetRowAtIndex and GetColumnAtIndex behave consistently"
     88     href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a>
     89  <a target="_blank"
     90     title="GetCellDataAt callers that expect an error if no cell is found are wrong"
     91     href="https://bugzilla.mozilla.org/show_bug.cgi?id=417912">Mozilla Bug 417912</a>
     92  <a target="_blank"
     93     title="create accessibles for HTML tr"
     94     href="https://bugzilla.mozilla.org/show_bug.cgi?id=493695">Mozilla Bug 493695</a>
     95  <a target="_blank"
     96     title="implement IAccessibleTable2"
     97     href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a>
     98 
     99  <p id="display"></p>
    100  <div id="content" style="display: none"></div>
    101  <pre id="test">
    102  </pre>
    103 
    104  <table id="table1">
    105    <thead>
    106      <tr>
    107        <th rowspan="2">col1</th><th colspan="2">col2</th>
    108      </tr>
    109      <tr>
    110        <th>col2sub1</th><th>col2sub2</th>
    111      </tr>
    112    </thead>
    113    <tbody>
    114      <tr>
    115        <td>cell1</td><td>cell2</td><td>cell3</td>
    116      </tr>
    117    </tbody>
    118    <tfoot>
    119      <tr>
    120        <th>col1</th><th>col2</th><th>col3</th>
    121      </tr>
    122    </tfoot>
    123  </table>
    124 
    125  <table id="table2">
    126    <thead>
    127      <tr>
    128        <th id="table1_0">col1</th>
    129        <th id="table1_1">col2</th>
    130        <td id="table1_2" scope="col">col3</td>
    131      </tr>
    132    </thead>
    133    <tbody>
    134      <tr>
    135        <th id="table1_3">row1</th>
    136        <td id="table1_4">cell1</td>
    137        <td id="table1_5">cell2</td>
    138      </tr>
    139      <tr>
    140        <td id="table1_6" scope="row">row2</td>
    141        <td id="table1_7">cell3</td>
    142        <td id="table1_8">cell4</td>
    143      </tr>
    144    </tbody>
    145  </table>
    146 
    147  <table id="table3" border="1"
    148         summary="this is a test table for nsIAccessibleTable">
    149    <caption>Test Table</caption>
    150    <thead>
    151      <tr>
    152        <th></th>
    153        <th>columnHeader_1</th>
    154        <th id ="col2a">columnHeader_2</th>
    155        <th>columnHeader_3</th>
    156      </tr>
    157    </thead>
    158    <tr>
    159      <th id="row2a">rowHeader_1</th>
    160      <td id="row2b">row1_column1</td>
    161      <td id ="col2b">row1_column2</td>
    162      <td id="row2c">row1_column3</td>
    163    </tr>
    164    <tr>
    165      <th>rowHeader_2</th>
    166      <td>row2_column1</td>
    167      <td id ="col2c">row2_column2</td>
    168      <td>row2_column3</td>
    169    </tr>
    170  </table>
    171 
    172  <table id="table4" cellpadding="2" cellspacing="2" border="1" width="50%">
    173    <tbody>
    174      <tr>
    175        <td><br></td>
    176        <td><br></td>
    177        <td rowspan="1" colspan="2"><br></td>
    178        <td><br></td>
    179        <td><br></td>
    180        <td><br></td>
    181        <td rowspan="4" colspan="1"><br></td>
    182      </tr>
    183      <tr>
    184        <td><br></td>
    185        <td><br></td>
    186        <td><br></td>
    187        <td><br></td>
    188        <td><br></td>
    189        <td><br></td>
    190        <td><br></td>
    191      </tr>
    192      <tr>
    193        <td><br></td>
    194        <td rowspan="2" colspan="2">c1</td>
    195        <td><br></td>
    196        <td><br></td>
    197        <td rowspan="2" colspan="1"><br></td>
    198        <td><br></td>
    199      </tr>
    200      <tr>
    201        <td><br></td>
    202        <td><br></td>
    203        <td><br></td>
    204        <td><br></td>
    205      </tr>
    206    </tbody>
    207  </table>
    208 
    209  <table id="table5">
    210    <tr>
    211      <th>a</th>
    212      <td style="display: block;">b</td>
    213    </tr>
    214  </table>
    215 
    216 </body>
    217 </html>