| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../resources/run-after-layout-and-paint.js"></script> |
| <body id="static_eventTarget"> |
| <div id="contentEditable" contentEditable="true"> |
| <p id="p">One paragraph in a contentEditable</p> |
| async_test_after_layout_and_paint((t) => { |
| var element = document.getElementById('contentEditable'); |
| var axElement = accessibilityController.accessibleElementById('contentEditable'); |
| axElement.addNotificationListener(t.step_func((notification) => { |
| if (notification == 'SelectedTextChanged') { |
| axElement.removeNotificationListener(); |
| assert_unreached('Unexpected notification: ' + notification); |
| 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); |
| }, "Tests that a 'selected text changed' notification fires on a contentEditable element when the user moves the cursor within it."); |