tor-browser

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

test_bug1314790.html (1786B)


      1 <!DOCTYPE html>
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=1314790
      4 -->
      5 <html>
      6 <head>
      7  <title>Test for Bug 1314790</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/EventUtils.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1314790">Mozilla Bug 1314790</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none;">
     16 
     17 </div>
     18 
     19 <div contenteditable="true" id="contenteditable1"><p>pen pineapple</p></div>
     20 <pre id="test">
     21 
     22 <script class="testbody" type="application/javascript">
     23 SimpleTest.waitForExplicitFinish();
     24 SimpleTest.waitForFocus(function() {
     25  let elm = document.getElementById("contenteditable1");
     26  elm.focus();
     27  window.getSelection().collapse(elm.childNodes[0], 0);
     28 
     29  SpecialPowers.doCommand(window, "cmd_wordNext");
     30  SpecialPowers.doCommand(window, "cmd_wordNext");
     31 
     32  synthesizeKey("KEY_Enter");
     33  sendString("apple pen");
     34 
     35  is(elm.childNodes[0].textContent, "pen pineapple",
     36     "'pen pineapple' is first node");
     37  is(elm.childNodes[1].textContent, "apple pen",
     38     "'apple pen' is second node");
     39 
     40  SpecialPowers.doCommand(window, "cmd_deleteWordBackward");
     41  SpecialPowers.doCommand(window, "cmd_deleteWordBackward");
     42  is(elm.childNodes[0].textContent, "pen pineapple",
     43     "'pen pineapple' is first node");
     44 
     45  SpecialPowers.doCommand(window, "cmd_deleteWordBackward");
     46  is(elm.childNodes[0].textContent, "pen pineapple",
     47     "'pen pineapple' is first node");
     48 
     49  SpecialPowers.doCommand(window, "cmd_deleteWordBackward");
     50  is(
     51    elm.childNodes[0].textContent,
     52    "pen\u00A0",
     53    "'pen ' is first node"
     54  );
     55 
     56  SimpleTest.finish();
     57 });
     58 </script>
     59 </pre>
     60 </body>
     61 </html>