blob: 25fbfa530c97a2d23607ad9d5ee3ea540a09f16e [file]
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
</head>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../utils.js"></script>
<script>
'use strict';
target_test(async (target, test) => {
const eventTracker = new EventTracker(target, ["pointerdown", "mousedown"]);
// Press the mouse once without calling preventDefault().
await eventSender.asyncMouseMoveTo(50, 50);
await eventSender.asyncMouseDown();
await eventSender.asyncMouseUp();
// Press it again and call preventDefault().
target.addEventListener("pointerdown", event => event.preventDefault());
await eventSender.asyncMouseMoveTo(50, 50);
await eventSender.asyncMouseDown();
await eventSender.asyncMouseUp();
eventTracker.assertMatchesEvents([
{ type: "pointerdown", x: 50, y: 50 },
{ type: "mousedown", x: 50, y: 50 },
{ type: "pointerdown", x: 50, y: 50 },
]);
test.done();
}, `Testing that calling preventDefault() when handling a "pointerdown" event does not dispatch a "mousedown" event.`);
</script>
</body>
</html>