4 <script src=
"../resources/js-test.js"></script>
8 <div id=
"textbox" contentEditable=
"true">First
<p>Second
</p></div>
10 <div id=
"console"></div>
12 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.");
13 window
.jsTestIsAsync
= true;
15 if (window
.testRunner
&& window
.accessibilityController
) {
16 testRunner
.dumpAsText();
18 // Focus the contenteditable text box and move the cursor to the end.
19 var textbox
= document
.getElementById("textbox");
21 eventSender
.keyDown("downArrow", []);
22 eventSender
.keyDown("downArrow", []);
24 var axTextBox
= accessibilityController
.focusedElement
;
26 var valueChangedCount
= 0;
27 var selectedTextChangedCount
= 0;
29 // Defer the main part of the test so that the notification listener
30 // doesn't catch any notifications still in the queue from loading the
31 // page and initially setting focus.
32 window
.setTimeout(function() {
33 axTextBox
.addNotificationListener(function(notification
) {
34 testPassed("Got notification: " + notification
);
36 if (notification
== "ValueChanged")
38 else if (notification
== "SelectedTextChanged")
39 selectedTextChangedCount
++;
41 if (valueChangedCount
== 8 && selectedTextChangedCount
== 6) {
42 textbox
.style
.display
= "none";
47 eventSender
.keyDown("leftArrow", []);
48 eventSender
.keyDown("leftArrow", []);
49 eventSender
.keyDown("w", []);
50 eventSender
.keyDown("x", []);
51 eventSender
.keyDown("y", []);
52 eventSender
.keyDown("z", []);