mirror of
https://github.com/block/buzz.git
synced 2026-12-01 13:42:45 +00:00
Tighten history button spacing
Co-authored-by: Thomas Petersen <thomasp@squareup.com> Signed-off-by: Thomas Petersen <thomasp@squareup.com>
This commit is contained in:
@@ -45,6 +45,7 @@ export default defineConfig({
|
||||
"**/identity-archive.spec.ts",
|
||||
"**/identity-archive-hide.spec.ts",
|
||||
"**/relay-connectivity-screenshots.spec.ts",
|
||||
"**/history-icons-screenshots.spec.ts",
|
||||
"**/unread-pill-screenshots.spec.ts",
|
||||
"**/sidebar-more-unread-overlap.spec.ts",
|
||||
"**/thread-unread-screenshots.spec.ts",
|
||||
|
||||
@@ -21,6 +21,8 @@ type AppTopChromeProps = {
|
||||
|
||||
const TOP_CHROME_ICON_BUTTON_CLASS =
|
||||
"h-7 w-7 rounded-[4px] text-muted-foreground/70 hover:bg-border/45 hover:text-foreground [&_svg]:size-4";
|
||||
const HISTORY_ICON_BUTTON_CLASS =
|
||||
"h-7 w-6 rounded-[4px] text-muted-foreground/70 hover:bg-border/45 hover:text-foreground [&_svg]:size-4";
|
||||
const TOP_CHROME_WHEEL_GUARD_HEIGHT = 40;
|
||||
|
||||
function TopChromeSidebarTrigger() {
|
||||
@@ -91,7 +93,7 @@ export function AppTopChrome({
|
||||
<TopChromeSidebarTrigger />
|
||||
<Button
|
||||
aria-label="Go back"
|
||||
className={TOP_CHROME_ICON_BUTTON_CLASS}
|
||||
className={HISTORY_ICON_BUTTON_CLASS}
|
||||
data-testid="global-back"
|
||||
disabled={!canGoBack}
|
||||
onClick={onGoBack}
|
||||
@@ -102,7 +104,7 @@ export function AppTopChrome({
|
||||
</Button>
|
||||
<Button
|
||||
aria-label="Go forward"
|
||||
className={TOP_CHROME_ICON_BUTTON_CLASS}
|
||||
className={HISTORY_ICON_BUTTON_CLASS}
|
||||
data-testid="global-forward"
|
||||
disabled={!canGoForward}
|
||||
onClick={onGoForward}
|
||||
|
||||
45
desktop/tests/e2e/history-icons-screenshots.spec.ts
Normal file
45
desktop/tests/e2e/history-icons-screenshots.spec.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { waitForAnimations } from "../helpers/animations";
|
||||
import { installMockBridge } from "../helpers/bridge";
|
||||
|
||||
const SHOTS = "test-results/history-icons";
|
||||
|
||||
test.describe("top chrome history controls", () => {
|
||||
test.use({ viewport: { width: 1280, height: 720 } });
|
||||
|
||||
test("back and forward buttons read as a compact pair", async ({ page }) => {
|
||||
await installMockBridge(page);
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("home-inbox-list")).toBeVisible();
|
||||
|
||||
const back = page.getByTestId("global-back");
|
||||
const forward = page.getByTestId("global-forward");
|
||||
await expect(back).toBeVisible();
|
||||
await expect(forward).toBeVisible();
|
||||
|
||||
await expect
|
||||
.poll(async () =>
|
||||
page.evaluate(() => {
|
||||
const backRect = document
|
||||
.querySelector('[data-testid="global-back"]')
|
||||
?.getBoundingClientRect();
|
||||
const forwardRect = document
|
||||
.querySelector('[data-testid="global-forward"]')
|
||||
?.getBoundingClientRect();
|
||||
if (!backRect || !forwardRect) return null;
|
||||
|
||||
const backCenter = backRect.left + backRect.width / 2;
|
||||
const forwardCenter = forwardRect.left + forwardRect.width / 2;
|
||||
return Math.round(forwardCenter - backCenter);
|
||||
}),
|
||||
)
|
||||
.toBeLessThanOrEqual(28);
|
||||
|
||||
await waitForAnimations(page);
|
||||
await page.screenshot({
|
||||
path: `${SHOTS}/01-history-icons-compact-unit.png`,
|
||||
clip: { x: 64, y: 0, width: 130, height: 48 },
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user