Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
<!DOCTYPE html>
<html>
<head>
<title>Table accessible tree and table interface tests for HTML tables</title>
<link rel="stylesheet" type="text/css"
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../table.js"></script>
<script type="application/javascript">
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// column headers from thead and tfoot
cellsArray = [
[kColHeaderCell, kColHeaderCell, kColSpanned],
[kRowSpanned, kColHeaderCell, kColHeaderCell],
[kDataCell, kDataCell, kDataCell],
[kColHeaderCell, kColHeaderCell, kColHeaderCell],
];
testTableStruct("table1", cellsArray);
// ////////////////////////////////////////////////////////////////////////
// row and column headers from thead and @scope
var cellsArray = [
[kColHeaderCell, kColHeaderCell, kColHeaderCell],
[kRowHeaderCell, kDataCell, kDataCell],
[kRowHeaderCell, kDataCell, kDataCell],
];
testTableStruct("table2", cellsArray);
// ////////////////////////////////////////////////////////////////////////
// caption and @summary
cellsArray = [
[kColHeaderCell, kColHeaderCell, kColHeaderCell, kColHeaderCell],
[kRowHeaderCell, kDataCell, kDataCell, kDataCell],
[kRowHeaderCell, kDataCell, kDataCell, kDataCell],
];
testTableStruct("table3", cellsArray, kNoColumnHeader,
"Test Table",
"this is a test table for nsIAccessibleTable");
// ////////////////////////////////////////////////////////////////////////
// row and column spans
cellsArray = [
[kDataCell, kDataCell, kDataCell, kColSpanned, kDataCell, kDataCell, kDataCell, kDataCell],
[kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kRowSpanned],
[kDataCell, kDataCell, kColSpanned, kDataCell, kDataCell, kDataCell, kDataCell, kRowSpanned],
[kDataCell, kRowSpanned, kSpanned, kDataCell, kDataCell, kRowSpanned, kDataCell, kRowSpanned],
];
testTableStruct("table4", cellsArray);
// ////////////////////////////////////////////////////////////////////////
// Table with a cell that has display: block; style
cellsArray = [
[kRowHeaderCell, kDataCell],
];
testTableStruct("table5", cellsArray);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Fix our nsHTMLAccessibleTable class so GetIndexAt and GetRowAtIndex and GetColumnAtIndex behave consistently"
<a target="_blank"
title="GetCellDataAt callers that expect an error if no cell is found are wrong"
<a target="_blank"
title="create accessibles for HTML tr"
<a target="_blank"
title="implement IAccessibleTable2"
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table id="table1">
<thead>
<tr>
<th rowspan="2">col1</th><th colspan="2">col2</th>
</tr>
<tr>
<th>col2sub1</th><th>col2sub2</th>
</tr>
</thead>
<tbody>
<tr>
<td>cell1</td><td>cell2</td><td>cell3</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>col1</th><th>col2</th><th>col3</th>
</tr>
</tfoot>
</table>
<table id="table2">
<thead>
<tr>
<th id="table1_0">col1</th>
<th id="table1_1">col2</th>
<td id="table1_2" scope="col">col3</td>
</tr>
</thead>
<tbody>
<tr>
<th id="table1_3">row1</th>
<td id="table1_4">cell1</td>
<td id="table1_5">cell2</td>
</tr>
<tr>
<td id="table1_6" scope="row">row2</td>
<td id="table1_7">cell3</td>
<td id="table1_8">cell4</td>
</tr>
</tbody>
</table>
<table id="table3" border="1"
summary="this is a test table for nsIAccessibleTable">
<caption>Test Table</caption>
<thead>
<tr>
<th></th>
<th>columnHeader_1</th>
<th id ="col2a">columnHeader_2</th>
<th>columnHeader_3</th>
</tr>
</thead>
<tr>
<th id="row2a">rowHeader_1</th>
<td id="row2b">row1_column1</td>
<td id ="col2b">row1_column2</td>
<td id="row2c">row1_column3</td>
</tr>
<tr>
<th>rowHeader_2</th>
<td>row2_column1</td>
<td id ="col2c">row2_column2</td>
<td>row2_column3</td>
</tr>
</table>
<table id="table4" cellpadding="2" cellspacing="2" border="1" width="50%">
<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 id="table5">
<tr>
<th>a</th>
<td style="display: block;">b</td>
</tr>
</table>
</body>
</html>