From fed8b1ec69cfd15e07ab69093fd90c29ca1897bf Mon Sep 17 00:00:00 2001 From: Emre Caglar <63402376+emrecaglarid@users.noreply.github.com> Date: Fri, 16 Oct 2026 10:09:00 +0000 Subject: [PATCH] feat(editor): Use a segment control for the agent checks status filter (no-changelog) (#41169) Co-authored-by: Claude Opus 5.5 (1M context) --- .../__tests__/AgentEvalChecksPanel.test.ts | 56 ++++++++------ .../components/AgentEvalChecksPanel.vue | 76 +++++++++++-------- 2 files changed, 78 insertions(+), 54 deletions(-) diff --git a/packages/frontend/editor-ui/src/features/agents/__tests__/AgentEvalChecksPanel.test.ts b/packages/frontend/editor-ui/src/features/agents/__tests__/AgentEvalChecksPanel.test.ts index 57bfec54d5a..0d267c1b87c 100644 --- a/packages/frontend/editor-ui/src/features/agents/__tests__/AgentEvalChecksPanel.test.ts +++ b/packages/frontend/editor-ui/src/features/agents/__tests__/AgentEvalChecksPanel.test.ts @@ -443,28 +443,6 @@ describe('AgentEvalChecksPanel', () => { expect(getAllByTestId(/agent-eval-check-/)).toHaveLength(4); }); - it('marks the selected status filter', async () => { - const user = userEvent.setup(); - const { getByTestId } = renderFour(); - - const all = getByTestId('agent-eval-checks-filter-all'); - const pass = getByTestId('agent-eval-checks-filter-pass'); - - expect(all).toHaveAttribute('aria-pressed', 'true'); - expect(all.className).toContain('brand'); - expect(pass).toHaveAttribute('aria-pressed', 'false'); - expect(pass.className).toContain('outline'); - expect(pass.className).not.toContain('brand'); - - await user.click(pass); - - expect(pass).toHaveAttribute('aria-pressed', 'true'); - expect(pass.className).toContain('brand'); - expect(all).toHaveAttribute('aria-pressed', 'false'); - expect(all.className).toContain('outline'); - expect(all.className).not.toContain('brand'); - }); - it('filters down to only passing rows', async () => { const user = userEvent.setup(); const { getAllByTestId, getByTestId } = renderFour(); @@ -482,6 +460,35 @@ describe('AgentEvalChecksPanel', () => { expect(getAllByTestId(/agent-eval-check-/)).toHaveLength(2); }); + + it('shows the filter as one segment control, with the chosen option checked', async () => { + const user = userEvent.setup(); + const { getAllByRole, getByTestId } = renderFour(); + const segment = (key: string) => + getByTestId(`agent-eval-checks-filter-${key}`).closest('[role="radio"]'); + + expect(getAllByRole('radio')).toHaveLength(3); + expect(segment('all')).toHaveAttribute('aria-checked', 'true'); + + await user.click(getByTestId('agent-eval-checks-filter-pass')); + + expect(segment('pass')).toHaveAttribute('aria-checked', 'true'); + expect(segment('all')).toHaveAttribute('aria-checked', 'false'); + }); + + it('shows a status avatar on each status option, and none on "All"', () => { + const { getByTestId } = renderFour(); + + expect( + within(getByTestId('agent-eval-checks-filter-needs-work')).getByRole('img'), + ).toBeInTheDocument(); + expect( + within(getByTestId('agent-eval-checks-filter-pass')).getByRole('img'), + ).toBeInTheDocument(); + expect( + within(getByTestId('agent-eval-checks-filter-all')).queryByRole('img'), + ).not.toBeInTheDocument(); + }); }); it('emits rerun when "Run all checks" is clicked', async () => { @@ -1469,7 +1476,10 @@ describe('AgentEvalChecksPanel', () => { await vi.waitFor(() => expect(queryByTestId('agent-eval-checks-filter-needs-work')).not.toBeInTheDocument(), ); - expect(getByTestId('agent-eval-checks-filter-all')).toHaveAttribute('aria-pressed', 'true'); + expect(getByTestId('agent-eval-checks-filter-all').closest('[role="radio"]')).toHaveAttribute( + 'aria-checked', + 'true', + ); expect(getAllByTestId(/agent-eval-check-/)).toHaveLength(2); }); }); diff --git a/packages/frontend/editor-ui/src/features/agents/components/AgentEvalChecksPanel.vue b/packages/frontend/editor-ui/src/features/agents/components/AgentEvalChecksPanel.vue index 9f8146b4f5b..4943cae487c 100644 --- a/packages/frontend/editor-ui/src/features/agents/components/AgentEvalChecksPanel.vue +++ b/packages/frontend/editor-ui/src/features/agents/components/AgentEvalChecksPanel.vue @@ -1,7 +1,7 @@