<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="body">
<div id="content">
<!-- First row is hidden -->
<table id="table1" border=1>
<tr><th hidden>header 1</th><th hidden>header 2</th></tr>
<tr><td id="table1cell">foo</td><td>bar</td></tr>
</table>
<!-- First section is hidden -->
<table id="table2" border=1>
<thead><th hidden>header 1</th><th hidden>header 2</th></thead>
<tr><td id="table2cell">foo</td><td>bar</td></tr>
</table>
<!-- First and middle section is hidden -->
<table id="table3" border=1>
<thead><tr><th hidden>header 1</th><th hidden>header 2</th></tr></thead>
<tr><td hidden>foo</td><td hidden>bar</td></tr>
<tfoot><tr><td id="table3cell">foot</td><td>foot</td></tr></tfoot>
</table>
</div>
<script>
description("This tests that cellForRowAndColumn work as expected when cells are hidden in sections and rows.");
if (window.accessibilityController) {
debug("\nTable1 has a hidden first row. Verify accessing cells works as expected.");
var table1 = accessibilityController.accessibleElementById("table1");
shouldBe("table1.rowCount", "2");
var table1cell1 = table1.cellForColumnAndRow(0, 0);
shouldBeTrue("!table1cell1 || !table1cell1.isValid");
var table1cell2 = table1.cellForColumnAndRow(0, 1);
shouldBeTrue("table1cell2.isEqual(accessibilityController.accessibleElementById('table1cell'))");
shouldBe("table1cell2.rowIndexRange()", "'{1, 1}'");
shouldBe("table1cell2.columnIndexRange()", "'{0, 1}'");
debug("\nTable2 has a hidden first section. Verify accessing cells works as expected.");
var table2 = accessibilityController.accessibleElementById("table2");
shouldBe("table2.rowCount", "2");
var table2cell1 = table2.cellForColumnAndRow(0, 0);
shouldBeTrue("!table2cell1 || !table2cell1.isValid");
var table2cell2 = table2.cellForColumnAndRow(0, 1);
shouldBeTrue("table2cell2.isEqual(accessibilityController.accessibleElementById('table2cell'))");
shouldBe("table2cell2.rowIndexRange()", "'{1, 1}'");
shouldBe("table2cell2.columnIndexRange()", "'{0, 1}'");
debug("\nTable3 only has a footer section.");
var table3 = accessibilityController.accessibleElementById("table3");
shouldBe("table3.rowCount", "3");
var table3cell1 = table3.cellForColumnAndRow(0, 0);
shouldBeTrue("!table3cell1 || !table3cell1.isValid");
var table3cell2 = table3.cellForColumnAndRow(0, 2);
shouldBeTrue("table3cell2.isEqual(accessibilityController.accessibleElementById('table3cell'))");
shouldBe("table3cell2.rowIndexRange()", "'{2, 1}'");
shouldBe("table3cell2.columnIndexRange()", "'{0, 1}'");
// Clear the HTML for better results.
document.getElementById("content").innerHTML = "";
}
</script>
</body>
</html>