fix: prioritize blank map setup
This commit is contained in:
parent
a8f747984d
commit
3ac80c9a5b
@ -44,12 +44,25 @@ export default function LocationMapSetupPanel({
|
|||||||
No zones are available yet. Create a blank map now, or add zones first for an automatic starter layout.
|
No zones are available yet. Create a blank map now, or add zones first for an automatic starter layout.
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
<button type="button" className="btn-primary" onClick={onCreateFromZones} disabled={saving || !hasZones}>
|
{!hasZones ? (
|
||||||
{createFromZonesLabel}
|
<>
|
||||||
</button>
|
<button type="button" className="btn-primary" onClick={onCreateBlank} disabled={saving}>
|
||||||
<button type="button" className="btn-secondary" onClick={onCreateBlank} disabled={saving}>
|
Create Blank Map
|
||||||
Create Blank Map
|
</button>
|
||||||
</button>
|
<button type="button" className="btn-secondary" onClick={onCreateFromZones} disabled>
|
||||||
|
{createFromZonesLabel}
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<button type="button" className="btn-primary" onClick={onCreateFromZones} disabled={saving}>
|
||||||
|
{createFromZonesLabel}
|
||||||
|
</button>
|
||||||
|
<button type="button" className="btn-secondary" onClick={onCreateBlank} disabled={saving}>
|
||||||
|
Create Blank Map
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -396,6 +396,12 @@ test("admin setup explains when no zones exist yet", async ({ page }) => {
|
|||||||
await expect(page.getByText("No zones are available yet.")).toBeVisible();
|
await expect(page.getByText("No zones are available yet.")).toBeVisible();
|
||||||
await expect(page.getByRole("button", { name: "Create From Zones" })).toBeDisabled();
|
await expect(page.getByRole("button", { name: "Create From Zones" })).toBeDisabled();
|
||||||
await expect(page.getByRole("button", { name: "Create Blank Map" })).toBeEnabled();
|
await expect(page.getByRole("button", { name: "Create Blank Map" })).toBeEnabled();
|
||||||
|
const blankButtonBox = await page.getByRole("button", { name: "Create Blank Map" }).boundingBox();
|
||||||
|
const fromZonesButtonBox = await page.getByRole("button", { name: "Create From Zones" }).boundingBox();
|
||||||
|
expect(blankButtonBox).not.toBeNull();
|
||||||
|
expect(fromZonesButtonBox).not.toBeNull();
|
||||||
|
if (!blankButtonBox || !fromZonesButtonBox) throw new Error("No-zone setup actions were not measurable");
|
||||||
|
expect(blankButtonBox.y).toBeLessThan(fromZonesButtonBox.y);
|
||||||
await expect(page.getByLabel("Map controls")).toHaveCount(0);
|
await expect(page.getByLabel("Map controls")).toHaveCount(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user