blob: 08adad3fa152df24108e027c9485782ee0c08e73 [file] [log] [blame]
<!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="ltr">|abc ghi<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div></div><div></div><div></div>opq xyz</div>',
'7-0 ltr left word');
selection_test(
'<div contenteditable dir="ltr">a|bc ghi<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div></div><div></div><div></div>opq xyz</div>',
'7-1 ltr left word');
selection_test(
'<div contenteditable dir="ltr">ab|c ghi<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div></div><div></div><div></div>opq xyz</div>',
'7-2 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc| ghi<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div></div><div></div><div></div>opq xyz</div>',
'7-3 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc |ghi<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div></div><div></div><div></div>opq xyz</div>',
'7-4 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc g|hi<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc |ghi<div></div><div></div><div></div>opq xyz</div>',
'7-5 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc gh|i<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc |ghi<div></div><div></div><div></div>opq xyz</div>',
'7-6 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi|<div></div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc |ghi<div></div><div></div><div></div>opq xyz</div>',
'7-7 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div>|</div><div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi|<div></div><div></div><div></div>opq xyz</div>',
'7-8 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div>|<div></div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi|<div></div><div></div><div></div>opq xyz</div>',
'7-9 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div>|</div><div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi|<div></div><div></div><div></div>opq xyz</div>',
'7-10 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div>|<div></div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi|<div></div><div></div><div></div>opq xyz</div>',
'7-11 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div>|</div>opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi|<div></div><div></div><div></div>opq xyz</div>',
'7-12 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>|opq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi|<div></div><div></div><div></div>opq xyz</div>',
'7-13 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>o|pq xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>|opq xyz</div>',
'7-14 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>op|q xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>|opq xyz</div>',
'7-15 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq| xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>|opq xyz</div>',
'7-16 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq |xyz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>|opq xyz</div>',
'7-17 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq x|yz</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq |xyz</div>',
'7-18 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq xy|z</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq |xyz</div>',
'7-19 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq xyz|</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div></div><div></div><div></div>opq |xyz</div>',
'7-20 ltr left word');
</script>