blob: 4ffc2e3b38618407adda2516c95155de5cf2a0d4 [file] [log] [blame]
<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.replaceTextInRange("\n", 5, 0);
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);
text.setSelectedTextRange(6, 0);
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>