blob: 4546b454f47e28251b37c24b9479b061bcc56f9d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<table tabindex=0 id="grid-1" role="treegrid" aria-labelledby="grid-1-header" border="1" aria-activedescendant="row1">
<thead>
<tr ca="tr" role="row" aria-level="1" id="row1">
<th id="grid-1-isbn_id">Book Name / ISBN</th><th id="grid-1-author_id">Author</th><th id="grid-1-price_id" class="numeric" >Price ($)</th>
</tr>
</thead>
<tbody>
<tr ca="to" role="row" aria-level="1" aria-expanded="true">
<td headers="grid-1-title_id" id="table_entry" role="gridcell" colspan="3" tabindex="0">
<span class="expand">+</span> A Question of Love</td>
</tr>
<tr ca="ti" role="row" aria-level="2" aria-expanded="true">
<td headers="grid-1-isbn_id" role="gridcell">978-3-453-40540-0</td>
<td headers="grid-1-author_id" role="gridcell">Nora Roberts</td>
<td headers="grid-1-price_id" class="numeric" role="gridcell" ca="te"><div>9.99</div></td>
</tr>
</tbody>
</table>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that the treegrid ARIA role does what it should (be exposed as a AXTable and support AXSelectedRows)");
if (window.accessibilityController) {
document.getElementById("grid-1").focus();
var treegrid = accessibilityController.focusedElement;
var selectedRow = treegrid.childAtIndex(0);
shouldBe("treegrid.isAttributeSupported('AXSelectedRows')", "true");
shouldBe("treegrid.selectedRowAtIndex(0).isEqual(selectedRow)", "true");
shouldBe("selectedRow.isExpanded", "false");
shouldBe("selectedRow.hierarchicalLevel", "0");
var secondRow = treegrid.childAtIndex(1);
shouldBe("secondRow.isExpanded", "true");
shouldBe("secondRow.hierarchicalLevel", "0");
var thirdRow = treegrid.childAtIndex(2);
shouldBe("thirdRow.isExpanded", "true");
shouldBe("thirdRow.hierarchicalLevel", "1");
// Make sure that the row disclosure works correctly.
shouldBe("thirdRow.disclosedByRow().isEqual(secondRow)", "true");
shouldBe("secondRow.disclosedRowAtIndex(0).isEqual(thirdRow)", "true");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>