fix: 修复首页咨询按钮宽度溢出

This commit is contained in:
que01 committed 2026-10-08 16:02:50 +08:00
1 parent f324b663a6
commit fce7ad0c57
2 files changed
+12 -1

No files matched your search

+5
View File
@@ -4,6 +4,11 @@ test("真实 API 驱动首页、出摊和主理人视觉槽位", async ({ page }
page.on("pageerror", (error) => errors.push(error.message));
await page.goto("/");
await expect(page.locator(".food-home .name")).toContainText("阿成");
const actionBounds = await page.locator(".food-home .actions button").evaluateAll((buttons) => {
const parent = buttons[0].parentElement!.getBoundingClientRect();
return buttons.map((button) => button.getBoundingClientRect().right - parent.right);
});
expect(Math.max(...actionBounds)).toBeLessThanOrEqual(1);
const widths = await page.locator(".scene").evaluate((element) => ({
image: element.getBoundingClientRect().width,
parent: element.parentElement!.getBoundingClientRect().width,