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

<!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">|\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n^\u05D0\u05D1\u05D2| xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n^\u05D0\u05D1\u05D2 |xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-0 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n|\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n^\u05D0\u05D1\u05D2| xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n^\u05D0\u05D1\u05D2 |xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-1 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0|\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0^\u05D1\u05D2| xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0^\u05D1\u05D2 |xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-2 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1|\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1^\u05D2| xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1^\u05D2 |xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-3 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2| xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2^ xyz| \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2^ |xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-4 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 |xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 ^xyz| \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 ^xyz |\u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-5 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 x|yz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 x^yz| \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 x^yz |\u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-6 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xy|z \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xy^z| \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xy^z |\u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-7 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz| \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz^ \u05D3\u05D4\u05D5| def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz^ |\u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-8 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz |\u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz ^\u05D3\u05D4\u05D5| def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz ^\u05D3\u05D4\u05D5 |def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-9 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3|\u05D4\u05D5 def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3^\u05D4\u05D5| def \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3^\u05D4\u05D5 |def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-10 rtl forward word`);

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

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5| def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5^ def| \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5^ |def \u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-12 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 |def \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 ^def| \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 ^def |\u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-13 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 d|ef \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 d^ef| \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 d^ef |\u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-14 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 de|f \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 de^f| \u05D6\u05D7\u05D8\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 de^f |\u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-15 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def| \u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  behavior === 'mac'
      ? '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def^ \u05D6\u05D7\u05D8|\n</div>'
      : '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def^ |\u05D6\u05D7\u05D8\n</div>',
  `${behavior} 11-16 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def |\u05D6\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def ^\u05D6\u05D7\u05D8|\n</div>',
  `${behavior} 11-17 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6|\u05D7\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6^\u05D7\u05D8|\n</div>',
  `${behavior} 11-18 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7|\u05D8\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7^\u05D8|\n</div>',
  `${behavior} 11-19 rtl forward word`);

selection_test(
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8|\n</div>',
  selection => selection.modify('extend', 'forward', 'word'),
  '<div contenteditable dir="rtl">\n\u05D0\u05D1\u05D2 xyz \u05D3\u05D4\u05D5 def \u05D6\u05D7\u05D8|\n</div>',
  `${behavior} 11-20 rtl forward word`);
}
</script>