2 <script src=
"../../resources/js-test.js"></script>
6 var sel
= window
.getSelection();
9 var test
= document
.getElementById("test_move_by_word");
11 test
.value
= "word word word\n\n\nword\n\n\n ";
12 test
.selectionDirection
= 'none';
13 test
.selectionStart
= 0;
14 test
.selectionEnd
= 0;
16 var wordBreaks
= test
.title
.split(" ");
19 for (i
= 0; i
< 5; ++i
) {
20 var start
= test
.selectionStart
;
21 sel
.modify("move", "right", "word");
23 if (i
>= wordBreaks
.length
)
24 wordBreak
= wordBreaks
[wordBreaks
.length
- 1];
26 wordBreak
= wordBreaks
[i
];
27 if (test
.selectionStart
!= wordBreak
) {
28 testFailed("Expected: " + start
+ " -> " + wordBreak
+ "; Actual : " + start
+ " -> " + test
.selectionStart
);
37 if (window
.testRunner
&& window
.internals
) {
38 testRunner
.dumpAsText();
39 internals
.settings
.setEditingBehavior('win');
43 <textarea title =
"5 10 17 27" dir=ltr
id=
"test_move_by_word"></textarea>