| <!DOCTYPE HTML> |
| <html> |
| <head> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../resources/run-after-layout-and-paint.js"></script> |
| </head> |
| <body id="static_eventTarget"> |
| |
| <textarea id="textarea">textarea</textarea> |
| |
| <div id="console"></div> |
| <script> |
| async_test_after_layout_and_paint((t) => { |
| // 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(t.step_func((notification) => { |
| if (notification == 'SelectedTextChanged') { |
| axElement.removeNotificationListener(); |
| t.done(); |
| } |
| })); |
| |
| element.setSelectionRange(0, 1); |
| |
| // Fail rather than time out. |
| window.setTimeout(() => { assert_unreached('Did not receive notification after 1000ms'); }, 1000); |
| }, "Tests that a 'selected text changed' notification fires on an textarea element when the user moves the cursor."); |
| |
| </script> |
| |
| </body> |
| </html> |