tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

move-by-word-korean.html (2428B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Korean/Latin transition is treated as a word boundary</title>
      4 
      5 <link rel="help" href="https://unicode.org/reports/tr29/#Word_Boundary_Rules">
      6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1973393">
      7 
      8 <script src=/resources/testharness.js></script>
      9 <script src=/resources/testharnessreport.js></script>
     10 <script src="/resources/testdriver.js"></script>
     11 <script src="/resources/testdriver-vendor.js"></script>
     12 <script src="/resources/testdriver-actions.js"></script>
     13 <script src="../editing/include/editor-test-utils.js"></script>
     14 
     15 <div contenteditable id="target">희진DJ</div>
     16 <textarea id="textareaTarget">DJ희진</textarea>
     17 
     18 <script>
     19  const selection = getSelection();
     20  const textNode = document.getElementById("target").childNodes[0];
     21  const textareaNode = document.getElementById("textareaTarget");
     22 
     23  test(() => {
     24    selection.collapse(textNode, 0); // Start at beginning of text
     25    selection.modify("move", "forward", "word");
     26    assert_equals(selection.focusNode, textNode);
     27    assert_equals(selection.focusOffset, 2, "Caret should move after the Korean characters");
     28  }, "Korean/Latin transition should be considered a word boundary when moving forward");
     29 
     30  test(() => {
     31    selection.collapse(textNode, 4); // Start at end of text
     32    selection.modify("move", "backward", "word");
     33    assert_equals(selection.focusNode, textNode);
     34    assert_equals(selection.focusOffset, 2, "Caret should move before the Latin characters");
     35  }, "Korean/Latin transition should be considered a word boundary when moving backward");
     36 
     37  promise_test(async () => {
     38    textareaNode.focus();
     39    textareaNode.setSelectionRange(0, 0); // Start at beginning of text
     40    const utils = new EditorTestUtils(textareaNode);
     41    await utils.sendMoveWordRightKey();
     42    assert_equals(textareaNode.selectionStart, 2, "Caret should move after the Latin characters");
     43  }, "Latin/Korean transition should be considered a word boundary when moving forward");
     44 
     45  promise_test(async () => {
     46    textareaNode.focus();
     47    textareaNode.setSelectionRange(4, 4); // Start at end of text
     48    const utils = new EditorTestUtils(textareaNode);
     49    await utils.sendMoveWordLeftKey();
     50    assert_equals(textareaNode.selectionStart, 2, "Caret should move before the Korean characters");
     51  }, "Latin/Korean transition should be considered a word boundary when moving backward");
     52 </script>