82 lines
2.8 KiB
HTML
82 lines
2.8 KiB
HTML
<!DOCTYPE html><!-- webkit-test-runner [ TabsToLinks=true ] -->
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body id="body" onload="runTest()">
|
|
<fieldset>
|
|
<div>
|
|
<input id="1">
|
|
<label for="1">1</label>
|
|
</div>
|
|
<div>
|
|
<input id="2">
|
|
<label for="2">2</label>
|
|
</div>
|
|
</fieldset>
|
|
<script>
|
|
description("This tests that selection changes as a result of advancing focus.");
|
|
jsTestIsAsync = true;
|
|
|
|
var webArea = 0;
|
|
var tabCharacter = "\t";
|
|
|
|
function notificationCallback(notification, userInfo) {
|
|
if (notification == "AXSelectedTextChanged" || notification == "AXFocusChanged")
|
|
window.promise.resolve();
|
|
}
|
|
|
|
function runTest() {
|
|
if (!window.accessibilityController) {
|
|
debug("window.accessibilityController is not present");
|
|
finishJSTest();
|
|
return;
|
|
}
|
|
|
|
runFirstTabMoveTest();
|
|
}
|
|
|
|
function runFirstTabMoveTest() {
|
|
accessibilityController.enableEnhancedAccessibility(true);
|
|
webArea = accessibilityController.rootElement.childAtIndex(0);
|
|
webArea.setBoolAttributeValue("AXCaretBrowsingEnabled", true)
|
|
|
|
shouldBeTrue("webArea.addNotificationListener(notificationCallback)");
|
|
evalAndLog("eventSender.keyDown(tabCharacter);");
|
|
|
|
window.promise = new Promise(function(resolve, reject) {
|
|
setTimeout(() => {
|
|
runTakeFocusTest();
|
|
}, 0);
|
|
});
|
|
}
|
|
|
|
function runTakeFocusTest() {
|
|
debug('');
|
|
shouldBeTrue("accessibilityController.accessibleElementById(\"1\").isFocusable");
|
|
evalAndLog("accessibilityController.accessibleElementById(\"1\").takeFocus()");
|
|
|
|
window.promise = new Promise(function(resolve, reject) {
|
|
setTimeout(() => {
|
|
runSecondTabMoveTest();
|
|
}, 0);
|
|
});
|
|
}
|
|
|
|
function runSecondTabMoveTest() {
|
|
debug('');
|
|
evalAndLog("eventSender.keyDown(tabCharacter)");
|
|
|
|
window.promise = new Promise(function(resolve, reject) {
|
|
setTimeout(() => {
|
|
webArea.removeNotificationListener();
|
|
finishJSTest();
|
|
}, 0);
|
|
});
|
|
}
|
|
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|