2 <script src=
"../../../resources/js-test.js"></script>
3 <style type=
"text/css">
4 html
, body
, .workspace
{
18 border: 1px solid
#aaaaaa;
22 <div class=
"workspace"></div>
25 <button>POINTER
</button>
28 <p id=
"description"></p>
29 <div id=
"console"></div>
31 var div
= document
.getElementById("test");
32 var x
= div
.offsetLeft
+ 100;
33 var y
= div
.offsetTop
- window
.pageYOffset
+ 1;
37 window
.scrollTo(0, 200);
38 if (window
.eventSender
) {
39 function appendEventLog(e
) {
41 targets
.push(e
.currentTarget
.nodeName
);
44 function runNextTest(eventType1
, eventType2
)
46 document
.addEventListener(eventType1
, appendEventLog
);
47 document
.body
.addEventListener(eventType1
, appendEventLog
);
48 document
.addEventListener(eventType2
, appendEventLog
);
49 document
.body
.addEventListener(eventType2
, appendEventLog
);
50 eventSender
.mouseMoveTo(x
, y
); // html element in iframe
51 eventSender
.mouseMoveTo(x
, y
+ 200); // out of iframe
52 eventSender
.mouseMoveTo(x
, y
- 100); // body element in iframe
53 eventSender
.mouseMoveTo(x
, y
+ 200); // out of iframe
54 document
.removeEventListener(eventType1
, appendEventLog
);
55 document
.body
.removeEventListener(eventType1
, appendEventLog
);
56 document
.removeEventListener(eventType2
, appendEventLog
);
57 document
.body
.removeEventListener(eventType2
, appendEventLog
);
59 runNextTest('mousemove', '');
60 runNextTest('mouseover', '');
61 runNextTest('mouseout', '');
62 runNextTest('mouseenter', 'mouseleave');
65 function verifyEventLog(eventType
, target
)
67 shouldBeEqualToString('events[' + i
+ ']', eventType
);
68 shouldBeEqualToString('targets[' + i
+ ']', target
);
71 verifyEventLog('mousemove', '#document'); // x, y
72 verifyEventLog('mousemove', 'BODY'); // x, y - 100
73 verifyEventLog('mousemove', '#document'); // x, y - 100
74 verifyEventLog('mouseover', '#document'); // x, y
75 verifyEventLog('mouseover', 'BODY'); // x, y - 100
76 verifyEventLog('mouseover', '#document'); // x, y - 100
77 verifyEventLog('mouseout', '#document'); // x, y
78 verifyEventLog('mouseout', 'BODY'); // x, y - 100
79 verifyEventLog('mouseout', '#document'); // x, y - 100
80 verifyEventLog('mouseenter', '#document');// x, y
81 verifyEventLog('mouseleave', '#document');// x, y
82 verifyEventLog('mouseenter', '#document');// x, y - 100
83 verifyEventLog('mouseenter', 'BODY'); // x, y - 100
84 verifyEventLog('mouseleave', 'BODY'); // x, y + 200
85 verifyEventLog('mouseleave', '#document');// x, y + 200