blob: 8949335907a2c53232de8e00048df7e46f80a4eb [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><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-0 ltr left word');
selection_test(
'<div contenteditable dir="ltr">a|bc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-1 ltr left word');
selection_test(
'<div contenteditable dir="ltr">ab|c ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-2 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc| ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-3 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc |ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">|abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-4 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc g|hi<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc |ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-5 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc gh|i<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc |ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-6 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi|<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc |ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-7 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div>|<img src=../../resources/abe.png></div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi|<div><img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-8 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png>|</div><div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div>|<img src="../../resources/abe.png"></div><div></div><div></div>opq rst</div>',
'9-9 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div>|<div></div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png">|</div><div></div><div></div>opq rst</div>',
'9-10 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div>|</div><div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png">|</div><div></div><div></div>opq rst</div>',
'9-11 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div>|<div></div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png">|</div><div></div><div></div>opq rst</div>',
'9-12 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div>|</div>opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png">|</div><div></div><div></div>opq rst</div>',
'9-13 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>|opq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png">|</div><div></div><div></div>opq rst</div>',
'9-14 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>o|pq rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>|opq rst</div>',
'9-15 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>op|q rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>|opq rst</div>',
'9-16 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq| rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>|opq rst</div>',
'9-17 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq |rst</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>|opq rst</div>',
'9-18 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq r|st</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq |rst</div>',
'9-19 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq rs|t</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq |rst</div>',
'9-20 ltr left word');
selection_test(
'<div contenteditable dir="ltr">abc ghi<div><img src=../../resources/abe.png></div><div></div><div></div>opq rst|</div>',
selection => selection.modify('move', 'left', 'word'),
'<div contenteditable dir="ltr">abc ghi<div><img src="../../resources/abe.png"></div><div></div><div></div>opq |rst</div>',
'9-21 ltr left word');
</script>