From 853afdf80eb044df2db43e5db8e37ea2d5226963 Mon Sep 17 00:00:00 2001 From: Isaque Coelho Date: Sun, 23 Aug 2026 16:21:15 -0300 Subject: [PATCH] fix(status-bar): remove pet menu reserved space (#13067) * fix(status-bar): remove pet menu reserved space * test(status-bar): add pet segment layout validation tests - Unit test guards against pr-[6.5rem] padding reintroduction - E2E test measures trailing overhang instead of total width delta for more accurate layout validation - Extract enableExperimentalPet helper for test clarity --------- Co-authored-by: m4air --- .../PetStatusSegment.layout.test.ts | 15 ++++ .../status-bar/PetStatusSegment.tsx | 2 +- tests/e2e/pet-status-segment-layout.spec.ts | 83 +++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/renderer/src/components/status-bar/PetStatusSegment.layout.test.ts create mode 100644 tests/e2e/pet-status-segment-layout.spec.ts diff --git a/src/renderer/src/components/status-bar/PetStatusSegment.layout.test.ts b/src/renderer/src/components/status-bar/PetStatusSegment.layout.test.ts new file mode 100644 index 00000000000..e213100816e --- /dev/null +++ b/src/renderer/src/components/status-bar/PetStatusSegment.layout.test.ts @@ -0,0 +1,15 @@ +import { readFileSync } from 'node:fs' +import { join } from 'node:path' +import { describe, expect, it } from 'vitest' + +describe('PetStatusSegment layout', () => { + it('does not reserve fixed right padding on the pet menu trigger', () => { + const source = readFileSync(join(__dirname, 'PetStatusSegment.tsx'), 'utf8') + + // Why: the old pr-[6.5rem] reserved ~104px of empty space after the label and + // shoved neighboring status-bar segments left; unit-guard so CI catches a + // reintroduction without needing Electron Playwright. + expect(source).not.toMatch(/pr-\[\d+(?:\.\d+)?rem\]/) + expect(source).toMatch(/className="group inline-flex items-center cursor-pointer pl-1 py-0\.5"/) + }) +}) diff --git a/src/renderer/src/components/status-bar/PetStatusSegment.tsx b/src/renderer/src/components/status-bar/PetStatusSegment.tsx index 48cd2f0292b..8cf2b1b5dcf 100644 --- a/src/renderer/src/components/status-bar/PetStatusSegment.tsx +++ b/src/renderer/src/components/status-bar/PetStatusSegment.tsx @@ -116,7 +116,7 @@ function PetStatusSegmentInner(): React.JSX.Element {