blob: 1b2642702667bda43947ae639cf9d56a97e790f4 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="static_eventTarget">
<div id="ariaTextbox" role="textbox" tabIndex="0">
<p>Before</p>
<p id="p">One paragraph in an ARIA textbox</p>
<p>After</p>
</div>
<div id="console"></div>
<script>
description("Tests that a 'selected text changed' notification fires on a focusable element with role=textbox when the user moves the cursor within it.");
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('ariaTextbox');
var axElement = accessibilityController.accessibleElementById('ariaTextbox');
element.focus();
axElement.addNotificationListener(function(notification) {
if (notification == 'SelectedTextChanged') {
debug('Got SelectedTextChanged notification on focusable element with role=textbox.');
axElement.removeNotificationListener();
finishJSTest();
}
});
var p = document.getElementById('p');
var range = document.createRange();
range.setStart(p.firstChild, 0);
range.setEnd(p.firstChild, 1);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
}
if (window.testRunner && window.accessibilityController) {
testRunner.dumpAsText();
window.onload = runTest();
}
</script>
</body>
</html>