Enhance interaction testing support (getMousePosition, getSize)#39
Enhance interaction testing support (getMousePosition, getSize)#39
Conversation
- Patched `L.DomEvent.getMousePosition` to use `getBoundingClientRect` when available, enabling accurate coordinate translation in JSDOM tests. - Updated `L.Map.prototype.getSize` to prioritize container dimensions (`clientWidth`/`clientHeight` or `getBoundingClientRect`) over headless defaults, allowing JSDOM mocks to control map size. - Verified that `L.DomEvent` correctly delegates to native `addEventListener` in the JSDOM environment provided by leaflet-node. - Added comprehensive tests in `tests/interaction.test.ts` to verify these behaviors.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
- Patched `L.DomEvent.getMousePosition` to use `getBoundingClientRect` when available, enabling accurate coordinate translation in JSDOM tests. - Updated `L.Map.prototype.getSize` to prioritize container dimensions (`clientWidth`/`clientHeight` or `getBoundingClientRect`) over headless defaults, allowing JSDOM mocks to control map size. - Verified that `L.DomEvent` correctly delegates to native `addEventListener` in the JSDOM environment provided by leaflet-node. - Added comprehensive tests in `tests/interaction.test.ts` to verify these behaviors.
This change improves support for interaction testing in JSDOM environments by patching
L.DomEvent.getMousePositionto usegetBoundingClientRectand updatingL.Map.prototype.getSizeto check for container dimensions. This allows users to mock DOM elements effectively in tests. Native event listeners are already supported and verified by new tests.PR created automatically by Jules for task 6536390394354424312 started by @jburnhams