diff --git a/frontend/src/components/maps/LocationMapCanvas.jsx b/frontend/src/components/maps/LocationMapCanvas.jsx index b509164..606d9e9 100644 --- a/frontend/src/components/maps/LocationMapCanvas.jsx +++ b/frontend/src/components/maps/LocationMapCanvas.jsx @@ -176,7 +176,7 @@ export default function LocationMapCanvas({ const count = zoneItems.length; const countLabel = `${count} item${count === 1 ? "" : "s"}`; const labelLines = fittedLabelLines(object, "Area"); - const countY = labelLines.length > 1 ? object.y + 76 : object.y + 52; + const countY = filters.showLabels && labelLines.length > 1 ? object.y + 76 : object.y + 52; const pinDots = filters.showPins ? zoneItems.slice(0, 12).map((item, itemIndex) => { const column = itemIndex % 4; diff --git a/frontend/tests/location-map-manager.spec.ts b/frontend/tests/location-map-manager.spec.ts index 050e0a7..5541ff2 100644 --- a/frontend/tests/location-map-manager.spec.ts +++ b/frontend/tests/location-map-manager.spec.ts @@ -460,7 +460,14 @@ test("viewer wraps long zone labels and keeps item counts visible", async ({ pag await expect(produceArea.locator(".location-map-label tspan").nth(0)).toHaveText("Produce & Fresh"); await expect(produceArea.locator(".location-map-label tspan").nth(1)).toHaveText("Vegetables"); await expect(produceArea.locator(".location-map-count")).toHaveText("2 items"); + await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "116"); await expect(page.locator(".location-map-pin")).toHaveCount(0); + + await page.getByRole("button", { name: "Layers" }).click(); + await page.getByLabel("Labels").uncheck(); + await expect(produceArea.locator(".location-map-label")).toHaveCount(0); + await expect(produceArea.locator(".location-map-count")).toHaveText("2 items"); + await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "92"); }); test("members can view a published map but cannot edit it", async ({ page }) => {