<!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="textbox" role="textbox" contenteditable>
<p>
One paragraph in an ARIA textbox.
</p>
</div>
<script>
'use strict';
setup(() => {
const textbox = document.getElementById('textbox');
textbox.focus();
const selectionRange = document.createRange();
selectionRange.selectNodeContents(textbox);
getSelection().removeAllRanges();
getSelection().addRange(selectionRange);
});
async_test_after_layout_and_paint((t) => {
const axRoot = accessibilityController.rootElement;
axRoot.setNotificationListener(t.step_func((notification, intents) => {
if (notification == 'DocumentSelectionChanged') {
assert_array_equals(intents,
['AXEventIntent(clearSelection,none,none,none)']);
axRoot.unsetNotificationListener();
assert_equals(axRoot.selectionAnchorObject, null, 'selectionAnchorObject');
assert_equals(axRoot.selectionAnchorOffset, -1, 'selectionAnchorOffset');
assert_equals(axRoot.selectionFocusObject, null, 'selectionFocusObject');
assert_equals(axRoot.selectionFocusOffset, -1, 'selectionFocusOffset');
t.done();
}
}));
getSelection().removeAllRanges();
});
</script>