| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <title>wrong result because VisiblePosition.left()/right() returns wrong result</title> |
| </head> |
| <body> |
| <div id="testMoveByWord"> |
| <div dir=ltr contenteditable>abc ששש def <span id="d_1" dir=rtl>שנב opq סטז</span> uvw ששש xyz</div> |
| </div> |
| <div id="log"></div> |
| <script> |
| test(function () { |
| if (window.testRunner && window.internals) |
| internals.settings.setEditingBehavior('win'); |
| |
| var sel = window.getSelection(); |
| sel.collapse(d_1, 0); |
| sel.modify('move', 'right', 'word'); |
| assert_equals(sel.type, 'Caret'); |
| assert_equals(sel.anchorNode, d_1.firstChild); |
| assert_equals(sel.anchorOffset, 4); |
| // Above line should be |
| // assert_equals(sel.anchorOffset, 5); |
| // because ctrl/alt+right from left of סטז should move cursor to left of opq. |
| }); |
| </script> |
| </body> |
| </html> |