summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/table/test_sels_table.html
blob: b0d53ab42cc75899331fee386e079199bc80e002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>nsIAccesible selection methods testing for HTML table</title>
  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../role.js"></script>
  <script type="application/javascript"
          src="../states.js"></script>
  <script type="application/javascript"
          src="../table.js"></script>

  <script type="text/javascript">

    function doTest() {
      // ////////////////////////////////////////////////////////////////////////
      // table

      var cellsArray =
      [
        [false, false,       false,       kColSpanned, false, false,       false, false],
        [false, false,       false,       false,       false, false,       false, kRowSpanned],
        [false, false,       kColSpanned, false,       false, false,       false, kRowSpanned],
        [false, kRowSpanned, kSpanned,    false,       false, kRowSpanned, false, kRowSpanned],
      ];

      testTableSelection("table", cellsArray);

      var accTable = getAccessible("table", [nsIAccessibleTable]);
      ok(!accTable.isProbablyForLayout(), "table is not for layout");

      // ////////////////////////////////////////////////////////////////////////
      // table instane

      cellsArray =
      [
        [false,       false, false,       -1,          -1],
        [false,       false, false,       -1,          -1],
        [false,       false, kColSpanned, kColSpanned, -1],
        [kRowSpanned, false, false,       -1,          -1],
        [kRowSpanned, false, kRowSpanned, false,       false],
      ];

      testTableSelection("tableinsane", cellsArray);

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
 </head>
 <body>

  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052"
     title="Fix our nsHTMLAccessibleTable class so GetIndexAt and GetRowAtIndex and GetColumnAtIndex behave consistently">
    Mozilla Bug 410052
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=501635"
     title="nsHTMLTableAccessible::GetSelectedCells contains index duplicates for spanned rows or columns">
    Mozilla Bug 501635
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=501659"
     title="HTML table's isRowSelected/isColumnSelected shouldn't fail if row or column has cell holes">
    Mozilla Bug 501659
  </a>

  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <!-- Test Table -->
  <br><br><b> Testing Table:</b><br><br>
  <center>
   <table cellpadding="2" cellspacing="2" border="1" width="50%" id="table">
    <tbody>
     <tr>
      <td><br></td>
      <td><br></td>
      <td rowspan="1" colspan="2"><br></td>
      <td><br></td>
      <td><br></td>
      <td><br></td>
      <td rowspan="4" colspan="1"><br></td>
     </tr>
     <tr>
      <td><br></td>
      <td><br></td>
      <td><br></td>
      <td><br></td>
      <td><br></td>
      <td><br></td>
      <td><br></td>
     </tr>
     <tr>
      <td><br></td>
      <td rowspan="2" colspan="2">c1</td>
      <td><br></td>
      <td><br></td>
      <td rowspan="2" colspan="1"><br></td>
      <td><br></td>
     </tr>
     <tr>
      <td><br></td>
      <td><br></td>
      <td><br></td>
      <td><br></td>
     </tr>
    </tbody>
   </table>

   <table border="1" id="tableinsane">
    <thead>
     <tr>
      <th>col1</th>
      <th>col2</th>
      <th>col3</th>
     </tr>
    </thead>
     <tbody>
      <tr>
       <td>1</td>
       <td>2</td>
       <td>3</td>
      </tr>
      <tr>
       <td rowspan="3">4</td>
       <td colspan="4">5</td>
      </tr>
      <tr>
       <td>6</td>
       <td rowspan="2">7</td>
      </tr>
      <tr>
       <td>8</td>
       <td>9</td>
       <td>10</td>
      </tr>
     </tbody>
    </table>

  </center>
 </body>
</html>