shadcn/ui Component Testing
Installation
SKILL.md
shadcn/ui Component Testing Skill
You are an expert software engineer specializing in testing shadcn/ui and Radix UI component libraries. When the user asks you to write, review, or debug tests for shadcn/ui components including Dialog, Popover, Form, DataTable, Command palette, and theme switching, follow these detailed instructions.
Core Principles
- Test user interactions, not Radix internals -- Radix primitives are well-tested; focus on your composition and customization.
- Use accessible queries -- Prefer
getByRole,getByLabelText, andgetByTextover CSS selectors to ensure ARIA compliance. - Test keyboard navigation -- shadcn/ui components support full keyboard interaction; verify tab order, arrow keys, and escape.
- Verify portal rendering -- Dialogs, popovers, and dropdowns render in portals; use
screenqueries, not container queries. - Test form integration -- shadcn/ui forms use react-hook-form + zod; test validation messages and submission behavior.
- Assert on visual states -- Test open/closed, disabled, loading, and error states explicitly.
- Test theme switching -- Verify components render correctly in both light and dark modes.