feat: focus home on top spot results
This commit is contained in:
@@ -14,7 +14,7 @@ const hours = params.get("hours") ?? "24";
|
||||
const waterbody = params.get("waterbody") ?? "";
|
||||
const fish = params.get("fish") ?? "";
|
||||
const sort = params.get("sort") ?? "activity";
|
||||
const activityLimit = 20;
|
||||
const activityLimit = 5;
|
||||
const requestedOffset = Number(params.get("offset") ?? 0);
|
||||
let offset = Number.isInteger(requestedOffset) && requestedOffset >= 0 ? requestedOffset : 0;
|
||||
const requestedSignalLimit = Number(params.get("signals") ?? 12);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("home focuses the first screen on five results and keeps pagination", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto("/");
|
||||
|
||||
await expect(page.locator(".spot-card")).toHaveCount(5);
|
||||
await expect(page.getByRole("navigation", { name: "Пагинация" })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: "Следующая →" })).toHaveAttribute("href", /offset=5/);
|
||||
|
||||
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
|
||||
expect(overflow).toBeLessThanOrEqual(0);
|
||||
});
|
||||
Reference in New Issue
Block a user