Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!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>