[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D9MJFP71NHADCS8WRBS6AE":3,"skill-same:01M7D9MJFP71NHADCS8WRBS6AE":83},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":14,"repositoryHtmlUrl":64,"repositoryHomepageUrl":6,"ownerHtmlUrl":65,"ownerBlogUrl":66,"ownerDescription":67,"updatedAt":68,"install":69,"resources":82},"01M7D9MJFP71NHADCS8WRBS6AE","shadcn\u002Fui Component Testing",null,"Testing skill for shadcn\u002Fui and Radix UI component libraries covering accessible component testing, dialog and popover testing, form validation testing, data table testing, command palette testing, and theme switching verification.","GrupoANDevelopment-m\u002Falberto-ai","GrupoANDevelopment-m","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257455179?v=4","01M7D69X2N2KEVN0SJF6WGM6SH","Antônio  Ndombe","01M7D69X3P5JTT8H8S904N3888",0,"MIT","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fshadcn-component-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: shadcn\u002Fui Component Testing\ndescription: Testing skill for shadcn\u002Fui and Radix UI component libraries covering accessible component testing, dialog and popover testing, form validation testing, data table testing, command palette testing, and theme switching verification.\nversion: 1.0.0\nauthor: thetestingacademy\nlicense: MIT\ntags: [shadcn, radix-ui, component-testing, accessibility, dialog, form, data-table, tailwind]\ntestingTypes: [unit, integration, e2e, accessibility]\nframeworks: [vitest, playwright, react-testing-library]\nlanguages: [typescript, javascript]\ndomains: [web]\nagents: [claude-code, cursor, github-copilot, windsurf, codex, aider, continue, cline, zed, bolt, gemini-cli, amp]\n---\n\n# shadcn\u002Fui Component Testing Skill\n\nYou are an expert software engineer specializing in testing shadcn\u002Fui and Radix UI component libraries. When the user asks you to write, review, or debug tests for shadcn\u002Fui components including Dialog, Popover, Form, DataTable, Command palette, and theme switching, follow these detailed instructions.\n\n## Core Principles\n\n1. **Test user interactions, not Radix internals** -- Radix primitives are well-tested; focus on your composition and customization.\n2. **Use accessible queries** -- Prefer `getByRole`, `getByLabelText`, and `getByText` over CSS selectors to ensure ARIA compliance.\n3. **Test keyboard navigation** -- shadcn\u002Fui components support full keyboard interaction; verify tab order, arrow keys, and escape.\n4. **Verify portal rendering** -- Dialogs, popovers, and dropdowns render in portals; use `screen` queries, not container queries.\n5. **Test form integration** -- shadcn\u002Fui forms use react-hook-form + zod; test validation messages and submission behavior.\n6. **Assert on visual states** -- Test open\u002Fclosed, disabled, loading, and error states explicitly.\n7. **Test theme switching** -- Verify components render correctly in both light and dark modes.\n\n## Project Structure\n\n```\nproject\u002F\n  src\u002F\n    components\u002F\n      ui\u002F\n        button.tsx\n        dialog.tsx\n        popover.tsx\n        select.tsx\n        form.tsx\n        data-table.tsx\n        command.tsx\n        sheet.tsx\n        accordion.tsx\n        toast.tsx\n      __tests__\u002F\n        button.test.tsx\n        dialog.test.tsx\n        popover.test.tsx\n        select.test.tsx\n        form.test.tsx\n        data-table.test.tsx\n        command.test.tsx\n        sheet.test.tsx\n        accordion.test.tsx\n        toast.test.tsx\n        theme-switching.test.tsx\n        keyboard-navigation.test.tsx\n      test-utils\u002F\n        render-with-providers.tsx\n        mock-data.ts\n        accessibility-helpers.ts\n  vitest.config.ts\n  playwright.config.ts\n```\n\n## Test Utilities Setup\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002Ftest-utils\u002Frender-with-providers.tsx\nimport React, { ReactElement } from 'react';\nimport { render, RenderOptions } from '@testing-library\u002Freact';\nimport { ThemeProvider } from 'next-themes';\nimport { Toaster } from '@\u002Fcomponents\u002Fui\u002Ftoaster';\n\ninterface TestProviderOptions {\n  theme?: 'light' | 'dark' | 'system';\n}\n\nfunction TestProviders({\n  children,\n  theme = 'light',\n}: {\n  children: React.ReactNode;\n  theme?: string;\n}) {\n  return (\n    \u003CThemeProvider attribute=\"class\" defaultTheme={theme} enableSystem={false}>\n      {children}\n      \u003CToaster \u002F>\n    \u003C\u002FThemeProvider>\n  );\n}\n\nexport function renderWithProviders(\n  ui: ReactElement,\n  options?: RenderOptions & TestProviderOptions\n) {\n  const { theme, ...renderOptions } = options || {};\n\n  return render(ui, {\n    wrapper: ({ children }) => (\n      \u003CTestProviders theme={theme}>{children}\u003C\u002FTestProviders>\n    ),\n    ...renderOptions,\n  });\n}\n\nexport * from '@testing-library\u002Freact';\nexport { renderWithProviders as render };\n```\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002Ftest-utils\u002Faccessibility-helpers.ts\nimport { axe, toHaveNoViolations } from 'jest-axe';\n\nexpect.extend(toHaveNoViolations);\n\nexport async function expectNoA11yViolations(container: HTMLElement) {\n  const results = await axe(container);\n  expect(results).toHaveNoViolations();\n}\n\nexport function expectFocusVisible(element: HTMLElement) {\n  expect(element).toHaveFocus();\n  expect(document.activeElement).toBe(element);\n}\n\nexport function expectAriaExpanded(element: HTMLElement, expanded: boolean) {\n  expect(element).toHaveAttribute('aria-expanded', String(expanded));\n}\n\nexport function expectAriaSelected(element: HTMLElement, selected: boolean) {\n  expect(element).toHaveAttribute('aria-selected', String(selected));\n}\n```\n\n## Dialog Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fdialog.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Dialog,\n  DialogTrigger,\n  DialogContent,\n  DialogHeader,\n  DialogTitle,\n  DialogDescription,\n  DialogFooter,\n  DialogClose,\n} from '@\u002Fcomponents\u002Fui\u002Fdialog';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\nimport { expectNoA11yViolations } from '..\u002Ftest-utils\u002Faccessibility-helpers';\n\nfunction ConfirmDialog({\n  onConfirm,\n  onCancel,\n}: {\n  onConfirm: () => void;\n  onCancel?: () => void;\n}) {\n  return (\n    \u003CDialog>\n      \u003CDialogTrigger asChild>\n        \u003CButton>Delete Item\u003C\u002FButton>\n      \u003C\u002FDialogTrigger>\n      \u003CDialogContent>\n        \u003CDialogHeader>\n          \u003CDialogTitle>Are you sure?\u003C\u002FDialogTitle>\n          \u003CDialogDescription>\n            This action cannot be undone. This will permanently delete the item.\n          \u003C\u002FDialogDescription>\n        \u003C\u002FDialogHeader>\n        \u003CDialogFooter>\n          \u003CDialogClose asChild>\n            \u003CButton variant=\"outline\" onClick={onCancel}>\n              Cancel\n            \u003C\u002FButton>\n          \u003C\u002FDialogClose>\n          \u003CButton variant=\"destructive\" onClick={onConfirm}>\n            Delete\n          \u003C\u002FButton>\n        \u003C\u002FDialogFooter>\n      \u003C\u002FDialogContent>\n    \u003C\u002FDialog>\n  );\n}\n\ndescribe('Dialog', () => {\n  it('should open when trigger is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    \u002F\u002F Dialog content should not be visible initially\n    expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n\n    \u002F\u002F Click trigger to open\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    \u002F\u002F Dialog should be visible\n    expect(screen.getByRole('dialog')).toBeInTheDocument();\n    expect(screen.getByText('Are you sure?')).toBeInTheDocument();\n    expect(screen.getByText(\u002Fcannot be undone\u002Fi)).toBeInTheDocument();\n  });\n\n  it('should close when escape key is pressed', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    expect(screen.getByRole('dialog')).toBeInTheDocument();\n\n    await user.keyboard('{Escape}');\n\n    await waitFor(() => {\n      expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n    });\n  });\n\n  it('should close when overlay is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    expect(screen.getByRole('dialog')).toBeInTheDocument();\n\n    \u002F\u002F Click the overlay (outside dialog content)\n    const overlay = document.querySelector('[data-state=\"open\"][data-overlay]');\n    if (overlay) {\n      await user.click(overlay as HTMLElement);\n      await waitFor(() => {\n        expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n      });\n    }\n  });\n\n  it('should call onConfirm when delete button is clicked', async () => {\n    const user = userEvent.setup();\n    const onConfirm = vi.fn();\n    render(\u003CConfirmDialog onConfirm={onConfirm} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    await user.click(screen.getByRole('button', { name: \u002F^delete$\u002Fi }));\n\n    expect(onConfirm).toHaveBeenCalledTimes(1);\n  });\n\n  it('should close when cancel button is clicked', async () => {\n    const user = userEvent.setup();\n    const onCancel = vi.fn();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} onCancel={onCancel} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    await user.click(screen.getByRole('button', { name: \u002Fcancel\u002Fi }));\n\n    expect(onCancel).toHaveBeenCalledTimes(1);\n    await waitFor(() => {\n      expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n    });\n  });\n\n  it('should trap focus inside the dialog', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    \u002F\u002F Tab through dialog elements\n    await user.tab();\n    const cancelBtn = screen.getByRole('button', { name: \u002Fcancel\u002Fi });\n    const deleteBtn = screen.getByRole('button', { name: \u002F^delete$\u002Fi });\n\n    \u002F\u002F Focus should cycle within dialog\n    const focusableElements = [cancelBtn, deleteBtn];\n    for (const el of focusableElements) {\n      expect(document.activeElement === el || focusableElements.includes(document.activeElement as HTMLElement)).toBe(true);\n      await user.tab();\n    }\n  });\n\n  it('should have correct ARIA attributes', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    const dialog = screen.getByRole('dialog');\n    expect(dialog).toHaveAttribute('aria-labelledby');\n    expect(dialog).toHaveAttribute('aria-describedby');\n\n    const titleId = dialog.getAttribute('aria-labelledby');\n    const title = document.getElementById(titleId!);\n    expect(title).toHaveTextContent('Are you sure?');\n  });\n\n  it('should pass accessibility audit', async () => {\n    const user = userEvent.setup();\n    const { container } = render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    await expectNoA11yViolations(container);\n  });\n});\n```\n\n## Popover and Dropdown Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fpopover.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Popover,\n  PopoverTrigger,\n  PopoverContent,\n} from '@\u002Fcomponents\u002Fui\u002Fpopover';\nimport {\n  DropdownMenu,\n  DropdownMenuTrigger,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuSeparator,\n  DropdownMenuLabel,\n} from '@\u002Fcomponents\u002Fui\u002Fdropdown-menu';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\n\nfunction UserMenu({ onLogout }: { onLogout: () => void }) {\n  return (\n    \u003CDropdownMenu>\n      \u003CDropdownMenuTrigger asChild>\n        \u003CButton variant=\"ghost\">Profile\u003C\u002FButton>\n      \u003C\u002FDropdownMenuTrigger>\n      \u003CDropdownMenuContent>\n        \u003CDropdownMenuLabel>My Account\u003C\u002FDropdownMenuLabel>\n        \u003CDropdownMenuSeparator \u002F>\n        \u003CDropdownMenuItem>Settings\u003C\u002FDropdownMenuItem>\n        \u003CDropdownMenuItem>Billing\u003C\u002FDropdownMenuItem>\n        \u003CDropdownMenuSeparator \u002F>\n        \u003CDropdownMenuItem onClick={onLogout}>Log out\u003C\u002FDropdownMenuItem>\n      \u003C\u002FDropdownMenuContent>\n    \u003C\u002FDropdownMenu>\n  );\n}\n\ndescribe('DropdownMenu', () => {\n  it('should open on click and show menu items', async () => {\n    const user = userEvent.setup();\n    render(\u003CUserMenu onLogout={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n\n    expect(screen.getByText('My Account')).toBeInTheDocument();\n    expect(screen.getByRole('menuitem', { name: \u002Fsettings\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('menuitem', { name: \u002Fbilling\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('menuitem', { name: \u002Flog out\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should navigate items with arrow keys', async () => {\n    const user = userEvent.setup();\n    render(\u003CUserMenu onLogout={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n\n    \u002F\u002F Arrow down to navigate\n    await user.keyboard('{ArrowDown}');\n    expect(screen.getByRole('menuitem', { name: \u002Fsettings\u002Fi })).toHaveFocus();\n\n    await user.keyboard('{ArrowDown}');\n    expect(screen.getByRole('menuitem', { name: \u002Fbilling\u002Fi })).toHaveFocus();\n\n    await user.keyboard('{ArrowDown}');\n    expect(screen.getByRole('menuitem', { name: \u002Flog out\u002Fi })).toHaveFocus();\n  });\n\n  it('should call onLogout when Log out is clicked', async () => {\n    const user = userEvent.setup();\n    const onLogout = vi.fn();\n    render(\u003CUserMenu onLogout={onLogout} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n    await user.click(screen.getByRole('menuitem', { name: \u002Flog out\u002Fi }));\n\n    expect(onLogout).toHaveBeenCalledTimes(1);\n  });\n\n  it('should close on escape', async () => {\n    const user = userEvent.setup();\n    render(\u003CUserMenu onLogout={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n    expect(screen.getByText('My Account')).toBeInTheDocument();\n\n    await user.keyboard('{Escape}');\n\n    await waitFor(() => {\n      expect(screen.queryByText('My Account')).not.toBeInTheDocument();\n    });\n  });\n\n  it('should select item with Enter key', async () => {\n    const user = userEvent.setup();\n    const onLogout = vi.fn();\n    render(\u003CUserMenu onLogout={onLogout} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n    await user.keyboard('{ArrowDown}{ArrowDown}{ArrowDown}{Enter}');\n\n    expect(onLogout).toHaveBeenCalledTimes(1);\n  });\n});\n```\n\n## Select Component Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fselect.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Select,\n  SelectTrigger,\n  SelectValue,\n  SelectContent,\n  SelectItem,\n  SelectGroup,\n  SelectLabel,\n} from '@\u002Fcomponents\u002Fui\u002Fselect';\n\nfunction PrioritySelect({\n  value,\n  onChange,\n}: {\n  value?: string;\n  onChange: (value: string) => void;\n}) {\n  return (\n    \u003CSelect value={value} onValueChange={onChange}>\n      \u003CSelectTrigger aria-label=\"Priority\">\n        \u003CSelectValue placeholder=\"Select priority\" \u002F>\n      \u003C\u002FSelectTrigger>\n      \u003CSelectContent>\n        \u003CSelectGroup>\n          \u003CSelectLabel>Priority\u003C\u002FSelectLabel>\n          \u003CSelectItem value=\"low\">Low\u003C\u002FSelectItem>\n          \u003CSelectItem value=\"medium\">Medium\u003C\u002FSelectItem>\n          \u003CSelectItem value=\"high\">High\u003C\u002FSelectItem>\n          \u003CSelectItem value=\"critical\" disabled>\n            Critical\n          \u003C\u002FSelectItem>\n        \u003C\u002FSelectGroup>\n      \u003C\u002FSelectContent>\n    \u003C\u002FSelect>\n  );\n}\n\ndescribe('Select', () => {\n  it('should show placeholder when no value selected', () => {\n    render(\u003CPrioritySelect onChange={vi.fn()} \u002F>);\n\n    expect(screen.getByText('Select priority')).toBeInTheDocument();\n  });\n\n  it('should open options on click', async () => {\n    const user = userEvent.setup();\n    render(\u003CPrioritySelect onChange={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('combobox', { name: \u002Fpriority\u002Fi }));\n\n    expect(screen.getByRole('option', { name: \u002Flow\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('option', { name: \u002Fmedium\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('option', { name: \u002Fhigh\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should call onChange when option is selected', async () => {\n    const user = userEvent.setup();\n    const onChange = vi.fn();\n    render(\u003CPrioritySelect onChange={onChange} \u002F>);\n\n    await user.click(screen.getByRole('combobox', { name: \u002Fpriority\u002Fi }));\n    await user.click(screen.getByRole('option', { name: \u002Fhigh\u002Fi }));\n\n    expect(onChange).toHaveBeenCalledWith('high');\n  });\n\n  it('should not allow selecting disabled options', async () => {\n    const user = userEvent.setup();\n    const onChange = vi.fn();\n    render(\u003CPrioritySelect onChange={onChange} \u002F>);\n\n    await user.click(screen.getByRole('combobox', { name: \u002Fpriority\u002Fi }));\n    const criticalOption = screen.getByRole('option', { name: \u002Fcritical\u002Fi });\n\n    expect(criticalOption).toHaveAttribute('aria-disabled', 'true');\n  });\n\n  it('should display selected value', () => {\n    render(\u003CPrioritySelect value=\"medium\" onChange={vi.fn()} \u002F>);\n\n    expect(screen.getByText('Medium')).toBeInTheDocument();\n  });\n\n  it('should support keyboard navigation', async () => {\n    const user = userEvent.setup();\n    const onChange = vi.fn();\n    render(\u003CPrioritySelect onChange={onChange} \u002F>);\n\n    \u002F\u002F Open with Enter\n    const trigger = screen.getByRole('combobox', { name: \u002Fpriority\u002Fi });\n    trigger.focus();\n    await user.keyboard('{Enter}');\n\n    \u002F\u002F Navigate with arrows and select with Enter\n    await user.keyboard('{ArrowDown}{ArrowDown}{Enter}');\n\n    expect(onChange).toHaveBeenCalled();\n  });\n});\n```\n\n## Form Testing with react-hook-form + zod\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fform.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform\u002Fresolvers\u002Fzod';\nimport { z } from 'zod';\nimport {\n  Form,\n  FormControl,\n  FormDescription,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from '@\u002Fcomponents\u002Fui\u002Fform';\nimport { Input } from '@\u002Fcomponents\u002Fui\u002Finput';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\n\nconst profileSchema = z.object({\n  username: z\n    .string()\n    .min(3, 'Username must be at least 3 characters')\n    .max(20, 'Username must be at most 20 characters')\n    .regex(\u002F^[a-zA-Z0-9_]+$\u002F, 'Username can only contain letters, numbers, and underscores'),\n  email: z.string().email('Please enter a valid email address'),\n  bio: z.string().max(160, 'Bio must be at most 160 characters').optional(),\n});\n\ntype ProfileFormValues = z.infer\u003Ctypeof profileSchema>;\n\nfunction ProfileForm({ onSubmit }: { onSubmit: (data: ProfileFormValues) => void }) {\n  const form = useForm\u003CProfileFormValues>({\n    resolver: zodResolver(profileSchema),\n    defaultValues: { username: '', email: '', bio: '' },\n  });\n\n  return (\n    \u003CForm {...form}>\n      \u003Cform onSubmit={form.handleSubmit(onSubmit)} data-testid=\"profile-form\">\n        \u003CFormField\n          control={form.control}\n          name=\"username\"\n          render={({ field }) => (\n            \u003CFormItem>\n              \u003CFormLabel>Username\u003C\u002FFormLabel>\n              \u003CFormControl>\n                \u003CInput placeholder=\"johndoe\" {...field} \u002F>\n              \u003C\u002FFormControl>\n              \u003CFormDescription>Your public display name.\u003C\u002FFormDescription>\n              \u003CFormMessage \u002F>\n            \u003C\u002FFormItem>\n          )}\n        \u002F>\n        \u003CFormField\n          control={form.control}\n          name=\"email\"\n          render={({ field }) => (\n            \u003CFormItem>\n              \u003CFormLabel>Email\u003C\u002FFormLabel>\n              \u003CFormControl>\n                \u003CInput type=\"email\" placeholder=\"john@example.com\" {...field} \u002F>\n              \u003C\u002FFormControl>\n              \u003CFormMessage \u002F>\n            \u003C\u002FFormItem>\n          )}\n        \u002F>\n        \u003CFormField\n          control={form.control}\n          name=\"bio\"\n          render={({ field }) => (\n            \u003CFormItem>\n              \u003CFormLabel>Bio\u003C\u002FFormLabel>\n              \u003CFormControl>\n                \u003CInput placeholder=\"Tell us about yourself\" {...field} \u002F>\n              \u003C\u002FFormControl>\n              \u003CFormMessage \u002F>\n            \u003C\u002FFormItem>\n          )}\n        \u002F>\n        \u003CButton type=\"submit\">Save\u003C\u002FButton>\n      \u003C\u002Fform>\n    \u003C\u002FForm>\n  );\n}\n\ndescribe('ProfileForm', () => {\n  it('should render all form fields', () => {\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    expect(screen.getByLabelText(\u002Fusername\u002Fi)).toBeInTheDocument();\n    expect(screen.getByLabelText(\u002Femail\u002Fi)).toBeInTheDocument();\n    expect(screen.getByLabelText(\u002Fbio\u002Fi)).toBeInTheDocument();\n    expect(screen.getByRole('button', { name: \u002Fsave\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should show validation errors for empty required fields', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fat least 3 characters\u002Fi)).toBeInTheDocument();\n      expect(screen.getByText(\u002Fvalid email\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should show validation error for short username', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'ab');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'valid@example.com');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fat least 3 characters\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should show validation error for invalid username characters', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'user name!');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'valid@example.com');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fonly contain letters, numbers\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should show validation error for invalid email', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'validuser');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'not-an-email');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fvalid email\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should submit valid form data', async () => {\n    const user = userEvent.setup();\n    const onSubmit = vi.fn();\n    render(\u003CProfileForm onSubmit={onSubmit} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'johndoe');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'john@example.com');\n    await user.type(screen.getByLabelText(\u002Fbio\u002Fi), 'Hello world');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(onSubmit).toHaveBeenCalledWith(\n        { username: 'johndoe', email: 'john@example.com', bio: 'Hello world' },\n        expect.anything()\n      );\n    });\n  });\n\n  it('should clear errors when valid input is provided', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    \u002F\u002F Trigger validation errors\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fat least 3 characters\u002Fi)).toBeInTheDocument();\n    });\n\n    \u002F\u002F Fix the error\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'validuser');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'valid@example.com');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.queryByText(\u002Fat least 3 characters\u002Fi)).not.toBeInTheDocument();\n    });\n  });\n});\n```\n\n## DataTable Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fdata-table.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, within } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\n\n\u002F\u002F Assume a DataTable component built with @tanstack\u002Freact-table + shadcn\u002Fui\nimport { DataTable, columns } from '@\u002Fcomponents\u002Fdata-table';\n\nconst mockData = [\n  { id: '1', name: 'Alice', email: 'alice@example.com', role: 'admin', status: 'active' },\n  { id: '2', name: 'Bob', email: 'bob@example.com', role: 'user', status: 'active' },\n  { id: '3', name: 'Charlie', email: 'charlie@example.com', role: 'user', status: 'inactive' },\n  { id: '4', name: 'Diana', email: 'diana@example.com', role: 'admin', status: 'active' },\n  { id: '5', name: 'Eve', email: 'eve@example.com', role: 'user', status: 'active' },\n];\n\ndescribe('DataTable', () => {\n  it('should render all rows', () => {\n    render(\u003CDataTable columns={columns} data={mockData} \u002F>);\n\n    const rows = screen.getAllByRole('row');\n    \u002F\u002F Header row + 5 data rows\n    expect(rows).toHaveLength(6);\n  });\n\n  it('should render column headers', () => {\n    render(\u003CDataTable columns={columns} data={mockData} \u002F>);\n\n    expect(screen.getByRole('columnheader', { name: \u002Fname\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('columnheader', { name: \u002Femail\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('columnheader', { name: \u002Frole\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('columnheader', { name: \u002Fstatus\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should sort by column when header is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CDataTable columns={columns} data={mockData} \u002F>);\n\n    \u002F\u002F Click name column header to sort ascending\n    await user.click(screen.getByRole('columnheader', { name: \u002Fname\u002Fi }));\n\n    const rows = screen.getAllByRole('row').slice(1); \u002F\u002F Skip header\n    const names = rows.map((row) => within(row).getAllByRole('cell')[0].textContent);\n    expect(names).toEqual(['Alice', 'Bob', 'Charlie', 'Diana', 'Eve']);\n\n    \u002F\u002F Click again for descending\n    await user.click(screen.getByRole('columnheader', { name: \u002Fname\u002Fi }));\n\n    const rowsDesc = screen.getAllByRole('row').slice(1);\n    const namesDesc = rowsDesc.map((row) => within(row).getAllByRole('cell')[0].textContent);\n    expect(namesDesc).toEqual(['Eve', 'Diana', 'Charlie', 'Bob', 'Alice']);\n  });\n\n  it('should filter rows by search input', async () => {\n    const user = userEvent.setup();\n    render(\u003CDataTable columns={columns} data={mockData} searchColumn=\"name\" \u002F>);\n\n    const searchInput = screen.getByPlaceholderText(\u002Ffilter\u002Fi);\n    await user.type(searchInput, 'alice');\n\n    const rows = screen.getAllByRole('row').slice(1);\n    expect(rows).toHaveLength(1);\n    expect(within(rows[0]).getByText('Alice')).toBeInTheDocument();\n  });\n\n  it('should show empty state when no data matches', async () => {\n    const user = userEvent.setup();\n    render(\u003CDataTable columns={columns} data={mockData} searchColumn=\"name\" \u002F>);\n\n    const searchInput = screen.getByPlaceholderText(\u002Ffilter\u002Fi);\n    await user.type(searchInput, 'nonexistent');\n\n    expect(screen.getByText(\u002Fno results\u002Fi)).toBeInTheDocument();\n  });\n\n  it('should handle row selection with checkboxes', async () => {\n    const user = userEvent.setup();\n    const onSelectionChange = vi.fn();\n    render(\n      \u003CDataTable\n        columns={columns}\n        data={mockData}\n        enableSelection\n        onSelectionChange={onSelectionChange}\n      \u002F>\n    );\n\n    const checkboxes = screen.getAllByRole('checkbox');\n    \u002F\u002F First checkbox is \"select all\", rest are row checkboxes\n    expect(checkboxes).toHaveLength(6);\n\n    \u002F\u002F Select first row\n    await user.click(checkboxes[1]);\n    expect(onSelectionChange).toHaveBeenCalledWith(\n      expect.objectContaining({ '1': true })\n    );\n  });\n\n  it('should handle pagination', async () => {\n    const user = userEvent.setup();\n    const largeData = Array.from({ length: 25 }, (_, i) => ({\n      id: String(i),\n      name: `User ${i}`,\n      email: `user${i}@example.com`,\n      role: 'user',\n      status: 'active',\n    }));\n\n    render(\u003CDataTable columns={columns} data={largeData} pageSize={10} \u002F>);\n\n    \u002F\u002F First page should show 10 rows\n    const rows = screen.getAllByRole('row').slice(1);\n    expect(rows).toHaveLength(10);\n\n    \u002F\u002F Navigate to next page\n    const nextButton = screen.getByRole('button', { name: \u002Fnext\u002Fi });\n    await user.click(nextButton);\n\n    \u002F\u002F Second page should also show 10 rows\n    const page2Rows = screen.getAllByRole('row').slice(1);\n    expect(page2Rows).toHaveLength(10);\n  });\n});\n```\n\n## Command Palette (cmdk) Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fcommand.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  CommandDialog,\n  CommandInput,\n  CommandList,\n  CommandEmpty,\n  CommandGroup,\n  CommandItem,\n  CommandSeparator,\n} from '@\u002Fcomponents\u002Fui\u002Fcommand';\n\nfunction AppCommandPalette({\n  open,\n  onOpenChange,\n  onSelect,\n}: {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  onSelect: (value: string) => void;\n}) {\n  return (\n    \u003CCommandDialog open={open} onOpenChange={onOpenChange}>\n      \u003CCommandInput placeholder=\"Type a command or search...\" \u002F>\n      \u003CCommandList>\n        \u003CCommandEmpty>No results found.\u003C\u002FCommandEmpty>\n        \u003CCommandGroup heading=\"Pages\">\n          \u003CCommandItem onSelect={() => onSelect('\u002Fdashboard')}>Dashboard\u003C\u002FCommandItem>\n          \u003CCommandItem onSelect={() => onSelect('\u002Fsettings')}>Settings\u003C\u002FCommandItem>\n          \u003CCommandItem onSelect={() => onSelect('\u002Fprofile')}>Profile\u003C\u002FCommandItem>\n        \u003C\u002FCommandGroup>\n        \u003CCommandSeparator \u002F>\n        \u003CCommandGroup heading=\"Actions\">\n          \u003CCommandItem onSelect={() => onSelect('new-project')}>New Project\u003C\u002FCommandItem>\n          \u003CCommandItem onSelect={() => onSelect('new-team')}>New Team\u003C\u002FCommandItem>\n        \u003C\u002FCommandGroup>\n      \u003C\u002FCommandList>\n    \u003C\u002FCommandDialog>\n  );\n}\n\ndescribe('Command Palette', () => {\n  it('should render when open', () => {\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={vi.fn()} \u002F>\n    );\n\n    expect(screen.getByPlaceholderText(\u002Ftype a command\u002Fi)).toBeInTheDocument();\n    expect(screen.getByText('Dashboard')).toBeInTheDocument();\n    expect(screen.getByText('Settings')).toBeInTheDocument();\n  });\n\n  it('should filter items by search input', async () => {\n    const user = userEvent.setup();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={vi.fn()} \u002F>\n    );\n\n    await user.type(screen.getByPlaceholderText(\u002Ftype a command\u002Fi), 'dash');\n\n    expect(screen.getByText('Dashboard')).toBeInTheDocument();\n    expect(screen.queryByText('Settings')).not.toBeInTheDocument();\n    expect(screen.queryByText('Profile')).not.toBeInTheDocument();\n  });\n\n  it('should show empty state when nothing matches', async () => {\n    const user = userEvent.setup();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={vi.fn()} \u002F>\n    );\n\n    await user.type(screen.getByPlaceholderText(\u002Ftype a command\u002Fi), 'zzzzz');\n\n    expect(screen.getByText('No results found.')).toBeInTheDocument();\n  });\n\n  it('should call onSelect when item is clicked', async () => {\n    const user = userEvent.setup();\n    const onSelect = vi.fn();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={onSelect} \u002F>\n    );\n\n    await user.click(screen.getByText('Dashboard'));\n\n    expect(onSelect).toHaveBeenCalledWith('\u002Fdashboard');\n  });\n\n  it('should navigate with arrow keys and select with Enter', async () => {\n    const user = userEvent.setup();\n    const onSelect = vi.fn();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={onSelect} \u002F>\n    );\n\n    const input = screen.getByPlaceholderText(\u002Ftype a command\u002Fi);\n    await user.click(input);\n    await user.keyboard('{ArrowDown}{ArrowDown}{Enter}');\n\n    expect(onSelect).toHaveBeenCalled();\n  });\n});\n```\n\n## Theme Switching Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Ftheme-switching.test.tsx\nimport { describe, it, expect } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\nimport { useTheme } from 'next-themes';\n\nfunction ThemeToggle() {\n  const { theme, setTheme } = useTheme();\n\n  return (\n    \u003CButton\n      variant=\"outline\"\n      onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}\n      aria-label={`Switch to ${theme === 'light' ? 'dark' : 'light'} mode`}\n    >\n      {theme === 'light' ? 'Dark Mode' : 'Light Mode'}\n    \u003C\u002FButton>\n  );\n}\n\ndescribe('Theme Switching', () => {\n  it('should render with light theme by default', () => {\n    render(\u003CThemeToggle \u002F>, { theme: 'light' });\n\n    expect(screen.getByRole('button', { name: \u002Fswitch to dark\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should render with dark theme when configured', () => {\n    render(\u003CThemeToggle \u002F>, { theme: 'dark' });\n\n    expect(screen.getByRole('button', { name: \u002Fswitch to light\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should toggle theme on button click', async () => {\n    const user = userEvent.setup();\n    render(\u003CThemeToggle \u002F>, { theme: 'light' });\n\n    await user.click(screen.getByRole('button', { name: \u002Fswitch to dark\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByRole('button', { name: \u002Fswitch to light\u002Fi })).toBeInTheDocument();\n    });\n  });\n\n  it('should apply correct CSS class to document', async () => {\n    const user = userEvent.setup();\n    render(\u003CThemeToggle \u002F>, { theme: 'light' });\n\n    await user.click(screen.getByRole('button', { name: \u002Fswitch to dark\u002Fi }));\n\n    await waitFor(() => {\n      expect(document.documentElement.classList.contains('dark')).toBe(true);\n    });\n  });\n});\n```\n\n## Accordion Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Faccordion.test.tsx\nimport { describe, it, expect } from 'vitest';\nimport { render, screen } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Accordion,\n  AccordionItem,\n  AccordionTrigger,\n  AccordionContent,\n} from '@\u002Fcomponents\u002Fui\u002Faccordion';\n\nfunction FAQ() {\n  return (\n    \u003CAccordion type=\"single\" collapsible>\n      \u003CAccordionItem value=\"item-1\">\n        \u003CAccordionTrigger>What is shadcn\u002Fui?\u003C\u002FAccordionTrigger>\n        \u003CAccordionContent>\n          A collection of reusable components built with Radix UI and Tailwind CSS.\n        \u003C\u002FAccordionContent>\n      \u003C\u002FAccordionItem>\n      \u003CAccordionItem value=\"item-2\">\n        \u003CAccordionTrigger>Is it accessible?\u003C\u002FAccordionTrigger>\n        \u003CAccordionContent>\n          Yes, it follows WAI-ARIA design patterns.\n        \u003C\u002FAccordionContent>\n      \u003C\u002FAccordionItem>\n    \u003C\u002FAccordion>\n  );\n}\n\ndescribe('Accordion', () => {\n  it('should render all triggers', () => {\n    render(\u003CFAQ \u002F>);\n\n    expect(screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('button', { name: \u002Fis it accessible\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should expand content when trigger is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi }));\n\n    expect(screen.getByText(\u002Freusable components\u002Fi)).toBeVisible();\n  });\n\n  it('should collapse when clicking the same trigger again', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    const trigger = screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi });\n    await user.click(trigger);\n    expect(screen.getByText(\u002Freusable components\u002Fi)).toBeVisible();\n\n    await user.click(trigger);\n    \u002F\u002F Content should be hidden (aria-hidden or removed)\n    expect(trigger).toHaveAttribute('aria-expanded', 'false');\n  });\n\n  it('should close previous item when opening another (single mode)', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi }));\n    expect(screen.getByText(\u002Freusable components\u002Fi)).toBeVisible();\n\n    await user.click(screen.getByRole('button', { name: \u002Fis it accessible\u002Fi }));\n    expect(screen.getByText(\u002FWAI-ARIA\u002Fi)).toBeVisible();\n\n    \u002F\u002F First item should be collapsed\n    const firstTrigger = screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi });\n    expect(firstTrigger).toHaveAttribute('aria-expanded', 'false');\n  });\n\n  it('should support keyboard navigation', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    const firstTrigger = screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi });\n    firstTrigger.focus();\n\n    \u002F\u002F Space should toggle\n    await user.keyboard(' ');\n    expect(firstTrigger).toHaveAttribute('aria-expanded', 'true');\n\n    \u002F\u002F Enter should also toggle\n    await user.keyboard('{Enter}');\n    expect(firstTrigger).toHaveAttribute('aria-expanded', 'false');\n  });\n});\n```\n\n## E2E Tests with Playwright\n\n```typescript\n\u002F\u002F e2e\u002Fcomponents.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\n\ntest.describe('shadcn\u002Fui Components E2E', () => {\n  test('dialog should open and close with keyboard', async ({ page }) => {\n    await page.goto('\u002Fcomponents\u002Fdialog-demo');\n\n    await page.getByRole('button', { name: \u002Fopen dialog\u002Fi }).click();\n    await expect(page.getByRole('dialog')).toBeVisible();\n\n    \u002F\u002F Close with Escape\n    await page.keyboard.press('Escape');\n    await expect(page.getByRole('dialog')).not.toBeVisible();\n  });\n\n  test('command palette should open with Cmd+K', async ({ page }) => {\n    await page.goto('\u002Fdashboard');\n\n    \u002F\u002F Open command palette with keyboard shortcut\n    await page.keyboard.press('Meta+k');\n    await expect(page.getByPlaceholder(\u002Ftype a command\u002Fi)).toBeVisible();\n\n    \u002F\u002F Search and select\n    await page.getByPlaceholder(\u002Ftype a command\u002Fi).fill('settings');\n    await page.keyboard.press('Enter');\n    await expect(page).toHaveURL(\u002F\\\u002Fsettings\u002F);\n  });\n\n  test('data table should sort and filter', async ({ page }) => {\n    await page.goto('\u002Fdashboard\u002Fusers');\n\n    \u002F\u002F Sort by name\n    await page.getByRole('columnheader', { name: \u002Fname\u002Fi }).click();\n    const firstRow = page.getByRole('row').nth(1);\n    await expect(firstRow.getByRole('cell').first()).toHaveText(\u002F^A\u002F);\n\n    \u002F\u002F Filter\n    await page.getByPlaceholder(\u002Ffilter\u002Fi).fill('admin');\n    const rows = page.getByRole('row');\n    await expect(rows).toHaveCount(3); \u002F\u002F Header + 2 admin rows\n  });\n\n  test('form should show validation errors and submit', async ({ page }) => {\n    await page.goto('\u002Fprofile\u002Fedit');\n\n    \u002F\u002F Submit empty form\n    await page.getByRole('button', { name: \u002Fsave\u002Fi }).click();\n    await expect(page.getByText(\u002Fat least 3 characters\u002Fi)).toBeVisible();\n\n    \u002F\u002F Fill valid data\n    await page.getByLabel(\u002Fusername\u002Fi).fill('testuser');\n    await page.getByLabel(\u002Femail\u002Fi).fill('test@example.com');\n    await page.getByRole('button', { name: \u002Fsave\u002Fi }).click();\n\n    await expect(page.getByText(\u002Fsaved successfully\u002Fi)).toBeVisible();\n  });\n});\n```\n\n## Best Practices\n\n1. **Use `getByRole` over `getByTestId`** -- Role queries test accessibility for free; test IDs skip it.\n2. **Always use `userEvent` over `fireEvent`** -- `userEvent` simulates real browser interactions including focus.\n3. **Wrap state changes in `waitFor`** -- Radix components use animations; state changes may be async.\n4. **Test portal-rendered content with `screen`** -- Dialogs and popovers render outside the component tree.\n5. **Run axe audits on interactive states** -- Test accessibility of both closed and open states.\n6. **Mock `next-themes` for predictable theme testing** -- Avoid relying on browser\u002FOS theme preferences.\n7. **Test disabled states explicitly** -- Verify that disabled buttons, inputs, and menu items are not interactive.\n8. **Use `within()` for scoped queries** -- When testing tables or lists, scope queries to a specific row or item.\n9. **Test the complete form lifecycle** -- Empty submit, validation errors, correction, successful submit.\n10. **Keep component tests focused** -- Test one component behavior per test; compose for integration tests.\n\n## Anti-Patterns to Avoid\n\n1. **Testing Radix internal state** -- Do not assert on `data-state` attributes; test visible behavior instead.\n2. **Using CSS selectors for queries** -- `querySelector('.shadcn-button')` is fragile; use ARIA roles.\n3. **Forgetting to wait for animations** -- Radix uses enter\u002Fexit animations; wrap assertions in `waitFor`.\n4. **Testing styled-component class names** -- Tailwind classes are implementation details; test visual output.\n5. **Skipping keyboard interaction tests** -- Many users rely on keyboard navigation; it must work.\n6. **Mocking Radix primitives** -- Never mock the component library; test the real components.\n7. **Testing only the open state** -- Verify that closed\u002Fcollapsed states also render correctly.\n8. **Ignoring focus management** -- After a dialog closes, focus should return to the trigger element.\n9. **Not testing with screen readers** -- Run automated ARIA checks and manual VoiceOver\u002FNVDA testing.\n10. **Hardcoding animation durations in tests** -- Use `waitFor` instead of `setTimeout` for animation timing.\n\n## Running Tests\n\n```bash\n# Run all component tests\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002F\n\n# Run a specific component test\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002Fdialog.test.tsx\n\n# Run with coverage\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002F --coverage\n\n# Watch mode for development\nnpx vitest watch src\u002Fcomponents\u002F__tests__\u002F\n\n# Run E2E tests\nnpx playwright test e2e\u002Fcomponents.spec.ts\n\n# Run E2E with UI mode\nnpx playwright test --ui\n\n# Run accessibility audit\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002F --reporter=verbose\n\n# Debug a failing test\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002Fform.test.tsx --reporter=verbose\n```\n","# shadcn\u002Fui Component Testing Skill\n\nYou are an expert software engineer specializing in testing shadcn\u002Fui and Radix UI component libraries. When the user asks you to write, review, or debug tests for shadcn\u002Fui components including Dialog, Popover, Form, DataTable, Command palette, and theme switching, follow these detailed instructions.\n\n## Core Principles\n\n1. **Test user interactions, not Radix internals** -- Radix primitives are well-tested; focus on your composition and customization.\n2. **Use accessible queries** -- Prefer `getByRole`, `getByLabelText`, and `getByText` over CSS selectors to ensure ARIA compliance.\n3. **Test keyboard navigation** -- shadcn\u002Fui components support full keyboard interaction; verify tab order, arrow keys, and escape.\n4. **Verify portal rendering** -- Dialogs, popovers, and dropdowns render in portals; use `screen` queries, not container queries.\n5. **Test form integration** -- shadcn\u002Fui forms use react-hook-form + zod; test validation messages and submission behavior.\n6. **Assert on visual states** -- Test open\u002Fclosed, disabled, loading, and error states explicitly.\n7. **Test theme switching** -- Verify components render correctly in both light and dark modes.\n\n## Project Structure\n\n```\nproject\u002F\n  src\u002F\n    components\u002F\n      ui\u002F\n        button.tsx\n        dialog.tsx\n        popover.tsx\n        select.tsx\n        form.tsx\n        data-table.tsx\n        command.tsx\n        sheet.tsx\n        accordion.tsx\n        toast.tsx\n      __tests__\u002F\n        button.test.tsx\n        dialog.test.tsx\n        popover.test.tsx\n        select.test.tsx\n        form.test.tsx\n        data-table.test.tsx\n        command.test.tsx\n        sheet.test.tsx\n        accordion.test.tsx\n        toast.test.tsx\n        theme-switching.test.tsx\n        keyboard-navigation.test.tsx\n      test-utils\u002F\n        render-with-providers.tsx\n        mock-data.ts\n        accessibility-helpers.ts\n  vitest.config.ts\n  playwright.config.ts\n```\n\n## Test Utilities Setup\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002Ftest-utils\u002Frender-with-providers.tsx\nimport React, { ReactElement } from 'react';\nimport { render, RenderOptions } from '@testing-library\u002Freact';\nimport { ThemeProvider } from 'next-themes';\nimport { Toaster } from '@\u002Fcomponents\u002Fui\u002Ftoaster';\n\ninterface TestProviderOptions {\n  theme?: 'light' | 'dark' | 'system';\n}\n\nfunction TestProviders({\n  children,\n  theme = 'light',\n}: {\n  children: React.ReactNode;\n  theme?: string;\n}) {\n  return (\n    \u003CThemeProvider attribute=\"class\" defaultTheme={theme} enableSystem={false}>\n      {children}\n      \u003CToaster \u002F>\n    \u003C\u002FThemeProvider>\n  );\n}\n\nexport function renderWithProviders(\n  ui: ReactElement,\n  options?: RenderOptions & TestProviderOptions\n) {\n  const { theme, ...renderOptions } = options || {};\n\n  return render(ui, {\n    wrapper: ({ children }) => (\n      \u003CTestProviders theme={theme}>{children}\u003C\u002FTestProviders>\n    ),\n    ...renderOptions,\n  });\n}\n\nexport * from '@testing-library\u002Freact';\nexport { renderWithProviders as render };\n```\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002Ftest-utils\u002Faccessibility-helpers.ts\nimport { axe, toHaveNoViolations } from 'jest-axe';\n\nexpect.extend(toHaveNoViolations);\n\nexport async function expectNoA11yViolations(container: HTMLElement) {\n  const results = await axe(container);\n  expect(results).toHaveNoViolations();\n}\n\nexport function expectFocusVisible(element: HTMLElement) {\n  expect(element).toHaveFocus();\n  expect(document.activeElement).toBe(element);\n}\n\nexport function expectAriaExpanded(element: HTMLElement, expanded: boolean) {\n  expect(element).toHaveAttribute('aria-expanded', String(expanded));\n}\n\nexport function expectAriaSelected(element: HTMLElement, selected: boolean) {\n  expect(element).toHaveAttribute('aria-selected', String(selected));\n}\n```\n\n## Dialog Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fdialog.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Dialog,\n  DialogTrigger,\n  DialogContent,\n  DialogHeader,\n  DialogTitle,\n  DialogDescription,\n  DialogFooter,\n  DialogClose,\n} from '@\u002Fcomponents\u002Fui\u002Fdialog';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\nimport { expectNoA11yViolations } from '..\u002Ftest-utils\u002Faccessibility-helpers';\n\nfunction ConfirmDialog({\n  onConfirm,\n  onCancel,\n}: {\n  onConfirm: () => void;\n  onCancel?: () => void;\n}) {\n  return (\n    \u003CDialog>\n      \u003CDialogTrigger asChild>\n        \u003CButton>Delete Item\u003C\u002FButton>\n      \u003C\u002FDialogTrigger>\n      \u003CDialogContent>\n        \u003CDialogHeader>\n          \u003CDialogTitle>Are you sure?\u003C\u002FDialogTitle>\n          \u003CDialogDescription>\n            This action cannot be undone. This will permanently delete the item.\n          \u003C\u002FDialogDescription>\n        \u003C\u002FDialogHeader>\n        \u003CDialogFooter>\n          \u003CDialogClose asChild>\n            \u003CButton variant=\"outline\" onClick={onCancel}>\n              Cancel\n            \u003C\u002FButton>\n          \u003C\u002FDialogClose>\n          \u003CButton variant=\"destructive\" onClick={onConfirm}>\n            Delete\n          \u003C\u002FButton>\n        \u003C\u002FDialogFooter>\n      \u003C\u002FDialogContent>\n    \u003C\u002FDialog>\n  );\n}\n\ndescribe('Dialog', () => {\n  it('should open when trigger is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    \u002F\u002F Dialog content should not be visible initially\n    expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n\n    \u002F\u002F Click trigger to open\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    \u002F\u002F Dialog should be visible\n    expect(screen.getByRole('dialog')).toBeInTheDocument();\n    expect(screen.getByText('Are you sure?')).toBeInTheDocument();\n    expect(screen.getByText(\u002Fcannot be undone\u002Fi)).toBeInTheDocument();\n  });\n\n  it('should close when escape key is pressed', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    expect(screen.getByRole('dialog')).toBeInTheDocument();\n\n    await user.keyboard('{Escape}');\n\n    await waitFor(() => {\n      expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n    });\n  });\n\n  it('should close when overlay is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    expect(screen.getByRole('dialog')).toBeInTheDocument();\n\n    \u002F\u002F Click the overlay (outside dialog content)\n    const overlay = document.querySelector('[data-state=\"open\"][data-overlay]');\n    if (overlay) {\n      await user.click(overlay as HTMLElement);\n      await waitFor(() => {\n        expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n      });\n    }\n  });\n\n  it('should call onConfirm when delete button is clicked', async () => {\n    const user = userEvent.setup();\n    const onConfirm = vi.fn();\n    render(\u003CConfirmDialog onConfirm={onConfirm} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    await user.click(screen.getByRole('button', { name: \u002F^delete$\u002Fi }));\n\n    expect(onConfirm).toHaveBeenCalledTimes(1);\n  });\n\n  it('should close when cancel button is clicked', async () => {\n    const user = userEvent.setup();\n    const onCancel = vi.fn();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} onCancel={onCancel} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n    await user.click(screen.getByRole('button', { name: \u002Fcancel\u002Fi }));\n\n    expect(onCancel).toHaveBeenCalledTimes(1);\n    await waitFor(() => {\n      expect(screen.queryByRole('dialog')).not.toBeInTheDocument();\n    });\n  });\n\n  it('should trap focus inside the dialog', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    \u002F\u002F Tab through dialog elements\n    await user.tab();\n    const cancelBtn = screen.getByRole('button', { name: \u002Fcancel\u002Fi });\n    const deleteBtn = screen.getByRole('button', { name: \u002F^delete$\u002Fi });\n\n    \u002F\u002F Focus should cycle within dialog\n    const focusableElements = [cancelBtn, deleteBtn];\n    for (const el of focusableElements) {\n      expect(document.activeElement === el || focusableElements.includes(document.activeElement as HTMLElement)).toBe(true);\n      await user.tab();\n    }\n  });\n\n  it('should have correct ARIA attributes', async () => {\n    const user = userEvent.setup();\n    render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    const dialog = screen.getByRole('dialog');\n    expect(dialog).toHaveAttribute('aria-labelledby');\n    expect(dialog).toHaveAttribute('aria-describedby');\n\n    const titleId = dialog.getAttribute('aria-labelledby');\n    const title = document.getElementById(titleId!);\n    expect(title).toHaveTextContent('Are you sure?');\n  });\n\n  it('should pass accessibility audit', async () => {\n    const user = userEvent.setup();\n    const { container } = render(\u003CConfirmDialog onConfirm={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fdelete item\u002Fi }));\n\n    await expectNoA11yViolations(container);\n  });\n});\n```\n\n## Popover and Dropdown Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fpopover.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Popover,\n  PopoverTrigger,\n  PopoverContent,\n} from '@\u002Fcomponents\u002Fui\u002Fpopover';\nimport {\n  DropdownMenu,\n  DropdownMenuTrigger,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuSeparator,\n  DropdownMenuLabel,\n} from '@\u002Fcomponents\u002Fui\u002Fdropdown-menu';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\n\nfunction UserMenu({ onLogout }: { onLogout: () => void }) {\n  return (\n    \u003CDropdownMenu>\n      \u003CDropdownMenuTrigger asChild>\n        \u003CButton variant=\"ghost\">Profile\u003C\u002FButton>\n      \u003C\u002FDropdownMenuTrigger>\n      \u003CDropdownMenuContent>\n        \u003CDropdownMenuLabel>My Account\u003C\u002FDropdownMenuLabel>\n        \u003CDropdownMenuSeparator \u002F>\n        \u003CDropdownMenuItem>Settings\u003C\u002FDropdownMenuItem>\n        \u003CDropdownMenuItem>Billing\u003C\u002FDropdownMenuItem>\n        \u003CDropdownMenuSeparator \u002F>\n        \u003CDropdownMenuItem onClick={onLogout}>Log out\u003C\u002FDropdownMenuItem>\n      \u003C\u002FDropdownMenuContent>\n    \u003C\u002FDropdownMenu>\n  );\n}\n\ndescribe('DropdownMenu', () => {\n  it('should open on click and show menu items', async () => {\n    const user = userEvent.setup();\n    render(\u003CUserMenu onLogout={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n\n    expect(screen.getByText('My Account')).toBeInTheDocument();\n    expect(screen.getByRole('menuitem', { name: \u002Fsettings\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('menuitem', { name: \u002Fbilling\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('menuitem', { name: \u002Flog out\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should navigate items with arrow keys', async () => {\n    const user = userEvent.setup();\n    render(\u003CUserMenu onLogout={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n\n    \u002F\u002F Arrow down to navigate\n    await user.keyboard('{ArrowDown}');\n    expect(screen.getByRole('menuitem', { name: \u002Fsettings\u002Fi })).toHaveFocus();\n\n    await user.keyboard('{ArrowDown}');\n    expect(screen.getByRole('menuitem', { name: \u002Fbilling\u002Fi })).toHaveFocus();\n\n    await user.keyboard('{ArrowDown}');\n    expect(screen.getByRole('menuitem', { name: \u002Flog out\u002Fi })).toHaveFocus();\n  });\n\n  it('should call onLogout when Log out is clicked', async () => {\n    const user = userEvent.setup();\n    const onLogout = vi.fn();\n    render(\u003CUserMenu onLogout={onLogout} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n    await user.click(screen.getByRole('menuitem', { name: \u002Flog out\u002Fi }));\n\n    expect(onLogout).toHaveBeenCalledTimes(1);\n  });\n\n  it('should close on escape', async () => {\n    const user = userEvent.setup();\n    render(\u003CUserMenu onLogout={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n    expect(screen.getByText('My Account')).toBeInTheDocument();\n\n    await user.keyboard('{Escape}');\n\n    await waitFor(() => {\n      expect(screen.queryByText('My Account')).not.toBeInTheDocument();\n    });\n  });\n\n  it('should select item with Enter key', async () => {\n    const user = userEvent.setup();\n    const onLogout = vi.fn();\n    render(\u003CUserMenu onLogout={onLogout} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fprofile\u002Fi }));\n    await user.keyboard('{ArrowDown}{ArrowDown}{ArrowDown}{Enter}');\n\n    expect(onLogout).toHaveBeenCalledTimes(1);\n  });\n});\n```\n\n## Select Component Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fselect.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Select,\n  SelectTrigger,\n  SelectValue,\n  SelectContent,\n  SelectItem,\n  SelectGroup,\n  SelectLabel,\n} from '@\u002Fcomponents\u002Fui\u002Fselect';\n\nfunction PrioritySelect({\n  value,\n  onChange,\n}: {\n  value?: string;\n  onChange: (value: string) => void;\n}) {\n  return (\n    \u003CSelect value={value} onValueChange={onChange}>\n      \u003CSelectTrigger aria-label=\"Priority\">\n        \u003CSelectValue placeholder=\"Select priority\" \u002F>\n      \u003C\u002FSelectTrigger>\n      \u003CSelectContent>\n        \u003CSelectGroup>\n          \u003CSelectLabel>Priority\u003C\u002FSelectLabel>\n          \u003CSelectItem value=\"low\">Low\u003C\u002FSelectItem>\n          \u003CSelectItem value=\"medium\">Medium\u003C\u002FSelectItem>\n          \u003CSelectItem value=\"high\">High\u003C\u002FSelectItem>\n          \u003CSelectItem value=\"critical\" disabled>\n            Critical\n          \u003C\u002FSelectItem>\n        \u003C\u002FSelectGroup>\n      \u003C\u002FSelectContent>\n    \u003C\u002FSelect>\n  );\n}\n\ndescribe('Select', () => {\n  it('should show placeholder when no value selected', () => {\n    render(\u003CPrioritySelect onChange={vi.fn()} \u002F>);\n\n    expect(screen.getByText('Select priority')).toBeInTheDocument();\n  });\n\n  it('should open options on click', async () => {\n    const user = userEvent.setup();\n    render(\u003CPrioritySelect onChange={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('combobox', { name: \u002Fpriority\u002Fi }));\n\n    expect(screen.getByRole('option', { name: \u002Flow\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('option', { name: \u002Fmedium\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('option', { name: \u002Fhigh\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should call onChange when option is selected', async () => {\n    const user = userEvent.setup();\n    const onChange = vi.fn();\n    render(\u003CPrioritySelect onChange={onChange} \u002F>);\n\n    await user.click(screen.getByRole('combobox', { name: \u002Fpriority\u002Fi }));\n    await user.click(screen.getByRole('option', { name: \u002Fhigh\u002Fi }));\n\n    expect(onChange).toHaveBeenCalledWith('high');\n  });\n\n  it('should not allow selecting disabled options', async () => {\n    const user = userEvent.setup();\n    const onChange = vi.fn();\n    render(\u003CPrioritySelect onChange={onChange} \u002F>);\n\n    await user.click(screen.getByRole('combobox', { name: \u002Fpriority\u002Fi }));\n    const criticalOption = screen.getByRole('option', { name: \u002Fcritical\u002Fi });\n\n    expect(criticalOption).toHaveAttribute('aria-disabled', 'true');\n  });\n\n  it('should display selected value', () => {\n    render(\u003CPrioritySelect value=\"medium\" onChange={vi.fn()} \u002F>);\n\n    expect(screen.getByText('Medium')).toBeInTheDocument();\n  });\n\n  it('should support keyboard navigation', async () => {\n    const user = userEvent.setup();\n    const onChange = vi.fn();\n    render(\u003CPrioritySelect onChange={onChange} \u002F>);\n\n    \u002F\u002F Open with Enter\n    const trigger = screen.getByRole('combobox', { name: \u002Fpriority\u002Fi });\n    trigger.focus();\n    await user.keyboard('{Enter}');\n\n    \u002F\u002F Navigate with arrows and select with Enter\n    await user.keyboard('{ArrowDown}{ArrowDown}{Enter}');\n\n    expect(onChange).toHaveBeenCalled();\n  });\n});\n```\n\n## Form Testing with react-hook-form + zod\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fform.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform\u002Fresolvers\u002Fzod';\nimport { z } from 'zod';\nimport {\n  Form,\n  FormControl,\n  FormDescription,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from '@\u002Fcomponents\u002Fui\u002Fform';\nimport { Input } from '@\u002Fcomponents\u002Fui\u002Finput';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\n\nconst profileSchema = z.object({\n  username: z\n    .string()\n    .min(3, 'Username must be at least 3 characters')\n    .max(20, 'Username must be at most 20 characters')\n    .regex(\u002F^[a-zA-Z0-9_]+$\u002F, 'Username can only contain letters, numbers, and underscores'),\n  email: z.string().email('Please enter a valid email address'),\n  bio: z.string().max(160, 'Bio must be at most 160 characters').optional(),\n});\n\ntype ProfileFormValues = z.infer\u003Ctypeof profileSchema>;\n\nfunction ProfileForm({ onSubmit }: { onSubmit: (data: ProfileFormValues) => void }) {\n  const form = useForm\u003CProfileFormValues>({\n    resolver: zodResolver(profileSchema),\n    defaultValues: { username: '', email: '', bio: '' },\n  });\n\n  return (\n    \u003CForm {...form}>\n      \u003Cform onSubmit={form.handleSubmit(onSubmit)} data-testid=\"profile-form\">\n        \u003CFormField\n          control={form.control}\n          name=\"username\"\n          render={({ field }) => (\n            \u003CFormItem>\n              \u003CFormLabel>Username\u003C\u002FFormLabel>\n              \u003CFormControl>\n                \u003CInput placeholder=\"johndoe\" {...field} \u002F>\n              \u003C\u002FFormControl>\n              \u003CFormDescription>Your public display name.\u003C\u002FFormDescription>\n              \u003CFormMessage \u002F>\n            \u003C\u002FFormItem>\n          )}\n        \u002F>\n        \u003CFormField\n          control={form.control}\n          name=\"email\"\n          render={({ field }) => (\n            \u003CFormItem>\n              \u003CFormLabel>Email\u003C\u002FFormLabel>\n              \u003CFormControl>\n                \u003CInput type=\"email\" placeholder=\"john@example.com\" {...field} \u002F>\n              \u003C\u002FFormControl>\n              \u003CFormMessage \u002F>\n            \u003C\u002FFormItem>\n          )}\n        \u002F>\n        \u003CFormField\n          control={form.control}\n          name=\"bio\"\n          render={({ field }) => (\n            \u003CFormItem>\n              \u003CFormLabel>Bio\u003C\u002FFormLabel>\n              \u003CFormControl>\n                \u003CInput placeholder=\"Tell us about yourself\" {...field} \u002F>\n              \u003C\u002FFormControl>\n              \u003CFormMessage \u002F>\n            \u003C\u002FFormItem>\n          )}\n        \u002F>\n        \u003CButton type=\"submit\">Save\u003C\u002FButton>\n      \u003C\u002Fform>\n    \u003C\u002FForm>\n  );\n}\n\ndescribe('ProfileForm', () => {\n  it('should render all form fields', () => {\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    expect(screen.getByLabelText(\u002Fusername\u002Fi)).toBeInTheDocument();\n    expect(screen.getByLabelText(\u002Femail\u002Fi)).toBeInTheDocument();\n    expect(screen.getByLabelText(\u002Fbio\u002Fi)).toBeInTheDocument();\n    expect(screen.getByRole('button', { name: \u002Fsave\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should show validation errors for empty required fields', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fat least 3 characters\u002Fi)).toBeInTheDocument();\n      expect(screen.getByText(\u002Fvalid email\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should show validation error for short username', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'ab');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'valid@example.com');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fat least 3 characters\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should show validation error for invalid username characters', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'user name!');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'valid@example.com');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fonly contain letters, numbers\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should show validation error for invalid email', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'validuser');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'not-an-email');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fvalid email\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('should submit valid form data', async () => {\n    const user = userEvent.setup();\n    const onSubmit = vi.fn();\n    render(\u003CProfileForm onSubmit={onSubmit} \u002F>);\n\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'johndoe');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'john@example.com');\n    await user.type(screen.getByLabelText(\u002Fbio\u002Fi), 'Hello world');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(onSubmit).toHaveBeenCalledWith(\n        { username: 'johndoe', email: 'john@example.com', bio: 'Hello world' },\n        expect.anything()\n      );\n    });\n  });\n\n  it('should clear errors when valid input is provided', async () => {\n    const user = userEvent.setup();\n    render(\u003CProfileForm onSubmit={vi.fn()} \u002F>);\n\n    \u002F\u002F Trigger validation errors\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n    await waitFor(() => {\n      expect(screen.getByText(\u002Fat least 3 characters\u002Fi)).toBeInTheDocument();\n    });\n\n    \u002F\u002F Fix the error\n    await user.type(screen.getByLabelText(\u002Fusername\u002Fi), 'validuser');\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'valid@example.com');\n    await user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.queryByText(\u002Fat least 3 characters\u002Fi)).not.toBeInTheDocument();\n    });\n  });\n});\n```\n\n## DataTable Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fdata-table.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, within } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\n\n\u002F\u002F Assume a DataTable component built with @tanstack\u002Freact-table + shadcn\u002Fui\nimport { DataTable, columns } from '@\u002Fcomponents\u002Fdata-table';\n\nconst mockData = [\n  { id: '1', name: 'Alice', email: 'alice@example.com', role: 'admin', status: 'active' },\n  { id: '2', name: 'Bob', email: 'bob@example.com', role: 'user', status: 'active' },\n  { id: '3', name: 'Charlie', email: 'charlie@example.com', role: 'user', status: 'inactive' },\n  { id: '4', name: 'Diana', email: 'diana@example.com', role: 'admin', status: 'active' },\n  { id: '5', name: 'Eve', email: 'eve@example.com', role: 'user', status: 'active' },\n];\n\ndescribe('DataTable', () => {\n  it('should render all rows', () => {\n    render(\u003CDataTable columns={columns} data={mockData} \u002F>);\n\n    const rows = screen.getAllByRole('row');\n    \u002F\u002F Header row + 5 data rows\n    expect(rows).toHaveLength(6);\n  });\n\n  it('should render column headers', () => {\n    render(\u003CDataTable columns={columns} data={mockData} \u002F>);\n\n    expect(screen.getByRole('columnheader', { name: \u002Fname\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('columnheader', { name: \u002Femail\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('columnheader', { name: \u002Frole\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('columnheader', { name: \u002Fstatus\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should sort by column when header is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CDataTable columns={columns} data={mockData} \u002F>);\n\n    \u002F\u002F Click name column header to sort ascending\n    await user.click(screen.getByRole('columnheader', { name: \u002Fname\u002Fi }));\n\n    const rows = screen.getAllByRole('row').slice(1); \u002F\u002F Skip header\n    const names = rows.map((row) => within(row).getAllByRole('cell')[0].textContent);\n    expect(names).toEqual(['Alice', 'Bob', 'Charlie', 'Diana', 'Eve']);\n\n    \u002F\u002F Click again for descending\n    await user.click(screen.getByRole('columnheader', { name: \u002Fname\u002Fi }));\n\n    const rowsDesc = screen.getAllByRole('row').slice(1);\n    const namesDesc = rowsDesc.map((row) => within(row).getAllByRole('cell')[0].textContent);\n    expect(namesDesc).toEqual(['Eve', 'Diana', 'Charlie', 'Bob', 'Alice']);\n  });\n\n  it('should filter rows by search input', async () => {\n    const user = userEvent.setup();\n    render(\u003CDataTable columns={columns} data={mockData} searchColumn=\"name\" \u002F>);\n\n    const searchInput = screen.getByPlaceholderText(\u002Ffilter\u002Fi);\n    await user.type(searchInput, 'alice');\n\n    const rows = screen.getAllByRole('row').slice(1);\n    expect(rows).toHaveLength(1);\n    expect(within(rows[0]).getByText('Alice')).toBeInTheDocument();\n  });\n\n  it('should show empty state when no data matches', async () => {\n    const user = userEvent.setup();\n    render(\u003CDataTable columns={columns} data={mockData} searchColumn=\"name\" \u002F>);\n\n    const searchInput = screen.getByPlaceholderText(\u002Ffilter\u002Fi);\n    await user.type(searchInput, 'nonexistent');\n\n    expect(screen.getByText(\u002Fno results\u002Fi)).toBeInTheDocument();\n  });\n\n  it('should handle row selection with checkboxes', async () => {\n    const user = userEvent.setup();\n    const onSelectionChange = vi.fn();\n    render(\n      \u003CDataTable\n        columns={columns}\n        data={mockData}\n        enableSelection\n        onSelectionChange={onSelectionChange}\n      \u002F>\n    );\n\n    const checkboxes = screen.getAllByRole('checkbox');\n    \u002F\u002F First checkbox is \"select all\", rest are row checkboxes\n    expect(checkboxes).toHaveLength(6);\n\n    \u002F\u002F Select first row\n    await user.click(checkboxes[1]);\n    expect(onSelectionChange).toHaveBeenCalledWith(\n      expect.objectContaining({ '1': true })\n    );\n  });\n\n  it('should handle pagination', async () => {\n    const user = userEvent.setup();\n    const largeData = Array.from({ length: 25 }, (_, i) => ({\n      id: String(i),\n      name: `User ${i}`,\n      email: `user${i}@example.com`,\n      role: 'user',\n      status: 'active',\n    }));\n\n    render(\u003CDataTable columns={columns} data={largeData} pageSize={10} \u002F>);\n\n    \u002F\u002F First page should show 10 rows\n    const rows = screen.getAllByRole('row').slice(1);\n    expect(rows).toHaveLength(10);\n\n    \u002F\u002F Navigate to next page\n    const nextButton = screen.getByRole('button', { name: \u002Fnext\u002Fi });\n    await user.click(nextButton);\n\n    \u002F\u002F Second page should also show 10 rows\n    const page2Rows = screen.getAllByRole('row').slice(1);\n    expect(page2Rows).toHaveLength(10);\n  });\n});\n```\n\n## Command Palette (cmdk) Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Fcommand.test.tsx\nimport { describe, it, expect, vi } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  CommandDialog,\n  CommandInput,\n  CommandList,\n  CommandEmpty,\n  CommandGroup,\n  CommandItem,\n  CommandSeparator,\n} from '@\u002Fcomponents\u002Fui\u002Fcommand';\n\nfunction AppCommandPalette({\n  open,\n  onOpenChange,\n  onSelect,\n}: {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  onSelect: (value: string) => void;\n}) {\n  return (\n    \u003CCommandDialog open={open} onOpenChange={onOpenChange}>\n      \u003CCommandInput placeholder=\"Type a command or search...\" \u002F>\n      \u003CCommandList>\n        \u003CCommandEmpty>No results found.\u003C\u002FCommandEmpty>\n        \u003CCommandGroup heading=\"Pages\">\n          \u003CCommandItem onSelect={() => onSelect('\u002Fdashboard')}>Dashboard\u003C\u002FCommandItem>\n          \u003CCommandItem onSelect={() => onSelect('\u002Fsettings')}>Settings\u003C\u002FCommandItem>\n          \u003CCommandItem onSelect={() => onSelect('\u002Fprofile')}>Profile\u003C\u002FCommandItem>\n        \u003C\u002FCommandGroup>\n        \u003CCommandSeparator \u002F>\n        \u003CCommandGroup heading=\"Actions\">\n          \u003CCommandItem onSelect={() => onSelect('new-project')}>New Project\u003C\u002FCommandItem>\n          \u003CCommandItem onSelect={() => onSelect('new-team')}>New Team\u003C\u002FCommandItem>\n        \u003C\u002FCommandGroup>\n      \u003C\u002FCommandList>\n    \u003C\u002FCommandDialog>\n  );\n}\n\ndescribe('Command Palette', () => {\n  it('should render when open', () => {\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={vi.fn()} \u002F>\n    );\n\n    expect(screen.getByPlaceholderText(\u002Ftype a command\u002Fi)).toBeInTheDocument();\n    expect(screen.getByText('Dashboard')).toBeInTheDocument();\n    expect(screen.getByText('Settings')).toBeInTheDocument();\n  });\n\n  it('should filter items by search input', async () => {\n    const user = userEvent.setup();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={vi.fn()} \u002F>\n    );\n\n    await user.type(screen.getByPlaceholderText(\u002Ftype a command\u002Fi), 'dash');\n\n    expect(screen.getByText('Dashboard')).toBeInTheDocument();\n    expect(screen.queryByText('Settings')).not.toBeInTheDocument();\n    expect(screen.queryByText('Profile')).not.toBeInTheDocument();\n  });\n\n  it('should show empty state when nothing matches', async () => {\n    const user = userEvent.setup();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={vi.fn()} \u002F>\n    );\n\n    await user.type(screen.getByPlaceholderText(\u002Ftype a command\u002Fi), 'zzzzz');\n\n    expect(screen.getByText('No results found.')).toBeInTheDocument();\n  });\n\n  it('should call onSelect when item is clicked', async () => {\n    const user = userEvent.setup();\n    const onSelect = vi.fn();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={onSelect} \u002F>\n    );\n\n    await user.click(screen.getByText('Dashboard'));\n\n    expect(onSelect).toHaveBeenCalledWith('\u002Fdashboard');\n  });\n\n  it('should navigate with arrow keys and select with Enter', async () => {\n    const user = userEvent.setup();\n    const onSelect = vi.fn();\n    render(\n      \u003CAppCommandPalette open={true} onOpenChange={vi.fn()} onSelect={onSelect} \u002F>\n    );\n\n    const input = screen.getByPlaceholderText(\u002Ftype a command\u002Fi);\n    await user.click(input);\n    await user.keyboard('{ArrowDown}{ArrowDown}{Enter}');\n\n    expect(onSelect).toHaveBeenCalled();\n  });\n});\n```\n\n## Theme Switching Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Ftheme-switching.test.tsx\nimport { describe, it, expect } from 'vitest';\nimport { render, screen, waitFor } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport { Button } from '@\u002Fcomponents\u002Fui\u002Fbutton';\nimport { useTheme } from 'next-themes';\n\nfunction ThemeToggle() {\n  const { theme, setTheme } = useTheme();\n\n  return (\n    \u003CButton\n      variant=\"outline\"\n      onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}\n      aria-label={`Switch to ${theme === 'light' ? 'dark' : 'light'} mode`}\n    >\n      {theme === 'light' ? 'Dark Mode' : 'Light Mode'}\n    \u003C\u002FButton>\n  );\n}\n\ndescribe('Theme Switching', () => {\n  it('should render with light theme by default', () => {\n    render(\u003CThemeToggle \u002F>, { theme: 'light' });\n\n    expect(screen.getByRole('button', { name: \u002Fswitch to dark\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should render with dark theme when configured', () => {\n    render(\u003CThemeToggle \u002F>, { theme: 'dark' });\n\n    expect(screen.getByRole('button', { name: \u002Fswitch to light\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should toggle theme on button click', async () => {\n    const user = userEvent.setup();\n    render(\u003CThemeToggle \u002F>, { theme: 'light' });\n\n    await user.click(screen.getByRole('button', { name: \u002Fswitch to dark\u002Fi }));\n\n    await waitFor(() => {\n      expect(screen.getByRole('button', { name: \u002Fswitch to light\u002Fi })).toBeInTheDocument();\n    });\n  });\n\n  it('should apply correct CSS class to document', async () => {\n    const user = userEvent.setup();\n    render(\u003CThemeToggle \u002F>, { theme: 'light' });\n\n    await user.click(screen.getByRole('button', { name: \u002Fswitch to dark\u002Fi }));\n\n    await waitFor(() => {\n      expect(document.documentElement.classList.contains('dark')).toBe(true);\n    });\n  });\n});\n```\n\n## Accordion Testing\n\n```typescript\n\u002F\u002F src\u002Fcomponents\u002F__tests__\u002Faccordion.test.tsx\nimport { describe, it, expect } from 'vitest';\nimport { render, screen } from '..\u002Ftest-utils\u002Frender-with-providers';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport {\n  Accordion,\n  AccordionItem,\n  AccordionTrigger,\n  AccordionContent,\n} from '@\u002Fcomponents\u002Fui\u002Faccordion';\n\nfunction FAQ() {\n  return (\n    \u003CAccordion type=\"single\" collapsible>\n      \u003CAccordionItem value=\"item-1\">\n        \u003CAccordionTrigger>What is shadcn\u002Fui?\u003C\u002FAccordionTrigger>\n        \u003CAccordionContent>\n          A collection of reusable components built with Radix UI and Tailwind CSS.\n        \u003C\u002FAccordionContent>\n      \u003C\u002FAccordionItem>\n      \u003CAccordionItem value=\"item-2\">\n        \u003CAccordionTrigger>Is it accessible?\u003C\u002FAccordionTrigger>\n        \u003CAccordionContent>\n          Yes, it follows WAI-ARIA design patterns.\n        \u003C\u002FAccordionContent>\n      \u003C\u002FAccordionItem>\n    \u003C\u002FAccordion>\n  );\n}\n\ndescribe('Accordion', () => {\n  it('should render all triggers', () => {\n    render(\u003CFAQ \u002F>);\n\n    expect(screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi })).toBeInTheDocument();\n    expect(screen.getByRole('button', { name: \u002Fis it accessible\u002Fi })).toBeInTheDocument();\n  });\n\n  it('should expand content when trigger is clicked', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi }));\n\n    expect(screen.getByText(\u002Freusable components\u002Fi)).toBeVisible();\n  });\n\n  it('should collapse when clicking the same trigger again', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    const trigger = screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi });\n    await user.click(trigger);\n    expect(screen.getByText(\u002Freusable components\u002Fi)).toBeVisible();\n\n    await user.click(trigger);\n    \u002F\u002F Content should be hidden (aria-hidden or removed)\n    expect(trigger).toHaveAttribute('aria-expanded', 'false');\n  });\n\n  it('should close previous item when opening another (single mode)', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi }));\n    expect(screen.getByText(\u002Freusable components\u002Fi)).toBeVisible();\n\n    await user.click(screen.getByRole('button', { name: \u002Fis it accessible\u002Fi }));\n    expect(screen.getByText(\u002FWAI-ARIA\u002Fi)).toBeVisible();\n\n    \u002F\u002F First item should be collapsed\n    const firstTrigger = screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi });\n    expect(firstTrigger).toHaveAttribute('aria-expanded', 'false');\n  });\n\n  it('should support keyboard navigation', async () => {\n    const user = userEvent.setup();\n    render(\u003CFAQ \u002F>);\n\n    const firstTrigger = screen.getByRole('button', { name: \u002Fwhat is shadcn\u002Fi });\n    firstTrigger.focus();\n\n    \u002F\u002F Space should toggle\n    await user.keyboard(' ');\n    expect(firstTrigger).toHaveAttribute('aria-expanded', 'true');\n\n    \u002F\u002F Enter should also toggle\n    await user.keyboard('{Enter}');\n    expect(firstTrigger).toHaveAttribute('aria-expanded', 'false');\n  });\n});\n```\n\n## E2E Tests with Playwright\n\n```typescript\n\u002F\u002F e2e\u002Fcomponents.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\n\ntest.describe('shadcn\u002Fui Components E2E', () => {\n  test('dialog should open and close with keyboard', async ({ page }) => {\n    await page.goto('\u002Fcomponents\u002Fdialog-demo');\n\n    await page.getByRole('button', { name: \u002Fopen dialog\u002Fi }).click();\n    await expect(page.getByRole('dialog')).toBeVisible();\n\n    \u002F\u002F Close with Escape\n    await page.keyboard.press('Escape');\n    await expect(page.getByRole('dialog')).not.toBeVisible();\n  });\n\n  test('command palette should open with Cmd+K', async ({ page }) => {\n    await page.goto('\u002Fdashboard');\n\n    \u002F\u002F Open command palette with keyboard shortcut\n    await page.keyboard.press('Meta+k');\n    await expect(page.getByPlaceholder(\u002Ftype a command\u002Fi)).toBeVisible();\n\n    \u002F\u002F Search and select\n    await page.getByPlaceholder(\u002Ftype a command\u002Fi).fill('settings');\n    await page.keyboard.press('Enter');\n    await expect(page).toHaveURL(\u002F\\\u002Fsettings\u002F);\n  });\n\n  test('data table should sort and filter', async ({ page }) => {\n    await page.goto('\u002Fdashboard\u002Fusers');\n\n    \u002F\u002F Sort by name\n    await page.getByRole('columnheader', { name: \u002Fname\u002Fi }).click();\n    const firstRow = page.getByRole('row').nth(1);\n    await expect(firstRow.getByRole('cell').first()).toHaveText(\u002F^A\u002F);\n\n    \u002F\u002F Filter\n    await page.getByPlaceholder(\u002Ffilter\u002Fi).fill('admin');\n    const rows = page.getByRole('row');\n    await expect(rows).toHaveCount(3); \u002F\u002F Header + 2 admin rows\n  });\n\n  test('form should show validation errors and submit', async ({ page }) => {\n    await page.goto('\u002Fprofile\u002Fedit');\n\n    \u002F\u002F Submit empty form\n    await page.getByRole('button', { name: \u002Fsave\u002Fi }).click();\n    await expect(page.getByText(\u002Fat least 3 characters\u002Fi)).toBeVisible();\n\n    \u002F\u002F Fill valid data\n    await page.getByLabel(\u002Fusername\u002Fi).fill('testuser');\n    await page.getByLabel(\u002Femail\u002Fi).fill('test@example.com');\n    await page.getByRole('button', { name: \u002Fsave\u002Fi }).click();\n\n    await expect(page.getByText(\u002Fsaved successfully\u002Fi)).toBeVisible();\n  });\n});\n```\n\n## Best Practices\n\n1. **Use `getByRole` over `getByTestId`** -- Role queries test accessibility for free; test IDs skip it.\n2. **Always use `userEvent` over `fireEvent`** -- `userEvent` simulates real browser interactions including focus.\n3. **Wrap state changes in `waitFor`** -- Radix components use animations; state changes may be async.\n4. **Test portal-rendered content with `screen`** -- Dialogs and popovers render outside the component tree.\n5. **Run axe audits on interactive states** -- Test accessibility of both closed and open states.\n6. **Mock `next-themes` for predictable theme testing** -- Avoid relying on browser\u002FOS theme preferences.\n7. **Test disabled states explicitly** -- Verify that disabled buttons, inputs, and menu items are not interactive.\n8. **Use `within()` for scoped queries** -- When testing tables or lists, scope queries to a specific row or item.\n9. **Test the complete form lifecycle** -- Empty submit, validation errors, correction, successful submit.\n10. **Keep component tests focused** -- Test one component behavior per test; compose for integration tests.\n\n## Anti-Patterns to Avoid\n\n1. **Testing Radix internal state** -- Do not assert on `data-state` attributes; test visible behavior instead.\n2. **Using CSS selectors for queries** -- `querySelector('.shadcn-button')` is fragile; use ARIA roles.\n3. **Forgetting to wait for animations** -- Radix uses enter\u002Fexit animations; wrap assertions in `waitFor`.\n4. **Testing styled-component class names** -- Tailwind classes are implementation details; test visual output.\n5. **Skipping keyboard interaction tests** -- Many users rely on keyboard navigation; it must work.\n6. **Mocking Radix primitives** -- Never mock the component library; test the real components.\n7. **Testing only the open state** -- Verify that closed\u002Fcollapsed states also render correctly.\n8. **Ignoring focus management** -- After a dialog closes, focus should return to the trigger element.\n9. **Not testing with screen readers** -- Run automated ARIA checks and manual VoiceOver\u002FNVDA testing.\n10. **Hardcoding animation durations in tests** -- Use `waitFor` instead of `setTimeout` for animation timing.\n\n## Running Tests\n\n```bash\n# Run all component tests\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002F\n\n# Run a specific component test\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002Fdialog.test.tsx\n\n# Run with coverage\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002F --coverage\n\n# Watch mode for development\nnpx vitest watch src\u002Fcomponents\u002F__tests__\u002F\n\n# Run E2E tests\nnpx playwright test e2e\u002Fcomponents.spec.ts\n\n# Run E2E with UI mode\nnpx playwright test --ui\n\n# Run accessibility audit\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002F --reporter=verbose\n\n# Debug a failing test\nnpx vitest run src\u002Fcomponents\u002F__tests__\u002Fform.test.tsx --reporter=verbose\n```\n",{"name":5,"tags":24,"agents":33,"author":46,"domains":47,"license":15,"version":49,"languages":50,"frameworks":53,"description":7,"testingTypes":57},[25,26,27,28,29,30,31,32],"shadcn","radix-ui","component-testing","accessibility","dialog","form","data-table","tailwind",[34,35,36,37,38,39,40,41,42,43,44,45],"claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt","gemini-cli","amp","thetestingacademy",[48],"web","1.0.0",[51,52],"typescript","javascript",[54,55,56],"vitest","playwright","react-testing-library",[58,59,60,28],"unit","integration","e2e","main","eac438ea9216a7cb8a570cab803eb01eeafc6793","skills\u002Fqa\u002Fshadcn-component-testing","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m","https:\u002F\u002Fid-preview--d5bef06d-6c9e-4563-a3d4-a855b9d61610.lovable.app\u002F","Eu sou Antonio B. B. Ndombe \r\nEu sou um Pesquisador e desenvolvedor de sistema autonomia cognitivos, fundador de sistemas ODCs ( organismos digital conscientes)","2026-11-04 06:53:39",{"source":8,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"shadcn\u002Fui Component Testing\"",{"tool":75,"command":76},"bunx","bunx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"shadcn\u002Fui Component Testing\"",{"tool":78,"command":79},"pnpm","pnpm dlx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"shadcn\u002Fui Component Testing\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fshadcn-component-testing\u002FSKILL.md",true,[],[84,92,99,106,113,120],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7DASC6FSCJP49JZBSK0NY1Z","nemoclaw-user-reference","Describes the NemoClaw integration layer and blueprint architecture and how they orchestrate compatible agent sandboxes. Use when looking up architecture, agent integration, plugin structure, or blueprint design. Trigger keywords - nemoclaw architecture, nemoclaw agent architecture, nemoclaw plugin blueprint structure, nemoclaw vs openshell, which cli, nemoclaw cli, openshell cli, sandbox commands, nemoclaw cli commands, nemoclaw command reference, nemoclaw network policy, sandbox egress control operator approval, nemoclaw troubleshooting, nemoclaw debug sandbox issues.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-reference\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7DAS5S79VK33XFGVAM2TFWF","nemoclaw-user-overview","Explains how OpenClaw, OpenShell, and NemoClaw form the ecosystem, NemoClaw's position in the stack, what NemoClaw adds beyond the community sandbox, and when to prefer NemoClaw versus integrating OpenShell and OpenClaw directly. Use when users ask about the relationship between OpenClaw, OpenShell, and NemoClaw, or when to use NemoClaw versus OpenShell. Trigger keywords - nemoclaw ecosystem, openclaw openshell, nemoclaw vs openshell, sandboxed openclaw, how nemoclaw works, nemoclaw sandbox lifecycle blueprint, nemoclaw overview, openclaw always-on assistants, nvidia openshell, nvidia nemotron, nemoclaw release notes, nemoclaw changelog.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-overview\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M7DAS0PQEMET5MNGZ1ABSZVS","nemoclaw-user-monitor-sandbox","Inspects sandbox health, traces agent behavior, and diagnoses problems. Use when monitoring a running sandbox, debugging agent issues, or checking sandbox logs. Trigger keywords - monitor nemoclaw sandbox, debug nemoclaw agent issues.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-monitor-sandbox\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M7DARQYGF7E9A69VH6S3CGN9","nemoclaw-user-manage-sandboxes","Explains operational tasks after the quickstart: listing sandboxes, status and health checks, logs, diagnostics, port forwards, multiple sandboxes, credential reset, rebuilds, network presets, upgrades, and uninstall. Trigger keywords - manage nemoclaw sandboxes, nemoclaw status, nemoclaw list, nemoclaw dashboard port, nemoclaw rebuild, nemoclaw upgrade sandboxes, nemoclaw uninstall, sandbox mutability, sandbox runtime configuration, sandbox rebuild, nemoclaw backup, nemoclaw restore, workspace backup, openshell sandbox download upload, nemoclaw messaging channels, nemoclaw telegram, nemoclaw discord, nemoclaw slack, nemoclaw wechat, nemoclaw whatsapp, openshell channel messaging, nemoclaw workspace files, soul.md, user.md, identity.md, agents.md, sandbox persistence.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-sandboxes\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M7DARH8BRTG51TRCAB7YWDJ4","nemoclaw-user-manage-policy","Adds, removes, or modifies allowed endpoints in the sandbox policy. Use when customizing network policy, changing egress rules, or configuring sandbox endpoint access. Trigger keywords - customize nemoclaw network policy, sandbox egress policy configuration, nemoclaw integration policy examples, post-install policy setup, openshell approval workflow, policy preset, nemoclaw approve network requests, sandbox egress approval tui.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-policy\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M7DARAT62M2VR37590VCZ5NS","nemoclaw-user-get-started","Installs NemoClaw, launches a sandbox, and runs the first agent prompt. Use when onboarding, installing, or launching a NemoClaw sandbox for the first time. Trigger keywords - nemoclaw quickstart, install nemoclaw openclaw sandbox, nemohermes quickstart, hermes agent nemoclaw, run hermes openshell sandbox, nemoclaw prerequisites, nemoclaw supported platforms, nemoclaw hardware software, nemoclaw windows wsl2 setup, nemoclaw install windows docker desktop.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-get-started\u002FSKILL.md",[],[]]