blob: 200c4216e63eb4e7da053a218bb9004c4e617346 [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 border=1>
<tr><th>Column</th></tr>
<tr><td><h1 tabindex="0" id="heading">heading</h1></td></tr>
</table>
<h1>outside heading</h1>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that when we start searching from an element within a table, we do not get as a result, the same element.");
if (window.accessibilityController) {
document.getElementById("body").focus();
var containerElement = accessibilityController.focusedElement;
document.getElementById("heading").focus();
var heading = accessibilityController.focusedElement;
// The next heading should be outside the table
resultElement = containerElement.uiElementForSearchPredicate(heading, true, "AXHeadingSearchKey", "", false);
shouldBe("resultElement.role", "'AXRole: AXHeading'");
shouldBe("resultElement.title", "'AXTitle: outside heading'");
// A search for the previous heading should return nothing.
resultElement = containerElement.uiElementForSearchPredicate(heading, false, "AXHeadingSearchKey", "", false);
shouldBeUndefined("resultElement");
// When asking the child of the heading for the previous element, it should return the heading.
resultElement = containerElement.uiElementForSearchPredicate(heading.childAtIndex(0), false, "AXAnyTypeSearchKey", "", false);
shouldBe("resultElement.role", "'AXRole: AXHeading'");
// When asking the heading for the previous element, it should return the cell.
resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXAnyTypeSearchKey", "", false);
shouldBe("resultElement.role", "'AXRole: AXCell'");
// When asking the cell for the previous element, it should return the row.
resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXAnyTypeSearchKey", "", false);
shouldBe("resultElement.role", "'AXRole: AXRow'");
// Now when trying to find the previous static text, it should go into the table's children to find the text in the first cell.
resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXStaticTextSearchKey", "", false);
shouldBe("resultElement.role", "'AXRole: AXStaticText'");
shouldBe("resultElement.stringValue", "'AXValue: Column'");
// When asking the text for the previous element it should return the first cell of the table.
resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXAnyTypeSearchKey", "", false);
shouldBe("resultElement.role", "'AXRole: AXCell'");
shouldBe("resultElement.rowIndexRange()", "'{0, 1}'");
shouldBe("resultElement.columnIndexRange()", "'{0, 1}'");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>