blob: c2e9cfdbac981662cc17a20cb9a180df473c1352 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<a id="link1" href="#">link1</a>
<h1 id="heading1" tabindex=0>heading1</h1>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that accessibilityElementDidBecomeFocused will be propagated to the correct parent and cause DOM focus to fire on the correct elements.");
if (window.accessibilityController) {
var body = accessibilityController.rootElement;
// Get access to the text inside the link.
var textInsideLink = accessibilityController.accessibleElementById("link1").childAtIndex(0);
shouldBe("textInsideLink.description", "'AXLabel: link1'");
// Simulate VoiceOver focus onto the element.
textInsideLink.assistiveTechnologySimulatedFocus();
// The new focused element should now be the link itself.
shouldBeTrue("accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideLink)");
// Repeat for text inside link inside heading.
// Get access to the text inside the link.
var textInsideHeading = accessibilityController.accessibleElementById("heading1").childAtIndex(0);
shouldBe("textInsideHeading.description", "'AXLabel: heading1'");
// Simulate VoiceOver focus onto the element.
textInsideHeading.assistiveTechnologySimulatedFocus();
// The new focused element should now be the link itself.
shouldBeTrue("accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideHeading)");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>