Skip to content

Commit 4d3a180

Browse files
committed
test(dashboard): verified that compare modal input can be cleared
1 parent 99c77fd commit 4d3a180

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

components/dashboard/DashboardClient.test.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,29 @@ describe('DashboardClient', () => {
311311
expect(screen.getByText(/Cannot compare a profile with itself/i)).toBeDefined();
312312
});
313313
});
314+
315+
// =========================================================================
316+
// ISSUE OBJECTIVE #1063: Verify compare modal input can be cleared
317+
// =========================================================================
318+
it('verify compare modal input can be cleared', async () => {
319+
render(<DashboardClient initialData={mockInitialData} username="Shivangi1515" />);
320+
321+
// 1. Open modal
322+
const compareBtn = screen.getByText('Compare Profile');
323+
fireEvent.click(compareBtn);
324+
325+
// 2. Type a username into the input
326+
const input = screen.getByPlaceholderText('Enter GitHub Username');
327+
fireEvent.change(input, { target: { value: 'testuser' } });
328+
329+
// 3. Assert 'Clear input' (aria-label) button appears
330+
const clearButton = screen.getByRole('button', { name: 'Clear input' });
331+
expect(clearButton).toBeDefined();
332+
333+
// 4. Click clear button
334+
fireEvent.click(clearButton);
335+
336+
// 5. Assert input value is empty
337+
expect((input as HTMLInputElement).value).toBe('');
338+
});
314339
});

0 commit comments

Comments
 (0)