tor-browser

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

test_bug850043.html (1801B)


      1 <!DOCTYPE html>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=850043
      5 -->
      6 <head>
      7  <title>Test for Bug 850043</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/EventUtils.js"></script>
     10 
     11  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     12 </head>
     13 
     14 <body>
     15 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850043">Mozilla Bug 850043</a>
     16 <div id="display">
     17 <textarea id="textarea">b&#x9080;&#xe010f;&#x8fba;&#xe0101;</textarea>
     18 <div contenteditable id="edit">b&#x9080;&#xe010f;&#x8fba;&#xe0101;</div>
     19 </div>
     20 <div id="content" style="display: none">
     21 </div>
     22 
     23 <pre id="test">
     24 </pre>
     25 <script>
     26 SimpleTest.waitForExplicitFinish();
     27 SimpleTest.waitForFocus(() => {
     28  let fm = SpecialPowers.Services.focus;
     29 
     30  let element = document.getElementById("textarea");
     31  element.setSelectionRange(element.value.length, element.value.length);
     32  element.focus();
     33  is(SpecialPowers.unwrap(fm.focusedElement), element, "failed to move focus");
     34 
     35  synthesizeKey("KEY_End");
     36  sendString("a");
     37  is(element.value, "b\u{9080}\u{e010f}\u{8fba}\u{e0101}a", "a isn't last character");
     38 
     39  synthesizeKey("KEY_Backspace", {repeat: 3});
     40  is(element.value, "b", "cannot remove all IVS characters");
     41 
     42  element = document.getElementById("edit");
     43  element.focus();
     44  is(SpecialPowers.unwrap(fm.focusedElement), element, "failed to move focus");
     45 
     46  let sel = window.getSelection();
     47  sel.collapse(element.childNodes[0], element.textContent.length);
     48 
     49  sendString("a");
     50  is(element.textContent, "b\u{9080}\u{e010f}\u{8fba}\u{e0101}a", "a isn't last character");
     51 
     52  synthesizeKey("KEY_Backspace", {repeat: 3});
     53  is(element.textContent, "b", "cannot remove all IVS characters");
     54 
     55  SimpleTest.finish();
     56 });
     57 </script>
     58 </body>
     59 </html>