tor-browser

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

test_sanity.html (2083B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for mochitest harness sanity</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <script src="/tests/SimpleTest/EventUtils.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      8 </head>
      9 <body>
     10 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
     11 <p id="display">
     12  <input id="testKeyEvent1" onkeypress="press1 = true">
     13  <input id="testKeyEvent2" onkeydown="return false;" onkeypress="press2 = true">
     14  <input id="testKeyEvent3" onkeypress="press3 = true">
     15  <input id="testKeyEvent4" onkeydown="return false;" onkeypress="press4 = true">
     16 </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 sanity  */
     24 ok(true, "true must be ok");
     25 isnot(1, true, "1 must not be true");
     26 isnot(1, false, "1 must not be false");
     27 isnot(0, false, "0 must not be false");
     28 isnot(0, true, "0 must not be true");
     29 isnot("", 0, "Empty string must not be 0");
     30 isnot("1", 1, "Numeric string must not equal the number");
     31 isnot("", null, "Empty string must not be null");
     32 isnot(undefined, null, "Undefined must not be null");
     33 
     34 var press1 = false;
     35 $("testKeyEvent1").focus();
     36 sendString("x");
     37 is($("testKeyEvent1").value, "x", "synthesizeKey should work");
     38 is(press1, true, "synthesizeKey should dispatch keyPress");
     39 
     40 var press2 = false;
     41 $("testKeyEvent2").focus();
     42 sendString("x");
     43 is($("testKeyEvent2").value, "", "synthesizeKey should respect keydown preventDefault");
     44 is(press2, false, "synthesizeKey should not dispatch keyPress with default prevented");
     45 
     46 var press3 = false;
     47 $("testKeyEvent3").focus();
     48 sendChar("x")
     49 is($("testKeyEvent3").value, "x", "sendChar should work");
     50 is(press3, true, "sendChar should dispatch keyPress");
     51 
     52 var press4 = false;
     53 $("testKeyEvent4").focus();
     54 sendChar("x")
     55 is($("testKeyEvent4").value, "", "sendChar should respect keydown preventDefault");
     56 is(press4, false, "sendChar should not dispatch keyPress with default prevented");
     57 
     58 
     59 </script>
     60 </pre>
     61 </body>
     62 </html>