dom/events/test/test_bug591815.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/test/test_bug591815.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=591815
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 591815</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 +</head>
    1.15 +<body onload="setTimeout(runTest, 0)">
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=591815">Mozilla Bug 591815</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content">
    1.19 +  <div id="wrapper">
    1.20 +    <!-- 20x20 of red -->
    1.21 +    <img id="image" ondragstart="fail();"
    1.22 +         src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC"/>
    1.23 +  </div>
    1.24 +</div>
    1.25 +<pre id="test">
    1.26 +
    1.27 +<script type="application/javascript">
    1.28 +
    1.29 +/** Test for Bug 591815 **/
    1.30 +
    1.31 +SimpleTest.waitForExplicitFinish();
    1.32 +
    1.33 +function fail() {
    1.34 +  ok(false, "drag started but should not have");
    1.35 +}
    1.36 +
    1.37 +function runTest() {
    1.38 +  var image = document.getElementById("image");
    1.39 +  var wrapper = document.getElementById("wrapper");
    1.40 +  var preventDefault = function(event) {
    1.41 +    event.preventDefault();
    1.42 +  };
    1.43 +  wrapper.addEventListener('mousedown', preventDefault, false);
    1.44 +
    1.45 +  synthesizeMouse(image, 3, 3, { type: "mousedown"});
    1.46 +  synthesizeMouse(image, 53, 53, { type: "mousemove"});
    1.47 +  synthesizeMouse(image, 53, 53, { type: "mouseup"});
    1.48 +
    1.49 +  wrapper.removeEventListener('mousedown', preventDefault, false);
    1.50 +
    1.51 +  var relocateElementAndPreventDefault = function(event) {
    1.52 +    document.body.appendChild(wrapper);
    1.53 +    event.preventDefault();
    1.54 +  }
    1.55 +  wrapper.addEventListener('mousedown', relocateElementAndPreventDefault, false);
    1.56 +
    1.57 +  synthesizeMouse(image, 3, 3, { type: "mousedown"});
    1.58 +  synthesizeMouse(image, 53, 53, { type: "mousemove"});
    1.59 +  synthesizeMouse(image, 53, 53, { type: "mouseup"});
    1.60 +
    1.61 +  wrapper.removeEventListener('mousedown', relocateElementAndPreventDefault, false);
    1.62 +
    1.63 +  ok(true, "passed the test");
    1.64 +  SimpleTest.finish();
    1.65 +}
    1.66 +
    1.67 +</script>
    1.68 +</pre>
    1.69 +</body>
    1.70 +</html>
    1.71 +

mercurial