зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1675123 [wpt PR 26387] - Simulate user inputs in mouseevent_move_button.html, a=testonly
Automatic update from web-platform-tests Simulate user inputs in mouseevent_move_button.html Use testdriver Action API to simulate mouse actions in uievents/mouse/mouseevent_move_button.html. Bug: 1145677 Change-Id: Ie0924fe1086655c30ea765731a4927f9ec2191cb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2516439 Commit-Queue: Lan Wei <lanwei@chromium.org> Reviewed-by: Mustaq Ahmed <mustaq@chromium.org> Cr-Commit-Position: refs/heads/master@{#824152} -- wpt-commits: 263a6d1a6397c683171646ad89d11966f363112e wpt-pr: 26387
This commit is contained in:
Родитель
e92a680659
Коммит
18048475d2
|
@ -6,6 +6,9 @@
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.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>
|
<style>
|
||||||
div.box {
|
div.box {
|
||||||
border: 2px solid lightgray;
|
border: 2px solid lightgray;
|
||||||
|
@ -41,6 +44,7 @@
|
||||||
<script>
|
<script>
|
||||||
var test = async_test("mouse events fired without button state");
|
var test = async_test("mouse events fired without button state");
|
||||||
var button = -1;
|
var button = -1;
|
||||||
|
var actions_promise;
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
var lightgreen = document.getElementById("lightgreen");
|
var lightgreen = document.getElementById("lightgreen");
|
||||||
|
@ -77,9 +81,21 @@
|
||||||
on_event(lightblue, "mouseup", function (event) {
|
on_event(lightblue, "mouseup", function (event) {
|
||||||
if (button != -1) {
|
if (button != -1) {
|
||||||
test.step(function() {assert_equals(event.button, button, "Button must be the same as mousedown.");});
|
test.step(function() {assert_equals(event.button, button, "Button must be the same as mousedown.");});
|
||||||
test.done();
|
// Make sure the test finishes after all the input actions are completed.
|
||||||
|
actions_promise.then( () => {
|
||||||
|
test.done();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Inject mouse inputs.
|
||||||
|
var actions = new test_driver.Actions();
|
||||||
|
actions_promise = actions.pointerMove(0, 0, {origin: lightgreen})
|
||||||
|
.pointerDown({button: actions.ButtonType.MIDDLE})
|
||||||
|
.pointerMove(0, 0, {origin: lightyellow})
|
||||||
|
.pointerMove(0, 0, {origin: lightblue})
|
||||||
|
.pointerUp({button: actions.ButtonType.MIDDLE})
|
||||||
|
.send();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
Загрузка…
Ссылка в новой задаче