mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1637197 [wpt PR 23526] - [uievents] Simplify dblclick test to make it fail fast, a=testonly
Automatic update from web-platform-tests [uievents] Simplify dblclick test to make it fail fast (#23526) Previously, if the actions_promise was rejected, which happens when running manually, the test would simply time out. This also renames the test to match sibling tests and make room for a dblclick_event_touch.html to be added. -- wpt-commits: d30f14a9935dc8c7627d668ae3111f0a75587184 wpt-pr: 23526
This commit is contained in:
parent
6ca7f593a0
commit
89cb52b8ec
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>dblclick event for the mouse pointer type</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<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>
|
||||
<style>
|
||||
#target
|
||||
{
|
||||
background-color: green;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>Double-click on the green box with the left mouse button.</p>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
promise_test(async (t) => {
|
||||
const target = document.getElementById("target");
|
||||
const event_watcher = new EventWatcher(t, target, ["click", "dblclick"]);
|
||||
const actions_promise = new test_driver.Actions()
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown()
|
||||
.pointerUp()
|
||||
.pointerDown()
|
||||
.pointerUp()
|
||||
.send();
|
||||
// Make sure the test finishes after all the input actions are completed.
|
||||
t.add_cleanup(() => actions_promise);
|
||||
const event = await event_watcher.wait_for(["click", "click", "dblclick"]);
|
||||
assert_equals(event.type, "dblclick");
|
||||
assert_equals(event.target, target);
|
||||
assert_equals(event.detail, 2);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,55 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Double Click</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<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>
|
||||
<style type="text/css">
|
||||
.textarea
|
||||
{
|
||||
background: red;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
// Send two continuous clicks.
|
||||
function run() {
|
||||
var testDoubleClick = async_test('Tests that the double click event is correctly generated by sending pointerDown, pointerUp, pointerDown and pointerUp for the mouse type.');
|
||||
var elem = document.getElementById("click_area");
|
||||
var actions_promise;
|
||||
elem.addEventListener('dblclick', function(e) {
|
||||
testDoubleClick.step(function () {
|
||||
assert_equals(e.target.id, "click_area");
|
||||
assert_equals(e.detail, 2);
|
||||
});
|
||||
// Make sure the test finishes after all the input actions are completed.
|
||||
actions_promise.then( () => {
|
||||
testDoubleClick.done();
|
||||
});
|
||||
});
|
||||
|
||||
actions_promise = new test_driver.Actions()
|
||||
.pointerMove(0, 0, {origin: elem})
|
||||
.pointerDown()
|
||||
.pointerUp()
|
||||
.pointerDown()
|
||||
.pointerUp()
|
||||
.send();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<h1>Double Click</h1>
|
||||
<p>Double-click on the text area and check if the "dblclick" event is received.</p>
|
||||
<div id="click_area" class="textarea"></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user