Spun out of code review on #103 (item #4).
Context
layouts/index.html assigns window.__map = map so the two NZ regression tests in tests/ui.spec.ts can call m.setView(...) and m.latLngToContainerPoint(...) directly. This works but bleeds test affordance into production:
// layouts/index.html (around L1158)
window.__map = map;
Proposed fix
Either:
- Gate behind a build-time flag:
if (window.__TEST__) window.__map = map; and have Playwright set window.__TEST__ = true before page load.
- Or expose the map via a
data-leaflet-map="ready" attribute and have tests resolve it through Leaflet's own _leaflet_id registry.
Acceptance
Spun out of code review on #103 (item #4).
Context
layouts/index.htmlassignswindow.__map = mapso the two NZ regression tests intests/ui.spec.tscan callm.setView(...)andm.latLngToContainerPoint(...)directly. This works but bleeds test affordance into production:Proposed fix
Either:
if (window.__TEST__) window.__map = map;and have Playwright setwindow.__TEST__ = truebefore page load.data-leaflet-map="ready"attribute and have tests resolve it through Leaflet's own_leaflet_idregistry.Acceptance
window.__mapno longer set in production build