AX: Mavericks: Text cursor does not move along with VoiceOver cursor for text fields
[WebKit-https.git] / LayoutTests / accessibility / mac / focus-moves-cursor.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7
8 <input id="textfield" onfocus="setTimeout('sendTestEvents()', 0);">
9
10 <p id="description"></p>
11 <div id="console"></div>
12
13 <script>
14     description("This tests that when setting focus, the cursor moves.");
15
16     var windowEventSender = window.eventSender;    
17     if (window.accessibilityController && window.eventSender) {
18         window.jsTestIsAsync = true;
19         var textfield = accessibilityController.accessibleElementById("textfield");
20         shouldBe("textfield.stringValue", "'AXValue: '");
21         eventSender.keyDown("a");
22         shouldBe("textfield.stringValue", "'AXValue: '");
23
24         textfield.takeFocus();
25     }
26
27     function sendTestEvents() {
28         var textfield = accessibilityController.accessibleElementById("textfield");
29         shouldBeTrue("textfield.isFocused");
30         shouldBe("document.activeElement", "document.getElementById('textfield')");
31
32         eventSender.keyDown("a");
33         shouldBe("textfield.stringValue", "'AXValue: a'");
34         finishJSTest();
35     }
36 </script>
37
38 <script src="../../resources/js-test-post.js"></script>
39 </body>
40 </html>