diff --git a/frontend/src/components/maps/LocationMapBottomSheetSections.jsx b/frontend/src/components/maps/LocationMapBottomSheetSections.jsx index a7460e1..fd6ee10 100644 --- a/frontend/src/components/maps/LocationMapBottomSheetSections.jsx +++ b/frontend/src/components/maps/LocationMapBottomSheetSections.jsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { objectZoneId } from "../../lib/locationMapUtils"; +import { getMapObjectDisplayLabel, objectZoneId } from "../../lib/locationMapUtils"; export const MAP_DISPLAY_CONTROLS = [ ["showZones", "Zones"], @@ -134,6 +134,8 @@ export function SelectedMapObjectForm({ onDuplicateObject, onDeleteObject, }) { + const selectedObjectLabel = getMapObjectDisplayLabel(selectedObject); + return (
- - + +
); diff --git a/frontend/tests/location-map-manager.spec.ts b/frontend/tests/location-map-manager.spec.ts index d396d1a..920cdc5 100644 --- a/frontend/tests/location-map-manager.spec.ts +++ b/frontend/tests/location-map-manager.spec.ts @@ -357,11 +357,11 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({ await page.getByRole("textbox", { name: "Label" }).fill("Bread Wall"); await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bread Wall"); - await page.getByRole("button", { name: "Duplicate" }).click(); + await page.getByRole("button", { name: "Duplicate area Bread Wall" }).click(); await expect(page.getByRole("textbox", { name: "Label" })).toHaveValue("Bread Wall Copy"); await page.getByLabel("Linked zone").selectOption("502"); await page.getByRole("textbox", { name: "Label" }).fill("Temporary Freezer"); - await page.getByRole("button", { name: "Delete" }).click(); + await page.getByRole("button", { name: "Delete area Temporary Freezer" }).click(); await confirmSlide(page); await expect(page.locator(".location-map-object", { hasText: "Temporary Freezer" })).toHaveCount(0); @@ -1113,7 +1113,7 @@ test("closes stale map delete confirmation after switching locations", async ({ await page.goto("/stores/100/locations/10/map"); await page.getByRole("button", { name: "Continue Editing" }).click(); await page.getByRole("button", { name: "Map area Eastvale Bakery" }).click(); - await page.getByRole("button", { name: "Delete" }).click(); + await page.getByRole("button", { name: "Delete area Eastvale Bakery" }).click(); await expect(page.getByRole("heading", { name: "Delete Eastvale Bakery?" })).toBeVisible(); await page.evaluate(() => { @@ -2136,11 +2136,11 @@ test("admin cleared map area labels keep linked zone action names", async ({ pag await page.getByRole("button", { name: "Map area Bakery", exact: true }).click(); await expect(page.getByRole("textbox", { name: "Label" })).toHaveValue(""); - await page.getByRole("button", { name: "Delete" }).click(); + await page.getByRole("button", { name: "Delete area Bakery" }).click(); await expect(page.getByRole("heading", { name: "Delete Bakery?" })).toBeVisible(); await page.getByRole("button", { name: "Cancel" }).click(); - await page.getByRole("button", { name: "Duplicate" }).click(); + await page.getByRole("button", { name: "Duplicate area Bakery" }).click(); await expect(page.getByRole("textbox", { name: "Label" })).toHaveValue("Bakery Copy"); await expect(page.getByRole("button", { name: "Map area Bakery Copy" })).toBeVisible(); await expect(page.getByRole("button", { name: "Map area Area Copy" })).toHaveCount(0); @@ -2182,7 +2182,7 @@ test("admin restores selected map area through duplicate undo and redo", async ( await page.getByRole("button", { name: "Map area Bakery" }).click(); await expect(page.locator(".location-map-object.is-selected")).toHaveAttribute("data-object-key", "1355"); - await page.getByRole("button", { name: "Duplicate" }).click(); + await page.getByRole("button", { name: "Duplicate area Bakery" }).click(); await expect(page.getByRole("textbox", { name: "Label" })).toHaveValue("Bakery Copy"); await expect(page.locator(".location-map-object.is-selected")).toContainText("Bakery Copy"); @@ -2471,8 +2471,8 @@ test("admin save progress locks draft controls", async ({ page }) => { await expect(page.getByRole("button", { name: "Add Area" })).toBeDisabled(); await expect(page.getByRole("button", { name: "View Draft" })).toHaveCount(0); await expect(page.getByRole("button", { name: "Undo" })).toBeDisabled(); - await expect(page.getByRole("button", { name: "Duplicate" })).toBeDisabled(); - await expect(page.getByRole("button", { name: "Delete" })).toBeDisabled(); + await expect(page.getByRole("button", { name: "Duplicate area Saving Bakery" })).toBeDisabled(); + await expect(page.getByRole("button", { name: "Delete area Saving Bakery" })).toBeDisabled(); await expect(page.getByRole("textbox", { name: "Label" })).toBeDisabled(); releaseSave();