blob: 95a84b696aa5d373d0e85690a824a9de26134957 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="static_eventTarget">
<textarea id="textarea">textarea</textarea>
<div id="console"></div>
<script>
description("Tests that a 'selected text changed' notification fires on an textarea element when the user moves the cursor.");
window.jsTestIsAsync = true;
function runTest() {
// This forces building the accessibility tree, because selection change
// events only fire on elements that already exist.
accessibilityController.accessibleElementById('dummy');
var element = document.getElementById('textarea');
var axElement = accessibilityController.accessibleElementById('textarea');
element.focus();
axElement.addNotificationListener(function(notification) {
if (notification == 'SelectedTextChanged') {
debug('Got SelectedTextChanged notification on textarea element.');
axElement.removeNotificationListener();
finishJSTest();
}
});
element.setSelectionRange(0, 1);
}
if (window.testRunner && window.accessibilityController) {
testRunner.dumpAsText();
window.onload = runTest();
}
</script>
</body>
</html>