LibWeb: Add a test for construction of WheelEvent

This commit is contained in:
Shannon Booth 2024-05-12 22:31:12 +12:00 committed by Alexander Kalenik
parent 2e1316507f
commit 793cab7357
2 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,27 @@
deltaX: 0
deltaY: 0
deltaZ: 0
deltaMode: 0
view: null
screenX: 0
screenY: 0
clientX: 0
clientY: 0
ctrlKey: false
altKey: false
shiftKey: false
metaKey: false
deltaX: 10
deltaY: 20
deltaZ: 35
deltaMode: 2
view: null
screenX: 1
screenY: 2
clientX: 3
clientY: 4
ctrlKey: true
altKey: true
shiftKey: false
metaKey: true

View file

@ -0,0 +1,37 @@
<script src="../include.js"></script>
<script>
function dumpWheelEvent(wheelEvent) {
println("deltaX: " + wheelEvent.deltaX);
println("deltaY: " + wheelEvent.deltaY);
println("deltaZ: " + wheelEvent.deltaZ);
println("deltaMode: " + wheelEvent.deltaMode);
println("view: " + wheelEvent.view);
println("screenX: " + wheelEvent.screenX);
println("screenY: " + wheelEvent.screenY);
println("clientX: " + wheelEvent.clientX);
println("clientY: " + wheelEvent.clientY);
println("ctrlKey: " + wheelEvent.ctrlKey);
println("altKey: " + wheelEvent.altKey);
println("shiftKey: " + wheelEvent.shiftKey);
println("metaKey: " + wheelEvent.metaKey);
}
test(() => {
dumpWheelEvent(new WheelEvent('wheel'));
println('');
dumpWheelEvent(new WheelEvent('wheel', {
deltaX: 10,
deltaY: 20,
deltaZ: 35,
deltaMode: WheelEvent.DOM_DELTA_PAGE,
screenX: 1,
screenY: 2,
clientX: 3,
clientY: 4,
ctrlKey: true,
altKey: true,
shiftKey: false,
metaKey: true,
}));
});
</script>