blob: 70de617a9ab83ca46ae71b79563e123915a1139b [file] [log] [blame]
<!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">|Lorem <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">|Lorem <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
`${behavior} 6-0 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">L|orem <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">|L^orem <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
`${behavior} 6-1 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lo|rem <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">|Lo^rem <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
`${behavior} 6-2 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lor|em <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">|Lor^em <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
`${behavior} 6-3 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lore|m <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">|Lore^m <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
`${behavior} 6-4 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem| <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">|Lorem^ <span style="direction: ltr">ipsum dolor sit</span> amet</div>',
`${behavior} 6-5 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">|ipsum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">|Lorem ^<span style="direction: ltr">ipsum dolor sit</span> amet</div>',
`${behavior} 6-6 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">i|psum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">|i^psum dolor sit</span> amet</div>',
`${behavior} 6-7 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ip|sum dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">|ip^sum dolor sit</span> amet</div>',
`${behavior} 6-8 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ips|um dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">|ips^um dolor sit</span> amet</div>',
`${behavior} 6-9 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsu|m dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">|ipsu^m dolor sit</span> amet</div>',
`${behavior} 6-10 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum| dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">|ipsum^ dolor sit</span> amet</div>',
`${behavior} 6-11 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum |dolor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">|ipsum ^dolor sit</span> amet</div>',
`${behavior} 6-12 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum d|olor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum |d^olor sit</span> amet</div>',
`${behavior} 6-13 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum do|lor sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum |do^lor sit</span> amet</div>',
`${behavior} 6-14 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dol|or sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum |dol^or sit</span> amet</div>',
`${behavior} 6-15 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolo|r sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum |dolo^r sit</span> amet</div>',
`${behavior} 6-16 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor| sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum |dolor^ sit</span> amet</div>',
`${behavior} 6-17 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor |sit</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum |dolor ^sit</span> amet</div>',
`${behavior} 6-18 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor s|it</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor |s^it</span> amet</div>',
`${behavior} 6-19 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor si|t</span> amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor |si^t</span> amet</div>',
`${behavior} 6-20 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span>| amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor |sit^</span> amet</div>',
`${behavior} 6-21 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> |amet</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor |sit</span> ^amet</div>',
`${behavior} 6-22 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> a|met</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> |a^met</div>',
`${behavior} 6-23 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> am|et</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> |am^et</div>',
`${behavior} 6-24 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> ame|t</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> |ame^t</div>',
`${behavior} 6-25 rtl right word`);
selection_test(
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> amet|</div>',
selection => selection.modify('extend', 'right', 'word'),
'<div contenteditable dir="rtl">Lorem <span style="direction: ltr">ipsum dolor sit</span> |amet^</div>',
`${behavior} 6-26 rtl right word`);
}
</script>