Skip to content

Commit 3da5347

Browse files
authored
test(ui): improve ThemeQuickPresets responsive rendering coverage (JhaSourav07#2025)
## Description Fixes JhaSourav07#1543 ## Changes Made - Added rerender coverage for `ThemeQuickPresets` - Verified accessible theme controls remain visible after rerender - Added accessibility assertions for rendered theme buttons - Improved responsive rendering test coverage for theme preset controls ## Testing - Ran targeted Vitest suite: - `npx vitest components/dashboard/ThemeSelector.test.tsx` All tests passed successfully. ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). - [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). - [] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have started the repo. - [x] I have made sure that i have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts). - [x] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents bba7a1f + 3442862 commit 3da5347

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

components/dashboard/ThemeSelector.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,22 @@ describe('ThemeSelector (ThemeQuickPresets)', () => {
6666
expect(screen.getByLabelText(/apply dracula theme/i)).toBeInTheDocument();
6767
expect(screen.getByLabelText(/apply neon theme/i)).toBeInTheDocument();
6868
});
69+
it('renders accessible theme controls consistently after rerender', () => {
70+
const { rerender } = render(
71+
<ThemeQuickPresets theme="dracula" onThemeChange={mockOnThemeChange} />
72+
);
73+
74+
rerender(<ThemeQuickPresets theme="neon" onThemeChange={mockOnThemeChange} />);
75+
76+
const buttons = screen.getAllByRole('button');
77+
78+
expect(buttons.length).toBeGreaterThanOrEqual(2);
79+
80+
buttons.forEach((button) => {
81+
expect(button).toBeVisible();
82+
expect(button).toHaveAccessibleName();
83+
});
84+
85+
expect(screen.getByLabelText(/apply neon theme/i)).toBeInTheDocument();
86+
});
6987
});

0 commit comments

Comments
 (0)