tor-browser

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

test_bug421640.html (1440B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=421640
      5 -->
      6 <head>
      7  <title>Test for Bug 421640</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=421640">Mozilla Bug 421640</a>
     14 <div id="content">
     15  <div id="edit" contenteditable="true">This text is editable</div>
     16  <div><button id="button">Test</button></div> 
     17 </div>
     18 <pre id="test">
     19 <script class="testbody" type="text/javascript">
     20 
     21 /** Test for Bug 421640 */
     22 
     23 function test(click, focus, nextFocus) {
     24  var selection = window.getSelection();
     25  var edit = document.getElementById("edit");
     26  var text = edit.firstChild;
     27 
     28  selection.removeAllRanges();
     29 
     30  var rect = edit.getBoundingClientRect();
     31  synthesizeMouseAtPoint(rect.left + 1, rect.top + 1, { type: "mousedown" });
     32  synthesizeMouseAtPoint(rect.right - 1, rect.top + 1, { type: "mousemove" });
     33  synthesizeMouseAtPoint(rect.right - 1, rect.top + 1, { type: "mouseup" });
     34 
     35  is(selection.anchorNode, text, "");
     36 
     37  synthesizeMouse(document.getElementById("button"), 10, 1, {});
     38 
     39  is(selection.anchorNode, text, "");
     40 
     41  SimpleTest.finish();
     42 }
     43 
     44 window.onload = function() {
     45  SimpleTest.waitForExplicitFinish();
     46  setTimeout(test, 0);
     47 };
     48 
     49 </script>
     50 </pre>
     51 </body>
     52 </html>