Bug 1637757 [wpt PR 23578] - Move mouse-pointer-on-scrollbar.html to wpt, a=testonly

Automatic update from web-platform-tests
Move mouse-pointer-on-scrollbar.html to wpt

Move mouse pointerevents compat events to wpt

Change-Id: I27666589f75ee9f0a4c6e3af3e9b2c02f84da0c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199724
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Liviu Tinta <liviutinta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769403}

--

wpt-commits: f9f371816822b10c3d87564fba264026dd3be24f
wpt-pr: 23578
This commit is contained in:
Liviu Tinta 2020-05-21 10:23:04 +00:00 коммит произвёл moz-wptsync-bot
Родитель bf6b20b250
Коммит 3dc3d57139
1 изменённых файлов: 68 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,68 @@
<!DOCTYPE HTML>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script type="text/javascript" src="../pointerevent_support.js"></script>
<style>
#target {
height: 100px;
width: 100px;
overflow-y: scroll;
}
#spacer {
background: green;
height: 200px;
}
</style>
<h1>Verifies that pointerup/down are fired correctly for corresponding mouse events on the scollbar.</h1>
<div id="target">
<div id="spacer"></div>
</div>
<div id="console"></div>
<script>
var receivedEvents = [];
var targetDiv = document.getElementById('target');
function init() {
var eventList = ["mousedown", "mouseup", "pointerdown", "pointerup"];
eventList.forEach(function(eventName) {
targetDiv.addEventListener(eventName, function(event) {
receivedEvents.push(event.type + "@target");
});
});
}
function performActions(x, y){
return new test_driver.Actions()
.pointerMove(0, 0)
.pointerMove(x, y)
.pointerDown(0)
.pointerUp(0)
.send()
.then(()=>resolveWhen(()=>receivedEvents.length == 4));
}
function runTests() {
var rect = targetDiv.getBoundingClientRect();
var x1 = rect.right - 5;
var y1 = rect.top + 20;
test(function(){
assert_equals(targetDiv, document.elementFromPoint(x1,y1),
"Didn't hit the scrollbar as expected");
}, `Test point (${x1},${y1}) is on the scrollbar`);
promise_test(async () => {
await performActions(Math.ceil(x1), Math.ceil(y1));
assert_array_equals(receivedEvents, ["pointerdown@target", "mousedown@target",
"pointerup@target", "mouseup@target"]);
}, "Verifies that pointerup/down are fired correctly for corresponding mouse events on the scollbar.");
}
init();
runTests();
</script>