gecko-dev/accessible/tests/mochitest/test_relations_table.html

113 lines
3.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/relations.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// relations from markup
// 'description_for' relations for column headers
testRelation("table1_0", RELATION_DESCRIPTION_FOR,
["table1_3", "table1_6"]);
testRelation("table1_1", RELATION_DESCRIPTION_FOR,
["table1_4", "table1_7"]);
testRelation("table1_2", RELATION_DESCRIPTION_FOR,
["table1_5", "table1_8"]);
// 'description_for' relations for row headers
testRelation("table1_3", RELATION_DESCRIPTION_FOR,
["table1_4", "table1_5"]);
testRelation("table1_6", RELATION_DESCRIPTION_FOR,
["table1_7", "table1_8"]);
// 'described_by' relations for cells
testRelation("table1_4", RELATION_DESCRIBED_BY,
["table1_1", "table1_3"]);
testRelation("table1_5", RELATION_DESCRIBED_BY,
["table1_2", "table1_3"]);
testRelation("table1_7", RELATION_DESCRIBED_BY,
["table1_1", "table1_6"]);
testRelation("table1_8", RELATION_DESCRIBED_BY,
["table1_2", "table1_6"]);
//////////////////////////////////////////////////////////////////////////
// relations from @headers
// 'description_for' relations for column headers
testRelation("table2_3", RELATION_DESCRIPTION_FOR,
["table2_0"]);
testRelation("table2_4", RELATION_DESCRIPTION_FOR,
["table2_1"]);
// 'description_by' relations for cells
testRelation("table2_0", RELATION_DESCRIBED_BY,
["table2_3"]);
testRelation("table2_1", RELATION_DESCRIBED_BY,
["table2_4"]);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id="
title="">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table id="table1">
<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="table2">
<tr>
<td id="table2_0" headers="table2_3">cell1</td>
<td id="table2_1" headers="table2_4">cell2</td>
</tr>
<tr>
<td id="table2_3" scope="col">col1</td>
<td id="table2_4" scope="col">col2</td>
</tr>
</table>
</body>
</html>