From 490bfc708f9c736485abf67d07365599d9cffb17 Mon Sep 17 00:00:00 2001 From: jay23606 <4602056+jay23606@users.noreply.github.com> Date: Fri, 23 Oct 2026 09:40:14 -0400 Subject: [PATCH 1/2] fix: label single place map pins --- src/components/map/map-view.test.tsx | 58 ++++++++++++++++++++++++++++ src/components/map/map-view.tsx | 1 + 2 files changed, 59 insertions(+) diff --git a/src/components/map/map-view.test.tsx b/src/components/map/map-view.test.tsx index df29991..2bc5788 100644 --- a/src/components/map/map-view.test.tsx +++ b/src/components/map/map-view.test.tsx @@ -3,6 +3,35 @@ import { afterEach, describe, expect, it, vi } from "vitest"; import MapView from "@/components/map/map-view"; +vi.mock("react-leaflet", async () => { + const React = await import("react"); + const map = { + getBounds: () => ({ + getWest: () => -1, + getSouth: () => -1, + getEast: () => 1, + getNorth: () => 1, + }), + getZoom: () => 18, + getContainer: () => document.createElement("div"), + fitBounds: vi.fn(), + scrollWheelZoom: { disable: vi.fn(), enable: vi.fn(), enabled: () => false }, + on: vi.fn(), + off: vi.fn(), + }; + return { + MapContainer: ({ children }: React.PropsWithChildren) =>
{children}
, + Marker: ({ title }: React.PropsWithChildren<{ title?: string }>) => ( +
+ ), + Popup: ({ children }: React.PropsWithChildren) =>
{children}
, + TileLayer: () => null, + Tooltip: () => null, + CircleMarker: () => null, + useMap: () => map, + }; +}); + afterEach(() => { cleanup(); vi.unstubAllEnvs(); @@ -28,4 +57,33 @@ describe("MapView configuration", () => { expect.stringContaining("NEXT_PUBLIC_MAPTILER_KEY is missing"), ); }); + + it("gives a single place pin an accessible name with its category", () => { + vi.stubEnv("NEXT_PUBLIC_MAPTILER_KEY", "test-key"); + vi.stubGlobal( + "ResizeObserver", + class { + observe() {} + disconnect() {} + }, + ); + render( + , + ); + + expect(screen.getByRole("button", { name: /Heathrow Airport, Airport/ })).toBeTruthy(); + }); }); diff --git a/src/components/map/map-view.tsx b/src/components/map/map-view.tsx index 9cfd3c3..63385d6 100644 --- a/src/components/map/map-view.tsx +++ b/src/components/map/map-view.tsx @@ -175,6 +175,7 @@ function ClusteredMarkers({ places }: { places: Place[] }) { { From 324b3a194b4695519839e646bf13d0bb00fd1819 Mon Sep 17 00:00:00 2001 From: jay23606 <4602056+jay23606@users.noreply.github.com> Date: Fri, 23 Oct 2026 10:47:22 -0400 Subject: [PATCH 2/2] fix: format accessible map pin tests Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com> Co-Authored-By: Claude Haiku 5.5 --- src/components/map/map-view.test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/map/map-view.test.tsx b/src/components/map/map-view.test.tsx index 2bc5788..d081f5d 100644 --- a/src/components/map/map-view.test.tsx +++ b/src/components/map/map-view.test.tsx @@ -84,6 +84,8 @@ describe("MapView configuration", () => { />, ); - expect(screen.getByRole("button", { name: /Heathrow Airport, Airport/ })).toBeTruthy(); + expect( + screen.getByRole("button", { name: /Heathrow Airport, Airport/ }), + ).toBeTruthy(); }); });