From e3998acc12593dacf48212815d44d10bfbd582af Mon Sep 17 00:00:00 2001 From: Nico Date: Thu, 4 Jun 2026 01:36:59 -0700 Subject: [PATCH] fix: label map object types --- .../src/components/maps/LocationMapBottomSheet.jsx | 10 +++++++++- frontend/tests/location-map-manager.spec.ts | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/maps/LocationMapBottomSheet.jsx b/frontend/src/components/maps/LocationMapBottomSheet.jsx index 70e1bcf..b8153a4 100644 --- a/frontend/src/components/maps/LocationMapBottomSheet.jsx +++ b/frontend/src/components/maps/LocationMapBottomSheet.jsx @@ -19,6 +19,14 @@ const DISPLAY_CONTROLS = [ ["showUnmapped", "Unmapped"], ]; +function formatObjectTypeLabel(type) { + return String(type) + .split(/[-_\s]+/) + .filter(Boolean) + .map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`) + .join(" "); +} + export default function LocationMapBottomSheet({ mode, editorTool, @@ -261,7 +269,7 @@ export default function LocationMapBottomSheet({ onChange={(event) => onObjectField("type", event.target.value)} > {MAP_OBJECT_TYPES.map((type) => ( - + ))} diff --git a/frontend/tests/location-map-manager.spec.ts b/frontend/tests/location-map-manager.spec.ts index 00aa9b0..b91ad1a 100644 --- a/frontend/tests/location-map-manager.spec.ts +++ b/frontend/tests/location-map-manager.spec.ts @@ -288,6 +288,10 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({ const bakeryObject = page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first(); await bakeryObject.click(); await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bakery"); + const objectTypeSelect = page.getByLabel("Object type"); + await expect(objectTypeSelect).toHaveValue("zone"); + await expect(objectTypeSelect.locator('option[value="zone"]')).toHaveText("Zone"); + await expect(objectTypeSelect.locator('option[value="aisle"]')).toHaveText("Aisle"); const moveBox = await bakeryObject.boundingBox(); expect(moveBox).not.toBeNull(); if (!moveBox) throw new Error("Bakery map object could not be moved");