| <!DOCTYPE HTML> |
| <html> |
| <head> |
| <script src="../fast/js/resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| |
| <div id="textbox" contentEditable="true">First<p>Second</p></div> |
| |
| <div id="console"></div> |
| <script> |
| description("This test ensures that moving the cursor in a contentEditable sends a selected text change notification, and typing in a contentEditable sends both a value changed and selected text changed notification - both on the root element that's marked as contentEditable."); |
| window.jsTestIsAsync = true; |
| |
| if (window.testRunner && window.accessibilityController) { |
| testRunner.dumpAsText(); |
| |
| // Focus the contenteditable text box and move the cursor to the end. |
| var textbox = document.getElementById("textbox"); |
| textbox.focus(); |
| eventSender.keyDown("downArrow", []); |
| eventSender.keyDown("downArrow", []); |
| |
| var axTextBox = accessibilityController.focusedElement; |
| |
| var valueChangedCount = 0; |
| var selectedTextChangedCount = 0; |
| |
| // Defer the main part of the test so that the notification listener |
| // doesn't catch any notifications still in the queue from loading the |
| // page and initially setting focus. |
| window.setTimeout(function() { |
| axTextBox.addNotificationListener(function(notification) { |
| testPassed("Got notification: " + notification); |
| |
| if (notification == "ValueChanged") |
| valueChangedCount++; |
| else if (notification == "SelectedTextChanged") |
| selectedTextChangedCount++; |
| |
| if (valueChangedCount == 3 && selectedTextChangedCount == 6) { |
| textbox.style.display = "none"; |
| finishJSTest(); |
| } |
| }); |
| |
| eventSender.keyDown("leftArrow", []); |
| eventSender.keyDown("leftArrow", []); |
| eventSender.keyDown("leftArrow", []); |
| eventSender.keyDown("x", []); |
| eventSender.keyDown("y", []); |
| eventSender.keyDown("z", []); |
| |
| }, 0); |
| } |
| |
| </script> |
| |
| <script src="../fast/js/resources/js-test-post.js"></script> |
| </body> |
| </html> |