blob: 8c3d3cfc56a09537627474f151ebb2812ca0dab8 [file] [log] [blame] [edit]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/accessibility-helper.js"></script>
</head>
<body>
<input id="textfield" onfocus="setTimeout('sendTestEvents()', 0);">
<script>
var output = "This tests that when setting focus, the cursor moves.\n\n";
var textfield;
var windowEventSender = window.eventSender;
if (window.accessibilityController && window.eventSender) {
window.jsTestIsAsync = true;
textfield = accessibilityController.accessibleElementById("textfield");
output += expect("textfield.stringValue", "'AXValue: '");
eventSender.keyDown("a");
output += expect("textfield.stringValue", "'AXValue: '");
textfield.takeFocus();
}
function sendTestEvents() {
textfield = accessibilityController.accessibleElementById("textfield");
setTimeout(async function() {
output += await expectAsync("textfield.isFocused", "true");
output += await expectAsync("document.activeElement == document.getElementById('textfield')", "true");
eventSender.keyDown("a");
output += await expectAsync("textfield.stringValue", "'AXValue: a'");
debug(output);
finishJSTest();
}, 0);
}
</script>
</body>
</html>