blob: e83da14aa23e4a30ea6a85e67e675adda05d247b [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<title>Search Predicate Immediate Descendants Only</title>
</head>
<body>
<div id="container">
<h1>heading<img src="resources/cake.png" alt="Cake"></h1>
<p>text <a href="#">link</a></p>
<ul><li>item</li><li><ul><li>subitem</li></ul></li></ul>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that search predicate immediate descendant only results are accurate.");
if (window.accessibilityController) {
document.getElementById("container").focus();
var containerElement = accessibilityController.focusedElement;
// All descendants.
var allDescendantsCount = containerElement.uiElementCountForSearchPredicate(null, true, "AXAnyTypeSearchKey", "", false, false);
shouldBe("allDescendantsCount", "25");
// Immeditate descendants.
var immediateDescendantsCount = containerElement.uiElementCountForSearchPredicate(null, true, "AXAnyTypeSearchKey", "", false, true);
shouldBe("immediateDescendantsCount", "6");
// The number of immediate descendants should be equal to the number of children (when using "AXAnyTypeSearchKey").
var childrenCount = containerElement.childrenCount;
shouldBe("immediateDescendantsCount", "childrenCount");
// Hide superfluous text.
document.getElementById("container").style.display = "none";
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>