blob: 04ae4f2236263031b6a084e212929b464356241a [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/run-after-layout-and-paint.js"></script>
<div id="ariaTextbox" role="textbox" tabIndex="0">
<p>Before</p>
<p id="p">One paragraph in an ARIA textbox</p>
<p>After</p>
</div>
<script>
'use strict';
async_test_after_layout_and_paint((t) => {
const axElement = accessibilityController.accessibleElementById('ariaTextbox');
axElement.setNotificationListener(t.step_func((notification, intents) => {
// Focus notification will come asynchronously.
if (notification == 'Focus')
return;
if (notification == 'SelectedTextChanged') {
assert_array_equals(intents,
['AXEventIntent(setSelection,none,character,forward)']);
axElement.unsetNotificationListener();
t.done();
return;
}
assert_unreached('Unexpected notification: ' + notification);
}));
const element = document.getElementById('ariaTextbox');
element.focus();
const p = document.getElementById('p');
const range = document.createRange();
range.setStart(p.firstChild, 0);
range.setEnd(p.firstChild, 1);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
});
</script>