tor-browser

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

test_bug1068979.html (2438B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1068979
      5 -->
      6 <head>
      7  <title>Test for Bug 1068979</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=1068979">Mozilla Bug 1068979</a>
     14 <p id="display"></p>
     15 <div id="content">
     16  <div id="editor1" contenteditable="true">&#x1d400;</div>
     17  <div id="editor2" contenteditable="true">a<u>&#x1d401;</u>b</div>
     18  <div id="editor3" contenteditable="true">a&#x1d402;<u>b</u></div>
     19 </div>
     20 <pre id="test">
     21 <script type="application/javascript">
     22 
     23 /** Test for Bug 1068979 */
     24 
     25 SimpleTest.waitForExplicitFinish();
     26 SimpleTest.waitForFocus(function() {
     27  // Test backspacing over SMP characters pasted-in to a contentEditable
     28  getSelection().selectAllChildren(document.getElementById("editor1"));
     29  var ed1 = document.getElementById("editor1");
     30  var ch1 = ed1.textContent;
     31  ed1.focus();
     32  synthesizeKey("C", {accelKey: true});
     33  synthesizeKey("V", {accelKey: true});
     34  synthesizeKey("V", {accelKey: true});
     35  synthesizeKey("V", {accelKey: true});
     36  synthesizeKey("V", {accelKey: true});
     37  is(ed1.textContent, ch1 + ch1 + ch1 + ch1, "Should have four SMP characters");
     38  sendKey("back_space");
     39  is(ed1.textContent, ch1 + ch1 + ch1, "Three complete characters should remain");
     40  sendKey("back_space");
     41  is(ed1.textContent, ch1 + ch1, "Two complete characters should remain");
     42  sendKey("back_space");
     43  is(ed1.textContent, ch1, "Only one complete SMP character should remain");
     44  ed1.blur();
     45 
     46  // Test backspacing across an SMP character in a sub-element
     47  getSelection().selectAllChildren(document.getElementById("editor2"));
     48  var ed2 = document.getElementById("editor2");
     49  ed2.focus();
     50  sendKey("right");
     51  sendKey("back_space");
     52  sendKey("back_space");
     53  is(ed2.textContent, "a", "Only the 'a' should remain");
     54  ed2.blur();
     55 
     56  // Test backspacing across an SMP character from a following sub-element
     57  getSelection().selectAllChildren(document.getElementById("editor3"));
     58  var ed3 = document.getElementById("editor3");
     59  ed3.focus();
     60  sendKey("right");
     61  sendKey("left");
     62  sendKey("back_space");
     63  is(ed3.textContent, "ab", "The letters 'ab' should remain");
     64  ed3.blur();
     65 
     66  SimpleTest.finish();
     67 });
     68 
     69 </script>
     70 </pre>
     71 </body>
     72 </html>