Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(feedback): add test for FeedbackFilterSelect component

Steven Enamakel8ab5731eee5c
diff --git a/app/src/components/feedback/FeedbackFilterSelect.test.tsx b/app/src/components/feedback/FeedbackFilterSelect.test.tsx
index b3062a7d26..f0afc47996 100644
--- a/app/src/components/feedback/FeedbackFilterSelect.test.tsx
+++ b/app/src/components/feedback/FeedbackFilterSelect.test.tsx
@@ -104,7 +104,7 @@ describe('<FeedbackFilterSelect />', () => {
expect(onChange).toHaveBeenCalledWith('feature');
});
- it('jumps to the last option with End and to the first with Home', async () => {
+ it('jumps to the last option with End', async () => {
const user = userEvent.setup();
const onChange = vi.fn();
render(
@@ -116,8 +116,18 @@ describe('<FeedbackFilterSelect />', () => {
await user.keyboard('{Enter}');
expect(onChange).toHaveBeenCalledWith('bug');
+ });
+
+ // Starts at the LAST option deliberately. Radix treats re-selecting the
+ // current value as a no-op and fires no `onValueChange`, so a Home test that
+ // started at `all` would assert nothing while appearing to pass.
+ it('jumps to the first option with Home', async () => {
+ const user = userEvent.setup();
+ const onChange = vi.fn();
+ render(
+ <FeedbackFilterSelect value="bug" options={OPTIONS} onChange={onChange} ariaLabel="Type" />
+ );
- onChange.mockClear();
await user.click(screen.getByRole('combobox', { name: 'Type' }));
await user.keyboard('{Home}');
await user.keyboard('{Enter}');