fix: focus selected map area editor
This commit is contained in:
parent
5ba538065f
commit
c9fbbafe58
@ -309,16 +309,6 @@ export default function LocationMapBottomSheet({
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{showSelectedObjectForm && secondaryDraftActions ? (
|
|
||||||
<div
|
|
||||||
className="location-map-editor-action-stack location-map-selected-secondary-actions"
|
|
||||||
role="group"
|
|
||||||
aria-label="More map draft actions"
|
|
||||||
>
|
|
||||||
{secondaryDraftActions}
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{showUnmappedPanel ? (
|
{showUnmappedPanel ? (
|
||||||
<UnmappedItemsPanel
|
<UnmappedItemsPanel
|
||||||
visibleUnmappedItems={visibleUnmappedItems}
|
visibleUnmappedItems={visibleUnmappedItems}
|
||||||
|
|||||||
@ -5003,27 +5003,22 @@ test("mobile editor uses bottom sheet controls instead of desktop object toolbar
|
|||||||
await expect(lockedFlag).toHaveAttribute("aria-pressed", "false");
|
await expect(lockedFlag).toHaveAttribute("aria-pressed", "false");
|
||||||
await expect(lockedFlag.locator(".location-map-object-flag-state.is-on")).toHaveCount(0);
|
await expect(lockedFlag.locator(".location-map-object-flag-state.is-on")).toHaveCount(0);
|
||||||
const selectedPrimaryActions = page.locator(".location-map-selected-primary-actions");
|
const selectedPrimaryActions = page.locator(".location-map-selected-primary-actions");
|
||||||
const selectedSecondaryActions = page.locator(".location-map-selected-secondary-actions");
|
|
||||||
await expect(selectedPrimaryActions.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
|
await expect(selectedPrimaryActions.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
|
||||||
await expect(selectedPrimaryActions.getByRole("button", { name: "Publish" })).toBeVisible();
|
await expect(selectedPrimaryActions.getByRole("button", { name: "Publish" })).toBeVisible();
|
||||||
await expect(selectedSecondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible();
|
await expect(page.locator(".location-map-selected-secondary-actions")).toHaveCount(0);
|
||||||
await expect(selectedSecondaryActions.getByRole("button", { name: "View Draft" })).toHaveCount(0);
|
|
||||||
await expect(page.getByRole("button", { name: "Bought" })).toHaveCount(0);
|
await expect(page.getByRole("button", { name: "Bought" })).toHaveCount(0);
|
||||||
const selectedPrimaryBox = await selectedPrimaryActions.boundingBox();
|
const selectedPrimaryBox = await selectedPrimaryActions.boundingBox();
|
||||||
const selectedSecondaryButtonBox = await selectedSecondaryActions.getByRole("button", { name: "Add Area" }).boundingBox();
|
|
||||||
const labelBox = await labelInput.boundingBox();
|
const labelBox = await labelInput.boundingBox();
|
||||||
const firstFieldRowBox = await fieldRows.first().boundingBox();
|
const firstFieldRowBox = await fieldRows.first().boundingBox();
|
||||||
const firstFlagButtonBox = await objectFlagButtons.first().boundingBox();
|
const firstFlagButtonBox = await objectFlagButtons.first().boundingBox();
|
||||||
expect(selectedPrimaryBox).not.toBeNull();
|
expect(selectedPrimaryBox).not.toBeNull();
|
||||||
expect(selectedSecondaryButtonBox).not.toBeNull();
|
|
||||||
expect(labelBox).not.toBeNull();
|
expect(labelBox).not.toBeNull();
|
||||||
expect(firstFieldRowBox).not.toBeNull();
|
expect(firstFieldRowBox).not.toBeNull();
|
||||||
expect(firstFlagButtonBox).not.toBeNull();
|
expect(firstFlagButtonBox).not.toBeNull();
|
||||||
if (!selectedPrimaryBox || !selectedSecondaryButtonBox || !labelBox || !firstFieldRowBox || !firstFlagButtonBox) {
|
if (!selectedPrimaryBox || !labelBox || !firstFieldRowBox || !firstFlagButtonBox) {
|
||||||
throw new Error("Selected object draft actions were not measurable");
|
throw new Error("Selected object draft actions were not measurable");
|
||||||
}
|
}
|
||||||
expect(selectedPrimaryBox.y).toBeLessThan(labelBox.y);
|
expect(selectedPrimaryBox.y).toBeLessThan(labelBox.y);
|
||||||
expect(selectedSecondaryButtonBox.height).toBeGreaterThanOrEqual(40);
|
|
||||||
expect(firstFieldRowBox.height).toBeLessThanOrEqual(54);
|
expect(firstFieldRowBox.height).toBeLessThanOrEqual(54);
|
||||||
expect(firstFlagButtonBox.height).toBeGreaterThanOrEqual(40);
|
expect(firstFlagButtonBox.height).toBeGreaterThanOrEqual(40);
|
||||||
const closeSelectedButton = page.getByRole("button", { name: "Close selected map area" });
|
const closeSelectedButton = page.getByRole("button", { name: "Close selected map area" });
|
||||||
@ -5037,6 +5032,7 @@ test("mobile editor uses bottom sheet controls instead of desktop object toolbar
|
|||||||
await expect(page.getByRole("textbox", { name: "Label" })).toHaveCount(0);
|
await expect(page.getByRole("textbox", { name: "Label" })).toHaveCount(0);
|
||||||
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Edit Areas");
|
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Edit Areas");
|
||||||
await expect(page.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
|
await expect(page.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
|
||||||
|
await expect(page.locator(".location-map-secondary-actions").getByRole("button", { name: "Add Area" })).toBeVisible();
|
||||||
await page.getByRole("button", { name: "View", exact: true }).click();
|
await page.getByRole("button", { name: "View", exact: true }).click();
|
||||||
await expect(page.getByRole("textbox", { name: "Label" })).toHaveCount(0);
|
await expect(page.getByRole("textbox", { name: "Label" })).toHaveCount(0);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user