fix: compact map counts without labels
This commit is contained in:
parent
5b964eef1f
commit
80f09f324d
@ -176,7 +176,7 @@ export default function LocationMapCanvas({
|
|||||||
const count = zoneItems.length;
|
const count = zoneItems.length;
|
||||||
const countLabel = `${count} item${count === 1 ? "" : "s"}`;
|
const countLabel = `${count} item${count === 1 ? "" : "s"}`;
|
||||||
const labelLines = fittedLabelLines(object, "Area");
|
const labelLines = fittedLabelLines(object, "Area");
|
||||||
const countY = labelLines.length > 1 ? object.y + 76 : object.y + 52;
|
const countY = filters.showLabels && labelLines.length > 1 ? object.y + 76 : object.y + 52;
|
||||||
const pinDots = filters.showPins
|
const pinDots = filters.showPins
|
||||||
? zoneItems.slice(0, 12).map((item, itemIndex) => {
|
? zoneItems.slice(0, 12).map((item, itemIndex) => {
|
||||||
const column = itemIndex % 4;
|
const column = itemIndex % 4;
|
||||||
|
|||||||
@ -460,7 +460,14 @@ test("viewer wraps long zone labels and keeps item counts visible", async ({ pag
|
|||||||
await expect(produceArea.locator(".location-map-label tspan").nth(0)).toHaveText("Produce & Fresh");
|
await expect(produceArea.locator(".location-map-label tspan").nth(0)).toHaveText("Produce & Fresh");
|
||||||
await expect(produceArea.locator(".location-map-label tspan").nth(1)).toHaveText("Vegetables");
|
await expect(produceArea.locator(".location-map-label tspan").nth(1)).toHaveText("Vegetables");
|
||||||
await expect(produceArea.locator(".location-map-count")).toHaveText("2 items");
|
await expect(produceArea.locator(".location-map-count")).toHaveText("2 items");
|
||||||
|
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "116");
|
||||||
await expect(page.locator(".location-map-pin")).toHaveCount(0);
|
await expect(page.locator(".location-map-pin")).toHaveCount(0);
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: "Layers" }).click();
|
||||||
|
await page.getByLabel("Labels").uncheck();
|
||||||
|
await expect(produceArea.locator(".location-map-label")).toHaveCount(0);
|
||||||
|
await expect(produceArea.locator(".location-map-count")).toHaveText("2 items");
|
||||||
|
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "92");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("members can view a published map but cannot edit it", async ({ page }) => {
|
test("members can view a published map but cannot edit it", async ({ page }) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user