tor-browser

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

test_bug1247483.html (1762B)


      1 <!DOCTYPE HTML>
      2 <html><head>
      3 <title>Test for bug 1247483</title>
      4 <style src="/tests/SimpleTest/test.css" type="text/css"></style>
      5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6 <script src="/tests/SimpleTest/EventUtils.js"></script>
      7 
      8 <script class="testbody" type="application/javascript">
      9 
     10 function runTest() {
     11  // Copy content from table.
     12  var selection = getSelection();
     13  var startRange = document.createRange();
     14  startRange.setStart(document.getElementById("start"), 0);
     15  startRange.setEnd(document.getElementById("end"), 2);
     16  selection.removeAllRanges();
     17  selection.addRange(startRange);
     18  SpecialPowers.wrap(document).execCommand("copy", false, null);
     19 
     20  // Paste content into "pastecontainer"
     21  var pasteContainer = document.getElementById("pastecontainer");
     22  var pasteRange = document.createRange();
     23  pasteRange.selectNodeContents(pasteContainer);
     24  pasteRange.collapse(false);
     25  selection.removeAllRanges();
     26  selection.addRange(pasteRange);
     27  SpecialPowers.wrap(document).execCommand("paste", false, null);
     28 
     29  is(pasteContainer.querySelectorAll("td").length, 4, "4 <td> should be pasted.");
     30 
     31  document.execCommand("undo", false, null);
     32 
     33  is(pasteContainer.querySelectorAll("td").length, 0, "Undo should have remove the 4 pasted <td>.");
     34 
     35  SimpleTest.finish();
     36 }
     37 
     38 SimpleTest.waitForExplicitFinish();
     39 
     40 addLoadEvent(runTest);
     41 </script>
     42 </head>
     43 <body>
     44 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1247483">Mozilla Bug 1247483</a>
     45 <p id="display"></p>
     46 
     47 <pre id="test">
     48 </pre>
     49 
     50 <div id="container" contenteditable="true">
     51 <table>
     52  <tr id="start"><td>1 1</td><td>1 2</td></tr>
     53  <tr id="end"><td>2 1</td><td>2 2</td></tr>
     54 </table>
     55 </div>
     56 
     57 <div id="pastecontainer" contenteditable="true">
     58 </div>
     59 
     60 </body>
     61 </html>