You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
leaflet-components/test/setup.ts

18 lines
770 B
TypeScript

// Install the ambient DOM augmentations (leaflet-* tag map, custom-event map)
// for the whole test program. In the shipped package these come in through the
// npm entry (src/index.npm.ts); the tests import element modules directly, so
// they need this explicit pull-in to type `addEventListener('leaflet-register',
// ...)` and `querySelector('leaflet-map')`.
import '../src/core/globals.ts';
// jsdom has no ResizeObserver. leaflet-map only uses it to call
// invalidateSize() on resize, which no test here depends on incidentally --
// without a stub, just importing the component throws.
class ResizeObserverStub implements ResizeObserver {
observe(): void {}
unobserve(): void {}
disconnect(): void {}
}
globalThis.ResizeObserver ??= ResizeObserverStub;