Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test for mochitest harness sanity</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | </head> |
michael@0 | 9 | <body> |
michael@0 | 10 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> |
michael@0 | 11 | <p id="display"> |
michael@0 | 12 | <input id="testKeyEvent1" onkeypress="press1 = true"> |
michael@0 | 13 | <input id="testKeyEvent2" onkeydown="return false;" onkeypress="press2 = true"> |
michael@0 | 14 | <input id="testKeyEvent3" onkeypress="press3 = true"> |
michael@0 | 15 | <input id="testKeyEvent4" onkeydown="return false;" onkeypress="press4 = true"> |
michael@0 | 16 | </p |
michael@0 | 17 | <div id="content" style="display: none"> |
michael@0 | 18 | |
michael@0 | 19 | </div> |
michael@0 | 20 | <pre id="test"> |
michael@0 | 21 | <script class="testbody" type="text/javascript"> |
michael@0 | 22 | |
michael@0 | 23 | /** Test for sanity **/ |
michael@0 | 24 | ok(true, "true must be ok"); |
michael@0 | 25 | is(1, true, "1 must be true"); |
michael@0 | 26 | isnot(1, false, "1 must not be false"); |
michael@0 | 27 | is(0, false, "0 must be false"); |
michael@0 | 28 | isnot(0, true, "0 must not be true"); |
michael@0 | 29 | is("", 0, "Empty string must be 0"); |
michael@0 | 30 | is("1", 1, "Numeric string must be equal the number"); |
michael@0 | 31 | isnot("", null, "Empty string must not be null"); |
michael@0 | 32 | |
michael@0 | 33 | var press1 = false; |
michael@0 | 34 | $("testKeyEvent1").focus(); |
michael@0 | 35 | synthesizeKey("x", {}); |
michael@0 | 36 | is($("testKeyEvent1").value, "x", "synthesizeKey should work"); |
michael@0 | 37 | is(press1, true, "synthesizeKey should dispatch keyPress"); |
michael@0 | 38 | |
michael@0 | 39 | var press2 = false; |
michael@0 | 40 | $("testKeyEvent2").focus(); |
michael@0 | 41 | synthesizeKey("x", {}); |
michael@0 | 42 | is($("testKeyEvent2").value, "", "synthesizeKey should respect keydown preventDefault"); |
michael@0 | 43 | is(press2, false, "synthesizeKey should not dispatch keyPress with default prevented"); |
michael@0 | 44 | |
michael@0 | 45 | var press3 = false; |
michael@0 | 46 | $("testKeyEvent3").focus(); |
michael@0 | 47 | sendChar("x") |
michael@0 | 48 | is($("testKeyEvent3").value, "x", "sendChar should work"); |
michael@0 | 49 | is(press3, true, "sendChar should dispatch keyPress"); |
michael@0 | 50 | |
michael@0 | 51 | var press4 = false; |
michael@0 | 52 | $("testKeyEvent4").focus(); |
michael@0 | 53 | sendChar("x") |
michael@0 | 54 | is($("testKeyEvent4").value, "", "sendChar should respect keydown preventDefault"); |
michael@0 | 55 | is(press4, false, "sendChar should not dispatch keyPress with default prevented"); |
michael@0 | 56 | |
michael@0 | 57 | |
michael@0 | 58 | </script> |
michael@0 | 59 | </pre> |
michael@0 | 60 | </body> |
michael@0 | 61 | </html> |
michael@0 | 62 |