blob: 778299b0e42649905c9ee470ee75f75de4dc9c8f [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/js-test-pre.js"></script>
<script>
onload = function() {
var sel = window.getSelection();
sel.empty();
var test = document.getElementById("test_move_by_word");
test.focus();
test.value = "word word word\n\n\nword\n\n\n ";
test.selectionDirection = 'none';
test.selectionStart = 0;
test.selectionEnd = 0;
var wordBreaks = test.title.split(" ");
var fail = false;
var i;
for (i = 0; i < 5; ++i) {
var start = test.selectionStart;
sel.modify("move", "right", "word");
var wordBreak;
if (i >= wordBreaks.length)
wordBreak = wordBreaks[wordBreaks.length - 1];
else
wordBreak = wordBreaks[i];
if (test.selectionStart != wordBreak) {
testFailed("Expected: " + start + " -> " + wordBreak + "; Actual : " + start + " -> " + test.selectionStart);
fail = true;
}
}
if (fail == false)
testPassed("Pass");
}
if (window.testRunner && window.internals) {
testRunner.dumpAsText();
internals.settings.setEditingBehavior('windows');
}
</script>
<textarea title = "5 10 17 27" dir=ltr id="test_move_by_word"></textarea>