Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/web/src/hooks/usePinMarker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,18 @@ it("reattaches the pin after the map is replaced by a retry", async () => {
expect(fake.map.getCanvasContainer().querySelector("span")?.textContent).toBe("Station");

const replacement = createFakeMap({ styleLoaded: true });
// The visible label is fitted against the new map's container on the next frame.
Object.assign(replacement.map.getContainer(), {
getBoundingClientRect: () => new DOMRect(0, 0, 1200, 800),
});
mapRef.current = replacement.map;
styleVersion++;
view.rerender(<Pin label="Station" />);
await act(async () => {});

expect(fake.map.getCanvasContainer().querySelector("span")).toBeNull();
expect(replacement.map.getCanvasContainer().querySelector("span")?.textContent).toBe("Station");
await act(async () => new Promise<void>((resolve) => requestAnimationFrame(() => resolve())));
view.unmount();
mapRef.current = fake.map;
styleVersion = 0;
Expand Down
Loading