Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
<!doctype html>
<head>
<meta charset="utf-8">
<title>`click` event after compatibility mouse event should have proper `pointerId`</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<style>
#target {
width: 100px;
height: 100px;
background-color: green;
}
</style>
<script>
"use strict";
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async () => {
await SpecialPowers.pushPrefEnv({set: [
// Don't change this pref to true because this test checks the behavior of
// PresShell::EventHandler::MaybeSynthesizeCompatMouseEventsForTouchEnd()
// which is a fallback path when the touch is not handled by APZ.
["test.events.async.enabled", false]
]});
const target = document.getElementById("target");
target.addEventListener("click", event => {
is(
event.pointerId,
5,
"pointerId of `click` should be the specified ID of the touch"
);
SimpleTest.finish();
}, {once: true});
synthesizeTouchAtCenter(target, {id: 5});
});
</script>
</head>
<body>
<div id="target"></div>
</body>
</html>