| <!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="ltr">|\nabc efd dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\n^abc| efd dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\n^abc |efd dabeb\n</div>', |
| `${behavior} 13-0 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\n|abc efd dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\n^abc| efd dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\n^abc |efd dabeb\n</div>', |
| `${behavior} 13-1 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\na|bc efd dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\na^bc| efd dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\na^bc |efd dabeb\n</div>', |
| `${behavior} 13-2 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nab|c efd dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\nab^c| efd dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\nab^c |efd dabeb\n</div>', |
| `${behavior} 13-3 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc| efd dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\nabc^ efd| dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\nabc^ |efd dabeb\n</div>', |
| `${behavior} 13-4 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc |efd dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\nabc ^efd| dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\nabc ^efd |dabeb\n</div>', |
| `${behavior} 13-5 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc e|fd dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\nabc e^fd| dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\nabc e^fd |dabeb\n</div>', |
| `${behavior} 13-6 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc ef|d dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\nabc ef^d| dabeb\n</div>' |
| : '<div contenteditable dir="ltr">\nabc ef^d |dabeb\n</div>', |
| `${behavior} 13-7 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc efd| dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| behavior === 'mac' |
| ? '<div contenteditable dir="ltr">\nabc efd^ dabeb|\n</div>' |
| : '<div contenteditable dir="ltr">\nabc efd^ |dabeb\n</div>', |
| `${behavior} 13-8 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc efd |dabeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| '<div contenteditable dir="ltr">\nabc efd ^dabeb|\n</div>', |
| `${behavior} 13-9 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc efd d|abeb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| '<div contenteditable dir="ltr">\nabc efd d^abeb|\n</div>', |
| `${behavior} 13-10 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc efd da|beb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| '<div contenteditable dir="ltr">\nabc efd da^beb|\n</div>', |
| `${behavior} 13-11 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc efd dab|eb\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| '<div contenteditable dir="ltr">\nabc efd dab^eb|\n</div>', |
| `${behavior} 13-12 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc efd dabe|b\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| '<div contenteditable dir="ltr">\nabc efd dabe^b|\n</div>', |
| `${behavior} 13-13 ltr right word`); |
| |
| selection_test( |
| '<div contenteditable dir="ltr">\nabc efd dabeb|\n</div>', |
| selection => selection.modify('extend', 'right', 'word'), |
| '<div contenteditable dir="ltr">\nabc efd dabeb|\n</div>', |
| `${behavior} 13-14 ltr right word`); |
| } |
| </script> |