|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=549170 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 549170</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body onload="window.setTimeout(runTests, 0);"> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=549170">Mozilla Bug 549170</a> |
|
14 <p id="display"></p> |
|
15 <div id="content" style="display: none"> |
|
16 </div> |
|
17 <input id='i' |
|
18 onmouseup="mouseHandler(event);" |
|
19 onmousedown="mouseHandler(event);"> |
|
20 <textarea id='t' |
|
21 onmouseup="mouseHandler(event);" |
|
22 onmousedown="mouseHandler(event);"></textarea><br> |
|
23 <input id='ip' placeholder='foo' |
|
24 onmouseup="mouseHandler(event);" |
|
25 onmousedown="mouseHandler(event);"> |
|
26 <textarea id='tp' placeholder='foo' |
|
27 onmouseup="mouseHandler(event);" |
|
28 onmousedown="mouseHandler(event);"></textarea> |
|
29 <pre id="test"> |
|
30 |
|
31 <script type="application/javascript"> |
|
32 |
|
33 /** Test for Bug 549170 **/ |
|
34 |
|
35 var gNumberOfMouseEventsCatched = 0; |
|
36 |
|
37 SimpleTest.waitForExplicitFinish(); |
|
38 |
|
39 function mouseHandler(aEvent) |
|
40 { |
|
41 gNumberOfMouseEventsCatched++; |
|
42 is(SpecialPowers.wrap(aEvent).originalTarget.nodeName, "DIV", "An inner div should be the target of the event"); |
|
43 ok(SpecialPowers.wrap(aEvent).originalTarget.classList.contains("anonymous-div"), "the target div should be the editor div"); |
|
44 } |
|
45 |
|
46 function checkMouseEvents(element) |
|
47 { |
|
48 gNumberOfMouseEventsCatched = 0; |
|
49 |
|
50 synthesizeMouse(element, 5, 5, {type: "mousedown", button: 0}); |
|
51 synthesizeMouse(element, 5, 5, {type: "mouseup", button: 0}); |
|
52 synthesizeMouse(element, 5, 5, {type: "mousedown", button: 1}); |
|
53 // NOTE: this event is going to copy the buffer on linux, this should not be a problem |
|
54 synthesizeMouse(element, 5, 5, {type: "mouseup", button: 1}); |
|
55 synthesizeMouse(element, 5, 5, {type: "mousedown", button: 2}); |
|
56 synthesizeMouse(element, 5, 5, {type: "mouseup", button: 2}); |
|
57 |
|
58 is(gNumberOfMouseEventsCatched, 6, "Some mouse events have not been catched"); |
|
59 } |
|
60 |
|
61 function runTests() |
|
62 { |
|
63 checkMouseEvents(document.getElementById('i')); |
|
64 checkMouseEvents(document.getElementById('t')); |
|
65 checkMouseEvents(document.getElementById('ip')); |
|
66 checkMouseEvents(document.getElementById('tp')); |
|
67 |
|
68 SimpleTest.finish(); |
|
69 } |
|
70 |
|
71 </script> |
|
72 </pre> |
|
73 </body> |
|
74 </html> |