4 <script src=
"../resources/js-test.js"></script>
6 <body id=
"static_eventTarget">
8 <div id=
"contentEditable" contentEditable=
"true">
10 <p id=
"p">One paragraph in a contentEditable
</p>
14 <div id=
"console"></div>
16 description("Tests that a 'selected text changed' notification fires on a contentEditable element when the user moves the cursor within it.");
17 window
.jsTestIsAsync
= true;
20 // This forces building the accessibility tree, because selection change
21 // events only fire on elements that already exist.
22 accessibilityController
.accessibleElementById('dummy');
24 var element
= document
.getElementById('contentEditable');
25 var axElement
= accessibilityController
.accessibleElementById('contentEditable');
28 axElement
.addNotificationListener(function(notification
) {
29 if (notification
== 'SelectedTextChanged') {
30 debug('Got SelectedTextChanged notification on contentEditable element.');
31 axElement
.removeNotificationListener();
36 var p
= document
.getElementById('p');
37 var range
= document
.createRange();
38 range
.setStart(p
.firstChild
, 0);
39 range
.setEnd(p
.firstChild
, 1);
40 window
.getSelection().removeAllRanges();
41 window
.getSelection().addRange(range
);
44 if (window
.testRunner
&& window
.accessibilityController
) {
45 testRunner
.dumpAsText();
46 window
.onload
= runTest();