| <html> |
| <head> |
| <script src="../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| |
| <div id="content" contenteditable tabindex="0">helloworld</div> |
| |
| <div id="console"></div> |
| |
| <script> |
| if (window.accessibilityController) { |
| window.jsTestIsAsync = true; |
| |
| var content = document.getElementById("content"); |
| content.focus(); |
| |
| var text = accessibilityController.focusedElement; |
| text.setSelectedTextRange(5, 0); |
| shouldBecomeEqual("text.selectedTextRange", "'{5, 0}'", function() { |
| text.insertText("\n"); |
| |
| var t = text.stringForRange(0, 11); |
| t = t.replace(/(?:\r\n|\r|\n)/g, '[newline]'); |
| debug("There must be only one [newline] between hello and world: " + t); |
| |
| shouldBecomeEqual("text.selectedTextRange", "'{6, 0}'", function() { |
| var t = text.stringForRange(6, 5); |
| t = t.replace(/(?:\r\n|\r|\n)/g, '[newline]'); |
| debug("The text after the newline should be world: " + t); |
| |
| finishJSTest(); |
| }); |
| }); |
| } |
| </script> |
| <script src="../resources/js-test-post.js"></script> |
| </body> |
| </html> |