| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../resources/js-test-pre.js"></script> |
| </head> |
| <body id="body"> |
| |
| <div id="content" contenteditable tabindex="0"> |
| hello<br> |
| <b>world</b> |
| </div> |
| |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script> |
| |
| description("This tests that a contenteditable region behaves as a proper AXTextArea."); |
| |
| var notification = 0; |
| var textArea = 0; |
| var notificationType = "AXValueChanged"; |
| function callback(notification) { |
| if (notification == notificationType) { |
| textArea.removeNotificationListener(); |
| debug("Updated value: " + textArea.stringValue); |
| document.getElementById("content").style.visibility = "hidden"; |
| finishJSTest(); |
| } |
| } |
| |
| if (window.accessibilityController) { |
| window.jsTestIsAsync = true; |
| |
| // In ATSPI, value-changed notifications are made for widgets which implement |
| // the Value interface (sliders, progress bars, etc.). |
| if (accessibilityController.platformName == "atspi") |
| notificationType = "AXTextChanged"; |
| |
| textArea = accessibilityController.accessibleElementById("content"); |
| textArea.addNotificationListener(callback); |
| |
| debug("Role: " + textArea.role); |
| debug("Value: " + textArea.stringValue); |
| debug("Value (writable): " + textArea.isAttributeSettable("AXValue")); |
| debug("String with range: " + textArea.stringForRange(1, 9)); |
| debug("Attributed string with range: " + textArea.attributedStringForRange(1, 9)); |
| debug("Line for index(0): " + textArea.lineForIndex(0)); |
| debug("Line for index(7): " + textArea.lineForIndex(7)); |
| debug("Range for line(0): " + textArea.rangeForLine(0)); |
| debug("Range for line(1): " + textArea.rangeForLine(1)); |
| debug("Bounds for range: " + textArea.boundsForRange(3, 5)); |
| |
| var range = document.createRange(); |
| range.setStart(document.getElementById("content").firstChild, 0); |
| range.setEnd(document.getElementById("content").firstChild, 4); |
| var sel = window.getSelection(); |
| sel.addRange(range); |
| |
| debug("Selected text range: " + textArea.selectedTextRange); |
| debug("Selected text: " + textArea.stringAttributeValue("AXSelectedText")); |
| |
| // Send a value cahnge. |
| document.getElementById("content").focus(); |
| eventSender.keyDown('q', []); |
| } |
| |
| </script> |
| |
| <script src="../resources/js-test-post.js"></script> |
| </body> |
| </html> |