| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| |
| <input id="textfield" onfocus="setTimeout('sendTestEvents()', 0);"> |
| |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script> |
| description("This tests that when setting focus, the cursor moves."); |
| |
| var windowEventSender = window.eventSender; |
| if (window.accessibilityController && window.eventSender) { |
| window.jsTestIsAsync = true; |
| var textfield = accessibilityController.accessibleElementById("textfield"); |
| shouldBe("textfield.stringValue", "'AXValue: '"); |
| eventSender.keyDown("a"); |
| shouldBe("textfield.stringValue", "'AXValue: '"); |
| |
| textfield.takeFocus(); |
| } |
| |
| function sendTestEvents() { |
| var textfield = accessibilityController.accessibleElementById("textfield"); |
| shouldBeTrue("textfield.isFocused"); |
| shouldBe("document.activeElement", "document.getElementById('textfield')"); |
| |
| eventSender.keyDown("a"); |
| shouldBe("textfield.stringValue", "'AXValue: a'"); |
| finishJSTest(); |
| } |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |