Bug 1587556 [wpt PR 19602] - Implements pageX and pageY attributes on MouseEvent interface, a=testonly

Automatic update from web-platform-tests
Implements pageX and pageY attributes

--

wpt-commits: 48df6a332b55bb0116ae15eb3279808b30087c21
wpt-pr: 19602
This commit is contained in:
Micah Tigley 2019-10-22 16:36:01 +00:00 committed by James Graham
parent b9cd55309e
commit f0a67f544a

View File

@ -2,6 +2,9 @@
<meta charset=utf-8>
<head>
<title>CSSOM MouseEvent tests</title>
<div style="background:lightblue; height:10000px">
Hello
</div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
@ -13,5 +16,18 @@ test(function () {
assert_equals(mouseEvent.x, 30);
assert_equals(mouseEvent.y, 40);
}, 'MouseEvent\'s x and y must be equal to clientX and clientY.');
test(function () {
var mouseEvent1 = new MouseEvent('mousedown', {clientX: 10, clientY: 20});
assert_equals(mouseEvent1.pageX, 10);
assert_equals(mouseEvent1.pageY, 20);
scrollBy(0, 5000);
assert_equals(mouseEvent1.pageX, 10);
assert_equals(mouseEvent1.pageY, 5020);
var mouseEvent2 = new MouseEvent('mousedown', {clientX: 10, clientY: 20});
assert_equals(mouseEvent2.pageX, 10);
assert_equals(mouseEvent2.pageY, 5020);
}, 'MouseEvent\'s pageX and pageY attributes should be the sum of the scroll offset and clientX/clientY');
</script>
</head>