| <!doctype html> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <script src="../../assert_selection.js"></script> |
| <script> |
| const isMac = navigator.platform.indexOf('Mac') === 0; |
| const kBehaviors = window.internals ? ['mac', 'win'] : isMac ? ['mac'] : ['win']; |
| for (const behavior of kBehaviors) { |
| if (window.internals) { |
| internals.settings.setEditingBehavior(behavior); |
| internals.settings.setSelectTrailingWhitespaceEnabled(behavior !== 'mac'); |
| } |
| |
| selection_test( |
| '<div contenteditable dir="rtl">|\nabc efd dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\n^abc| efd dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\n^abc |efd dabeb\n</div>', |
| `${behavior} 13-0 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\n|abc efd dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\n^abc| efd dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\n^abc |efd dabeb\n</div>', |
| `${behavior} 13-1 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\na|bc efd dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\na^bc| efd dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\na^bc |efd dabeb\n</div>', |
| `${behavior} 13-2 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nab|c efd dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\nab^c| efd dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\nab^c |efd dabeb\n</div>', |
| `${behavior} 13-3 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc| efd dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\nabc^ efd| dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\nabc^ |efd dabeb\n</div>', |
| `${behavior} 13-4 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc |efd dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\nabc ^efd| dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\nabc ^efd |dabeb\n</div>', |
| `${behavior} 13-5 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc e|fd dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\nabc e^fd| dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\nabc e^fd |dabeb\n</div>', |
| `${behavior} 13-6 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc ef|d dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\nabc ef^d| dabeb\n</div>' |
| : '<div contenteditable dir="rtl">\nabc ef^d |dabeb\n</div>', |
| `${behavior} 13-7 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc efd| dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="rtl">\nabc efd^ dabeb|\n</div>' |
| : '<div contenteditable dir="rtl">\nabc efd^ |dabeb\n</div>', |
| `${behavior} 13-8 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc efd |dabeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| '<div contenteditable dir="rtl">\nabc efd ^dabeb|\n</div>', |
| `${behavior} 13-9 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc efd d|abeb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| '<div contenteditable dir="rtl">\nabc efd d^abeb|\n</div>', |
| `${behavior} 13-10 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc efd da|beb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| '<div contenteditable dir="rtl">\nabc efd da^beb|\n</div>', |
| `${behavior} 13-11 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc efd dab|eb\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| '<div contenteditable dir="rtl">\nabc efd dab^eb|\n</div>', |
| `${behavior} 13-12 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc efd dabe|b\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| '<div contenteditable dir="rtl">\nabc efd dabe^b|\n</div>', |
| `${behavior} 13-13 rtl forward word`); |
| |
| selection_test( |
| '<div contenteditable dir="rtl">\nabc efd dabeb|\n</div>', |
| selection => selection.modify('extend', 'forward', 'word'), |
| '<div contenteditable dir="rtl">\nabc efd dabeb|\n</div>', |
| `${behavior} 13-14 rtl forward word`); |
| } |
| </script> |