diff --git a/apps/taro/src/app.css b/apps/taro/src/app.css index fb6d891..3691b37 100644 --- a/apps/taro/src/app.css +++ b/apps/taro/src/app.css @@ -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; } diff --git a/apps/taro/test/browser/preview.spec.ts b/apps/taro/test/browser/preview.spec.ts index 3044a88..0ab41f1 100644 --- a/apps/taro/test/browser/preview.spec.ts +++ b/apps/taro/test/browser/preview.spec.ts @@ -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,