dom/events/test/test_bug556493.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/test/test_bug556493.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=556493
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 556493</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <style>
    1.15 +    div {
    1.16 +      border: 1px solid;
    1.17 +    }
    1.18 +  </style>
    1.19 +</head>
    1.20 +<body onload="setTimeout(runTest, 0)">
    1.21 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=556493">Mozilla Bug 556493</a>
    1.22 +<p id="display"></p>
    1.23 +<div id="content" style="display: none">
    1.24 +  
    1.25 +</div>
    1.26 +<pre id="test">
    1.27 +<script type="application/javascript">
    1.28 +
    1.29 +/** Test for Bug 556493 **/
    1.30 +
    1.31 +SimpleTest.waitForExplicitFinish();
    1.32 +
    1.33 +var downCount = 0;
    1.34 +var upCount = 0;
    1.35 +var clickCount = 0;
    1.36 +function runTest() {
    1.37 +  var d0 = document.getElementById("d0");
    1.38 +  var d1 = document.getElementById("d1");
    1.39 +  var d2 = document.getElementById("d2");
    1.40 +
    1.41 +  d0.onmousedown = function(e) { ++downCount; };
    1.42 +  d0.onmouseup = function(e) { ++upCount; }
    1.43 +  d0.onclick = function(e) { ++clickCount; }
    1.44 +
    1.45 +  synthesizeMouse(d1, 3, 3, { type: "mousedown"});
    1.46 +  synthesizeMouse(d1, 3, 3, { type: "mouseup"});
    1.47 +
    1.48 +  is(downCount, 1, "Wrong mousedown event count!");
    1.49 +  is(upCount, 1, "Wrong mouseup event count!");
    1.50 +  is(clickCount, 1, "Wrong click event count!");
    1.51 +
    1.52 +  synthesizeMouse(d1, 3, 3, { type: "mousedown"});
    1.53 +  synthesizeMouse(d1, 30, 3, { type: "mouseup"});
    1.54 +
    1.55 +  is(downCount, 2, "Wrong mousedown event count!");
    1.56 +  is(upCount, 2, "Wrong mouseup event count!");
    1.57 +  is(clickCount, 2, "Wrong click event count!");
    1.58 +
    1.59 +  synthesizeMouse(d1, 3, 3, { type: "mousedown"});
    1.60 +  synthesizeMouse(d2, 3, 3, { type: "mouseup"});
    1.61 +
    1.62 +  is(downCount, 3, "Wrong mousedown event count!");
    1.63 +  is(upCount, 3, "Wrong mouseup event count!");
    1.64 +  is(clickCount, 2, "Wrong click event count!");
    1.65 +
    1.66 +  SimpleTest.finish();
    1.67 +}
    1.68 +
    1.69 +</script>
    1.70 +</pre>
    1.71 +<div id="d0">
    1.72 +Test divs --
    1.73 +<div id="d1">t</div><div id="d2">t</div>
    1.74 +--
    1.75 +</div>
    1.76 +</body>
    1.77 +</html>

mercurial