chromium/third_party/blink/web_tests/editing/selection/extend/extend_selection_20_ltr_forward_word.html

<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// hard line break with BiDi
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">|\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">^\u05D0\u05D1\u05D2| abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">^\u05D0\u05D1\u05D2 |abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-0 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0|\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0^\u05D1\u05D2| abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0^\u05D1\u05D2 |abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-1 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1|\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1^\u05D2| abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1^\u05D2 |abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-2 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2| abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2^ abc| \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2^ |abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-3 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 |abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 ^abc| \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 ^abc |\u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-4 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 a|bc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 a^bc| \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 a^bc |\u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-5 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 ab|c \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 ab^c| \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 ab^c |\u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-6 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc| \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc^ \u05D3\u05D4\u05D5|<br>edf \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc^ |\u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-7 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc |\u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc ^\u05D3\u05D4\u05D5|<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-8 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3|\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3^\u05D4\u05D5|<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-9 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4|\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4^\u05D5|<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-10 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>^edf| \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>^edf |\u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-11 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>e|df \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>e^df| \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>e^df |\u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-12 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>ed|f \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>ed^f| \u05D6\u05D7\u05D8 abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>ed^f |\u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-13 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf| \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf^ \u05D6\u05D7\u05D8| abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf^ |\u05D6\u05D7\u05D8 abrebg</div>',
  `${behavior} 20-14 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf |\u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf ^\u05D6\u05D7\u05D8| abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf ^\u05D6\u05D7\u05D8 |abrebg</div>',
  `${behavior} 20-15 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6|\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6^\u05D7\u05D8| abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6^\u05D7\u05D8 |abrebg</div>',
  `${behavior} 20-16 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7|\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7^\u05D8| abrebg</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7^\u05D8 |abrebg</div>',
  `${behavior} 20-17 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8| abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8^ abrebg|</div>'
      : '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8^ |abrebg</div>',
  `${behavior} 20-18 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 |abrebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 ^abrebg|</div>',
  `${behavior} 20-19 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 a|brebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 a^brebg|</div>',
  `${behavior} 20-20 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 ab|rebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 ab^rebg|</div>',
  `${behavior} 20-21 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abr|ebg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abr^ebg|</div>',
  `${behavior} 20-22 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abre|bg</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abre^bg|</div>',
  `${behavior} 20-23 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abreb|g</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abreb^g|</div>',
  `${behavior} 20-24 ltr forward word`);

selection_test(
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg|</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg|</div>',
  `${behavior} 20-25 ltr forward word`);
}
</script>