Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / selection-change-notification-statictext.html
blob78d6d740c43178a89461a44ce576f2f1dc36dda3
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 </head>
6 <body id="static_eventTarget">
8 <p id="p">One paragraph in the document</p>
10 <div id="console"></div>
11 <script>
12 description("Tests that a 'selected text changed' notification fires on a contentEditable element when the user moves the cursor within it.");
13 window.jsTestIsAsync = true;
15 function runTest() {
16 // This forces building the accessibility tree, because selection change
17 // events only fire on elements that already exist.
18 accessibilityController.accessibleElementById('dummy');
20 var axElement = accessibilityController.rootElement;
22 axElement.addNotificationListener(function(notification) {
23 if (notification == 'SelectedTextChanged') {
24 debug('Got SelectedTextChanged notification on root element.');
25 axElement.removeNotificationListener();
26 finishJSTest();
28 });
30 var p = document.getElementById('p');
31 var range = document.createRange();
32 range.setStart(p.firstChild, 0);
33 range.setEnd(p.firstChild, 1);
34 window.getSelection().removeAllRanges();
35 window.getSelection().addRange(range);
38 if (window.testRunner && window.accessibilityController) {
39 testRunner.dumpAsText();
40 window.onload = runTest();
43 </script>
45 </body>
46 </html>