mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 14:15:30 +00:00
436 lines
11 KiB
HTML
436 lines
11 KiB
HTML
<html>
|
||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=495388 -->
|
||
<head>
|
||
<title>test nsHTMLTableAccessible::IsProbablyForLayout implementation</title>
|
||
<link rel="stylesheet" type="text/css"
|
||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||
|
||
<script type="application/javascript"
|
||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||
|
||
<script type="application/javascript"
|
||
src="../common.js"></script>
|
||
<script type="application/javascript"
|
||
src="../attributes.js"></script>
|
||
|
||
<script type="application/javascript">
|
||
function doTest()
|
||
{
|
||
// Attribute we're looking for
|
||
var attr = {
|
||
"layout-guess": "true"
|
||
};
|
||
|
||
// table with role of grid
|
||
testAbsentAttrs("table1", attr);
|
||
// table with role of grid and datatable="0"
|
||
testAbsentAttrs("table1.1", attr);
|
||
|
||
// table with landmark role
|
||
testAbsentAttrs("table2", attr);
|
||
|
||
// table with summary
|
||
testAbsentAttrs("table3", attr);
|
||
|
||
// table with caption
|
||
testAbsentAttrs("table4", attr);
|
||
|
||
// table with empty caption
|
||
testAttrs("table4.2", attr, true);
|
||
|
||
// table with th element
|
||
testAbsentAttrs("table5", attr);
|
||
|
||
// table with thead element
|
||
testAbsentAttrs("table6", attr);
|
||
|
||
// table with tfoot element
|
||
testAbsentAttrs("table7", attr);
|
||
|
||
// table with colgroup or col elements
|
||
testAbsentAttrs("table8", attr);
|
||
testAbsentAttrs("table8.2", attr);
|
||
|
||
// layout table with nested table
|
||
testAttrs("table9", attr, true);
|
||
|
||
// layout table with 1 column
|
||
testAttrs("table10", attr, true);
|
||
|
||
// layout table with 1 row
|
||
testAttrs("table11", attr, true);
|
||
|
||
// table with 5 columns
|
||
testAbsentAttrs("table12", attr);
|
||
|
||
// table with a bordered cell
|
||
testAbsentAttrs("table13", attr);
|
||
|
||
// table with alternating row background colors
|
||
testAbsentAttrs("table14", attr);
|
||
|
||
// table with 3 columns and 21 rows
|
||
testAbsentAttrs("table15", attr);
|
||
|
||
// layout table that has a 100% width
|
||
testAttrs("table16", attr, true);
|
||
|
||
// layout table that has a 95% width in pixels
|
||
testAttrs("table17", attr, true);
|
||
|
||
// layout table with less than 10 columns
|
||
testAttrs("table18", attr, true);
|
||
|
||
// layout table with embedded iframe
|
||
testAttrs("table19", attr, true);
|
||
|
||
// tree grid, no layout table
|
||
testAbsentAttrs("table20", attr);
|
||
|
||
// layout table containing nested data table (having data structures)
|
||
testAttrs("table21", attr, true);
|
||
testAttrs("table21.2", attr, true);
|
||
testAttrs("table21.3", attr, true);
|
||
testAttrs("table21.4", attr, true);
|
||
testAttrs("table21.5", attr, true);
|
||
testAttrs("table21.6", attr, true);
|
||
|
||
// layout table having datatable="0" attribute and containing data table structure (tfoot element)
|
||
testAttrs("table22", attr, true);
|
||
|
||
SimpleTest.finish();
|
||
}
|
||
|
||
SimpleTest.waitForExplicitFinish();
|
||
addA11yLoadEvent(doTest);
|
||
</script>
|
||
</head>
|
||
<body>
|
||
|
||
<a target="_blank"
|
||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=495388"
|
||
title="Don't treat tables that have a landmark role as layout table">
|
||
Mozilla Bug 495388
|
||
</a>
|
||
<a target="_blank"
|
||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=690222"
|
||
title="Data table elements used to determine layout-guess attribute shouldn't be picked from nested tables">
|
||
Mozilla Bug 690222
|
||
</a>
|
||
|
||
<p id="display"></p>
|
||
<div id="content" style="display: none"></div>
|
||
<pre id="test">
|
||
</pre>
|
||
|
||
<!-- Table with role of grid -->
|
||
<table id="table1" role="grid">
|
||
<tr>
|
||
<th>Sender</th>
|
||
<th>Subject</th>
|
||
<th>Date</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Marco</td>
|
||
<td>Test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
<tr>
|
||
<td>David</td>
|
||
<td>Another test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Alex</td>
|
||
<td>Third test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
</table>
|
||
<!-- table with role of grid and datatable="0"-->
|
||
<table id="table1.1" role="grid" datatable="0">
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with landmark role -->
|
||
<table id="table2" role="main">
|
||
<tr>
|
||
<th>Sender</th>
|
||
<th>Subject</th>
|
||
<th>Date</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Marco</td>
|
||
<td>Test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
<tr>
|
||
<td>David</td>
|
||
<td>Another test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Alex</td>
|
||
<td>Third test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with summary -->
|
||
<table id="table3" summary="This is a table">
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with caption -->
|
||
<table id="table4">
|
||
<caption>This is a table</caption>
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with empty caption -->
|
||
<table id="table4.2">
|
||
<caption> </caption>
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with th element -->
|
||
<table id="table5">
|
||
<tr>
|
||
<th>Cell1</th><th>cell2</th>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with thead element -->
|
||
<table id="table6">
|
||
<thead>
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</thead>
|
||
</table>
|
||
|
||
<!-- table with tfoot element -->
|
||
<table id="table7">
|
||
<tfoot>
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</tfoot>
|
||
</table>
|
||
|
||
<!-- table with colgroup and col elements -->
|
||
<table id="table8">
|
||
<colgroup width="20"></colgroup>
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</table>
|
||
<table id="table8.2">
|
||
<col width="20">
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- layout table with nested table -->
|
||
<table id="table9">
|
||
<tr>
|
||
<td><table><tr><td>Cell</td></tr></table></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- layout table with 1 column -->
|
||
<table id="table10">
|
||
<tr><td>Row1</td></tr>
|
||
<tr><td>Row2</td></tr>
|
||
</table>
|
||
|
||
<!-- layout table with 1 row and purposely many columns -->
|
||
<table id="table11">
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
|
||
</table>
|
||
|
||
<!-- table with 5 columns -->
|
||
<table id="table12">
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
|
||
</table>
|
||
|
||
<!-- table with a bordered cell -->
|
||
<table id="table13" border="1" width="100%" bordercolor="#0000FF">
|
||
<tr>
|
||
<td bordercolor="#000000"><EFBFBD></td>
|
||
<td bordercolor="#000000"><EFBFBD></td>
|
||
<td bordercolor="#000000"><EFBFBD></td>
|
||
</tr>
|
||
<tr>
|
||
<td bordercolor="#000000"><EFBFBD></td>
|
||
<td bordercolor="#000000"><EFBFBD></td>
|
||
<td bordercolor="#000000"><EFBFBD></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with alternating row background colors -->
|
||
<table id="table14" width="100%">
|
||
<tr style="background-color: #0000FF;">
|
||
<td><EFBFBD></td>
|
||
<td><EFBFBD></td>
|
||
<td><EFBFBD></td>
|
||
</tr>
|
||
<tr style="background-color: #00FF00;">
|
||
<td><EFBFBD></td>
|
||
<td><EFBFBD></td>
|
||
<td><EFBFBD></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- table with 3 columns and 21 rows -->
|
||
<table id="table15" border="0">
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
</table>
|
||
|
||
<!-- layout table that has a 100% width -->
|
||
<table id="table16" width="100%">
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
</table>
|
||
|
||
<!-- layout table that has a 95% width in pixels -->
|
||
<table id="table17" width="98%">
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
<tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
|
||
</table>
|
||
|
||
<!-- layout table with less than 10 columns -->
|
||
<table id="table18">
|
||
<tr>
|
||
<td>Marco</td>
|
||
<td>Test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
<tr>
|
||
<td>David</td>
|
||
<td>Another test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Alex</td>
|
||
<td>Third test</td>
|
||
<td>June 12</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- layout table with embedded iframe -->
|
||
<table id="table19">
|
||
<tr><td><iframe id="frame"></iframe></td><td> </td><td> </td></tr>
|
||
<tr><td> </td><td> </td><td> </td></tr>
|
||
<tr><td> </td><td> </td><td> </td></tr>
|
||
<tr><td> </td><td> </td><td> </td></tr>
|
||
</table>
|
||
|
||
<!-- tree grid, no layout table -->
|
||
<table id="table20" role="treegrid">
|
||
<tr role="treeitem"><td>Cell1</td><td>Cell2</td></tr>
|
||
</table>
|
||
|
||
<!-- layout table with nested data table containing data table elements -->
|
||
<table id="table21">
|
||
<tr>
|
||
<td>
|
||
<table>
|
||
<caption>table</caption>
|
||
<tr><td>Cell</td></tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table id="table21.2">
|
||
<tr>
|
||
<td>
|
||
<table>
|
||
<colgroup width="20"></colgroup>
|
||
<tr><th>Cell</th></tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table id="table21.3">
|
||
<tr>
|
||
<td>
|
||
<table>
|
||
<col width="20"></col>
|
||
<tr><th>Cell</th></tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table id="table21.4">
|
||
<tr>
|
||
<td>
|
||
<table>
|
||
<tr><th>Cell</th></tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table id="table21.5">
|
||
<tr>
|
||
<td>
|
||
<table>
|
||
<thead>
|
||
<tr><td>Cell</td></tr>
|
||
</thead>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table id="table21.6">
|
||
<tr>
|
||
<td>
|
||
<table>
|
||
<tfoot>
|
||
<tr><td>Cell</td></tr>
|
||
</tfoot>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<!-- layout table with datatable="0" and tfoot element-->
|
||
<table id="table22" datatable="0">
|
||
<tfoot>
|
||
<tr>
|
||
<td>Cell1</td><td>cell2</td>
|
||
</tr>
|
||
</tfoot>
|
||
</table>
|
||
</body>
|
||
</html>
|