blob: 69e2cd6324c67da4b38edc3f8e0b338e24bfc4c2 [file] [log] [blame]
<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<style>
.hideAllContainers .container {
display: none;
}
</style>
<div class="container">
<!-- Note: border=1 overrides layout table heuristics -->
<table id="table1" border=1>
<caption>Caption</caption>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</table>
</div>
<script>
test(function(t) {
var axTable1 = accessibilityController.accessibleElementById("table1");
assert_equals(axTable1.name, "Caption");
assert_equals(axTable1.nameFrom, "caption");
assert_equals(axTable1.description, "");
assert_equals(axTable1.descriptionFrom, "");
}, "Table with caption.");
</script>
<div class="container">
<!-- Note: border=1 overrides layout table heuristics -->
<table id="table2" border=1 aria-label="Label">
<caption>Caption</caption>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</table>
</div>
<script>
test(function(t) {
var axTable2 = accessibilityController.accessibleElementById("table2");
assert_equals(axTable2.name, "Label");
assert_equals(axTable2.nameFrom, "attribute");
assert_equals(axTable2.description, "Caption");
assert_equals(axTable2.descriptionFrom, "relatedElement");
assert_equals(axTable2.descriptionElementCount(), 1);
assert_equals(axTable2.descriptionElementAtIndex(0).role, "AXRole: AXCaption");
}, "Table with caption and aria-label.");
</script>
<script>
if (window.testRunner)
document.body.className = "hideAllContainers";
</script>