tor-browser

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

test_bug446663.html (2014B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=446663
      5 -->
      6 <head>
      7  <title>Test for Bug 446663</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=446663">Mozilla Bug 446663</a>
     14 <p id="display">
     15 <style>#bug446663_a:focus{overflow:hidden}</style>
     16 <input id="bug446663_a"><input id="bug446663_b"></p>
     17 <div id="content" style="display: none">
     18  
     19 </div>
     20 <pre id="test">
     21 <script class="testbody" type="text/javascript">
     22 
     23 /** Test for Bug 446663 */
     24 
     25 function test_edit_cmds(id) {
     26 
     27  var elm = document.getElementById(id);
     28  elm.focus();
     29  elm.select();
     30  SpecialPowers.wrap(elm).controllers.getControllerForCommand('cmd_cut')
     31                         .doCommand('cmd_cut');
     32  is(elm.value, '', id + " cut");
     33 
     34  SpecialPowers.wrap(elm).controllers.getControllerForCommand('cmd_undo')
     35                         .doCommand('cmd_undo');
     36  is(elm.value, '123', id + " undo");
     37 }
     38 
     39 var inputHappened = false;
     40 function inputListener() {
     41  inputHappened = true;
     42  $(id).removeEventListener("input", inputListener);
     43 }
     44 
     45 var id = 'bug446663_a'
     46 var elm = document.getElementById(id);
     47 elm.focus();
     48 var x = document.body.offsetHeight;
     49 $(id).addEventListener("input", inputListener);
     50 sendChar('1');
     51 is(inputHappened, true, "How come no input?");
     52 sendChar('3');
     53 sendKey('LEFT')
     54 sendChar('2');
     55 elm.blur();
     56 x = document.body.offsetHeight;
     57 is(elm.value, '123', id + " edit");
     58 test_edit_cmds(id)
     59 
     60 id = 'bug446663_b'
     61 elm = document.getElementById(id);
     62 elm.focus();
     63 sendChar('1');
     64 elm.style.display = 'none'
     65 var x = document.body.offsetHeight;
     66 elm.style.display = 'inline'
     67 x = document.body.offsetHeight;
     68 sendChar('3');
     69 sendKey('LEFT')
     70 sendChar('2');
     71 elm.blur();
     72 x = document.body.offsetHeight;
     73 is(elm.value, '123', id + " edit");
     74 test_edit_cmds(id)
     75 
     76 </script>
     77 </pre>
     78 </body>
     79 </html>