testing/mochitest/tests/Harness_sanity/test_sanity.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test for mochitest harness sanity</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" 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">
    19 </div>
    20 <pre id="test">
    21 <script class="testbody" type="text/javascript">
    23 /** Test for sanity  **/
    24 ok(true, "true must be ok");
    25 is(1, true, "1 must be true");
    26 isnot(1, false, "1 must not be false");
    27 is(0, false, "0 must be false");
    28 isnot(0, true, "0 must not be true");
    29 is("", 0, "Empty string must be 0");
    30 is("1", 1, "Numeric string must be equal the number");
    31 isnot("", null, "Empty string must not be null");
    33 var press1 = false;
    34 $("testKeyEvent1").focus();
    35 synthesizeKey("x", {});
    36 is($("testKeyEvent1").value, "x", "synthesizeKey should work");
    37 is(press1, true, "synthesizeKey should dispatch keyPress");
    39 var press2 = false;
    40 $("testKeyEvent2").focus();
    41 synthesizeKey("x", {});
    42 is($("testKeyEvent2").value, "", "synthesizeKey should respect keydown preventDefault");
    43 is(press2, false, "synthesizeKey should not dispatch keyPress with default prevented");
    45 var press3 = false;
    46 $("testKeyEvent3").focus();
    47 sendChar("x")
    48 is($("testKeyEvent3").value, "x", "sendChar should work");
    49 is(press3, true, "sendChar should dispatch keyPress");
    51 var press4 = false;
    52 $("testKeyEvent4").focus();
    53 sendChar("x")
    54 is($("testKeyEvent4").value, "", "sendChar should respect keydown preventDefault");
    55 is(press4, false, "sendChar should not dispatch keyPress with default prevented");
    58 </script>
    59 </pre>
    60 </body>
    61 </html>

mercurial