<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// To verify "mac" behavior other than macOS, please add following lines:
// internals.settings.setEditingBehavior('mac');
// internals.settings.setSelectTrailingWhitespaceEnabled(false);
const isMac = navigator.platform.indexOf('Mac') === 0;
selection_test(
'<div contenteditable dir="rtl">|abc ghi<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
isMac
? '<div contenteditable dir="rtl">abc| ghi<div></div><div></div><div></div></div>'
: '<div contenteditable dir="rtl">abc |ghi<div></div><div></div><div></div></div>',
'8-0 rtl left word');
selection_test(
'<div contenteditable dir="rtl">a|bc ghi<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
isMac
? '<div contenteditable dir="rtl">abc| ghi<div></div><div></div><div></div></div>'
: '<div contenteditable dir="rtl">abc |ghi<div></div><div></div><div></div></div>',
'8-1 rtl left word');
selection_test(
'<div contenteditable dir="rtl">ab|c ghi<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
isMac
? '<div contenteditable dir="rtl">abc| ghi<div></div><div></div><div></div></div>'
: '<div contenteditable dir="rtl">abc |ghi<div></div><div></div><div></div></div>',
'8-2 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc| ghi<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
isMac
? '<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>'
: '<div contenteditable dir="rtl">abc |ghi<div></div><div></div><div></div></div>',
'8-3 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc |ghi<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
isMac
? '<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>'
: '<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-4 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc g|hi<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
isMac
? '<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>'
: '<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-5 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc gh|i<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
isMac
? '<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>'
: '<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-6 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-7 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc ghi<div>|</div><div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-8 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc ghi<div></div>|<div></div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-9 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc ghi<div></div><div>|</div><div></div></div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-10 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc ghi<div></div><div></div>|<div></div></div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-11 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc ghi<div></div><div></div><div>|</div></div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-12 rtl left word');
selection_test(
'<div contenteditable dir="rtl">abc ghi<div></div><div></div><div></div>|</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="rtl">abc ghi|<div></div><div></div><div></div></div>',
'8-13 rtl left word');
</script>