Add store location map manager #20
@ -19,6 +19,14 @@ const DISPLAY_CONTROLS = [
|
|||||||
["showUnmapped", "Unmapped"],
|
["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({
|
export default function LocationMapBottomSheet({
|
||||||
mode,
|
mode,
|
||||||
editorTool,
|
editorTool,
|
||||||
@ -261,7 +269,7 @@ export default function LocationMapBottomSheet({
|
|||||||
onChange={(event) => onObjectField("type", event.target.value)}
|
onChange={(event) => onObjectField("type", event.target.value)}
|
||||||
>
|
>
|
||||||
{MAP_OBJECT_TYPES.map((type) => (
|
{MAP_OBJECT_TYPES.map((type) => (
|
||||||
<option key={type} value={type}>{type}</option>
|
<option key={type} value={type}>{formatObjectTypeLabel(type)}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@ -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();
|
const bakeryObject = page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first();
|
||||||
await bakeryObject.click();
|
await bakeryObject.click();
|
||||||
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bakery");
|
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();
|
const moveBox = await bakeryObject.boundingBox();
|
||||||
expect(moveBox).not.toBeNull();
|
expect(moveBox).not.toBeNull();
|
||||||
if (!moveBox) throw new Error("Bakery map object could not be moved");
|
if (!moveBox) throw new Error("Bakery map object could not be moved");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user