Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=591815 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 591815</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body onload="setTimeout(runTest, 0)"> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=591815">Mozilla Bug 591815</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content"> |
michael@0 | 16 | <div id="wrapper"> |
michael@0 | 17 | <!-- 20x20 of red --> |
michael@0 | 18 | <img id="image" ondragstart="fail();" |
michael@0 | 19 | src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC"/> |
michael@0 | 20 | </div> |
michael@0 | 21 | </div> |
michael@0 | 22 | <pre id="test"> |
michael@0 | 23 | |
michael@0 | 24 | <script type="application/javascript"> |
michael@0 | 25 | |
michael@0 | 26 | /** Test for Bug 591815 **/ |
michael@0 | 27 | |
michael@0 | 28 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 29 | |
michael@0 | 30 | function fail() { |
michael@0 | 31 | ok(false, "drag started but should not have"); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function runTest() { |
michael@0 | 35 | var image = document.getElementById("image"); |
michael@0 | 36 | var wrapper = document.getElementById("wrapper"); |
michael@0 | 37 | var preventDefault = function(event) { |
michael@0 | 38 | event.preventDefault(); |
michael@0 | 39 | }; |
michael@0 | 40 | wrapper.addEventListener('mousedown', preventDefault, false); |
michael@0 | 41 | |
michael@0 | 42 | synthesizeMouse(image, 3, 3, { type: "mousedown"}); |
michael@0 | 43 | synthesizeMouse(image, 53, 53, { type: "mousemove"}); |
michael@0 | 44 | synthesizeMouse(image, 53, 53, { type: "mouseup"}); |
michael@0 | 45 | |
michael@0 | 46 | wrapper.removeEventListener('mousedown', preventDefault, false); |
michael@0 | 47 | |
michael@0 | 48 | var relocateElementAndPreventDefault = function(event) { |
michael@0 | 49 | document.body.appendChild(wrapper); |
michael@0 | 50 | event.preventDefault(); |
michael@0 | 51 | } |
michael@0 | 52 | wrapper.addEventListener('mousedown', relocateElementAndPreventDefault, false); |
michael@0 | 53 | |
michael@0 | 54 | synthesizeMouse(image, 3, 3, { type: "mousedown"}); |
michael@0 | 55 | synthesizeMouse(image, 53, 53, { type: "mousemove"}); |
michael@0 | 56 | synthesizeMouse(image, 53, 53, { type: "mouseup"}); |
michael@0 | 57 | |
michael@0 | 58 | wrapper.removeEventListener('mousedown', relocateElementAndPreventDefault, false); |
michael@0 | 59 | |
michael@0 | 60 | ok(true, "passed the test"); |
michael@0 | 61 | SimpleTest.finish(); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | </script> |
michael@0 | 65 | </pre> |
michael@0 | 66 | </body> |
michael@0 | 67 | </html> |
michael@0 | 68 |