mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 10:44:23 +00:00
test(tours): follow the reworked planner, ferrata and map stage in their suites; keep the map's waypoint list stable between renders
This commit is contained in:
@@ -22,6 +22,7 @@ const gl = vi.hoisted(() => {
|
||||
const listeners = new Map<string, Handler[]>();
|
||||
const sources = new Map<string, Record<string, unknown>>();
|
||||
const markers: MarkerStub[] = [];
|
||||
const container = document.createElement('div');
|
||||
const listen = (type: string, fn: Handler) => listeners.set(type, [...(listeners.get(type) ?? []), fn]);
|
||||
const map = {
|
||||
on: vi.fn((type: string, fn: Handler) => {
|
||||
@@ -39,6 +40,14 @@ const gl = vi.hoisted(() => {
|
||||
listen(type, wrapped);
|
||||
return map;
|
||||
}),
|
||||
off: vi.fn((type: string, fn: Handler) => {
|
||||
listeners.set(
|
||||
type,
|
||||
(listeners.get(type) ?? []).filter((other) => other !== fn)
|
||||
);
|
||||
return map;
|
||||
}),
|
||||
getContainer: vi.fn(() => container),
|
||||
remove: vi.fn(),
|
||||
fitBounds: vi.fn(),
|
||||
jumpTo: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user