fix: 统一双端按钮基础样式
This commit is contained in:
1 parent
fce7ad0c57
commit
32e2112caf
2 files changed
+20
No files matched your search
@@ -12,6 +12,16 @@ textarea,
|
||||
button {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
button {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
line-height: 1.5;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
}
|
||||
button::after {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,21 @@ test("真实 API 驱动首页、出摊和主理人视觉槽位", async ({ page }
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await page.goto("/");
|
||||
await expect(page.locator(".food-home .name")).toContainText("阿成");
|
||||
await expect(page.locator(".food-home .actions button")).toHaveCount(2);
|
||||
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 actionStyles = await page
|
||||
.locator(".food-home .actions button")
|
||||
.first()
|
||||
.evaluate((button) => {
|
||||
const style = getComputedStyle(button);
|
||||
return { margin: style.margin, borderWidth: style.borderWidth, padding: style.padding };
|
||||
});
|
||||
expect(actionStyles.margin).toBe("0px");
|
||||
expect(actionStyles.borderWidth).toBe("0px");
|
||||
const widths = await page.locator(".scene").evaluate((element) => ({
|
||||
image: element.getBoundingClientRect().width,
|
||||
parent: element.parentElement!.getBoundingClientRect().width,
|
||||
|
||||
Reference in new issue
Block a user