The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): guard status spacing across stack positions
brooklyn!1f37f5cdd9a3
diff --git a/apps/desktop/src/components/chat/status-stack.test.tsx b/apps/desktop/src/components/chat/status-stack.test.tsxnew file mode 100644index 00000000000..d867f885a70--- /dev/null+++ b/apps/desktop/src/components/chat/status-stack.test.tsx@@ -0,0 +1,75 @@+import { cleanup, render } from '@testing-library/react'+import { afterEach, expect, it } from 'vitest'++import { StatusRow } from './status-row'+import { StatusSection } from './status-section'+import statusStyles from './status-stack.css?inline'++afterEach(cleanup)++it('keeps row padding unchanged when it becomes the first section', () => {+ const group = (+ <StatusSection accessory={<button type="button">Manage</button>} label="Background tasks">+ <StatusRow>Task</StatusRow>+ </StatusSection>+ )++ const samples = [+ <StatusRow key="row">Task</StatusRow>,+ <div className="status-artifacts" key="artifacts">+ <StatusRow>index.html</StatusRow>+ </div>,+ group,+ <div key="wrapped">{group}</div>+ ]++ for (const sample of samples) {+ const fixture = (first: boolean) => (+ <>+ <style>{statusStyles}</style>+ <div data-slot="composer-status-stack">+ {!first && <div data-slot="status-stack-section">Earlier section</div>}+ <div data-slot="status-stack-section" data-testid="section">+ {sample}+ </div>+ </div>+ </>+ )++ const view = render(fixture(false))++ const padding = () =>+ [...view.getByTestId('section').querySelectorAll('.status-row, .status-section-header > *')].map(element => {+ const style = getComputedStyle(element)++ return { align: style.alignSelf, bottom: style.paddingBottom, top: style.paddingTop }+ })++ const later = padding()++ expect(later.length).toBeGreaterThan(0)+ view.rerender(fixture(true))+ expect(padding()).toEqual(later)+ view.unmount()+ }+})++it('balances vertical padding when an artifact is the only status row', () => {+ const { container } = render(+ <>+ <style>{statusStyles}</style>+ <div data-slot="composer-status-stack">+ <div data-slot="status-stack-section">+ <div className="status-artifacts">+ <StatusRow>index.html</StatusRow>+ </div>+ </div>+ </div>+ </>+ )++ const style = getComputedStyle(container.querySelector('[data-slot="status-row"]')!)++ expect(parseFloat(style.paddingTop)).toBeGreaterThan(0)+ expect(style.paddingTop).toBe(style.paddingBottom)+})diff --git a/apps/desktop/vitest.config.ts b/apps/desktop/vitest.config.tsindex b76230ff0b9..4542e0b07f8 100644--- a/apps/desktop/vitest.config.ts+++ b/apps/desktop/vitest.config.ts@@ -6,6 +6,8 @@ const reactUi: TestProjectConfiguration = {test: {name: 'ui',environment: 'jsdom',+ // Keep padding regressions observable instead of mocking the stylesheet away.+ css: { include: [/status-stack\.css$/] },setupFiles: ['./vitest.setup.ts'],include: ['src/**/*.test.{ts,tsx}'],globals: true,