author Dave Townsend <dtownsend@oxymoronical.com>
Wed, 23 Mar 2011 10:28:18 -0700
changeset 63553 5f420b83c3fc2c56eb5445992570f5483995c3dd
parent 28048 8f7b73d88f6bbedec99c6c8ef48b243ab922d05c
child 74313 f1c41350c548e5f64d206e7559a28d251ddaefff
permissions -rw-r--r--
Bug 639090: Once you've restarted into safe mode from the menu you cannot restart into normal mode. r=bsmedberg

  <title>Test for mochitest harness sanity</title>
  <script type="text/javascript" src="/MochiKit/packed.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
<p id="display">
  <input id="testKeyEvent1" onkeypress="press1 = true">
  <input id="testKeyEvent2" onkeydown="return false;" onkeypress="press2 = true">
  <input id="testKeyEvent3" onkeypress="press3 = true">
  <input id="testKeyEvent4" onkeydown="return false;" onkeypress="press4 = true">
<div id="content" style="display: none">
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for sanity  **/
ok(true, "true must be ok");
is(1, true, "1 must be true");
isnot(1, false, "1 must not be false");
is(0, false, "0 must be false");
isnot(0, true, "0 must not be true");
is("", 0, "Empty string must be 0");
is("1", 1, "Numeric string must be equal the number");
isnot("", null, "Empty string must not be null");

var press1 = false;
synthesizeKey("x", {});
is($("testKeyEvent1").value, "x", "synthesizeKey should work");
is(press1, true, "synthesizeKey should dispatch keyPress");

var press2 = false;
synthesizeKey("x", {});
is($("testKeyEvent2").value, "", "synthesizeKey should respect keydown preventDefault");
is(press2, true, "synthesizeKey should dispatch keyPress with default prevented");

var press3 = false;
sendChar("x", "testKeyEvent3")
is($("testKeyEvent3").value, "x", "sendChar should work");
is(press3, true, "sendChar should dispatch keyPress");

var press4 = false;
sendChar("x", "testKeyEvent4")
is($("testKeyEvent4").value, "", "sendChar should respect keydown preventDefault");
is(press4, true, "sendChar should dispatch keyPress with default prevented");