1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
<!doctype html>
<html>
<head>
<title>Pointer Event: Boundary event sequence at implicit capture release</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<link rel="author" title="Google" href="http://www.google.com "/>
<meta name="assert" content="When a captured pointer is implicitly released after a click, the boundary events should follow the lostpointercapture event."/>
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script type="text/javascript" src="pointerevent_support.js"></script>
<script type="text/javascript">
var detected_pointertypes = {};
var event_log = [];
var start_logging = false;
function resetTestState() {
detected_eventTypes = {};
event_log = [];
start_logging = false;
}
function run() {
var test_pointer_event = setup_pointerevent_test("Event sequence at implicit release on click", ["mouse"]);
var actions_promise;
var target = document.getElementById("target");
var capture_target = document.getElementById("capture-target");
All_Pointer_Events.forEach(function(eventName) {
on_event(target, eventName, function (event) {
detected_pointertypes[event.pointerType] = true;
if (event.type == "pointerdown") {
capture_target.setPointerCapture(event.pointerId);
start_logging = true;
} else if (start_logging) {
event_log.push(event.type + '@' + event.target.id);
}
});
on_event(capture_target, eventName, function (event) {
detected_pointertypes[event.pointerType] = true;
event_log.push(event.type + '@' + event.target.id);
if (event.type == 'lostpointercapture') {
step_timeout(function() {
test_pointer_event.step(function () {
var expected_events = "pointerup, lostpointercapture, pointerout, pointerleave";
assert_equals(event_log.join(", "), "pointerout@target, pointerleave@target, pointerover@capture-target, pointerenter@capture-target, gotpointercapture@capture-target, pointerup@capture-target, lostpointercapture@capture-target, pointerout@capture-target, pointerleave@capture-target, pointerover@target, pointerenter@target");
});
// Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_pointer_event.done();
});
}, 200);
}
});
});
// Inject mouse inputs.
actions_promise = new test_driver.Actions()
.pointerMove(0, 0, {origin: target})
.pointerDown()
.pointerUp()
.send();
}
</script>
<style>
#target {
margin: 20px;
background-color: black;
}
</style>
</head>
<body onload="run()">
<h1>Pointer Event: Boundary event sequence at implicit capture release</h1>
<h2 id="pointerTypeDescription"></h2>
<h4>
When a captured pointer is implicitly released after a click, the boundary events should follow the lostpointercapture event.
</h4>
<ol>
<li>Click on the black box with mouse and do not move the mouse after or during the click.</li>
</ol>
<div id="capture-target"></div>
<div id="target"></div>
<div id="complete-notice">
<p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
<p>The following events were logged: <span id="event-log"></span>.</p>
</div>
<div id="log"></div>
</body>
</html>
|