test: added test files for components/ui 10 test files (alert, aspect-ratio, button, calender, card, carousel, chart, checkbox, collapsible, pagination)
Description:
alert.test.tsx
This test file validates the Alert, AlertTitle, and AlertDescription UI components by checking rendering, variant styles, custom class application, semantic HTML structure, accessibility attributes, and ref forwarding.
button.test.tsx
Added unit tests for the Button component covering rendering, variants, sizes, asChild behavior, custom class names, ref forwarding, click handling, disabled state, and buttonVariants export usage.
card.test.tsx
Added unit tests for all exported Card components (Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter) covering rendering, default classes, custom class names, and ref forwarding.
carousel.test.tsx
Added comprehensive unit tests for the Carousel component and its subcomponents, covering rendering, orientation handling, keyboard interactions, API state changes, lifecycle events, error handling, and navigation button behavior.
aspect-ratio.test.tsx
Added unit tests for the AspectRatio component covering child rendering, custom ratio support, custom class names, and ref forwarding.
calendar.test.tsx
Added unit tests for the Calendar component covering rendering, custom class names, outside day handling, month navigation, and custom navigation icons.
chart.test.tsx
Added unit tests for ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, and ChartLegendContent covering rendering, provider validation, tooltip/legend behavior, config-based styling, fallback handling, and exported component references.
checkbox.test.tsx
Added unit tests for the Checkbox component covering rendering, checked/unchecked state changes, defaultChecked behavior, disabled state handling, custom class name merging, indicator rendering, callback execution, and ref forwarding.
collapsible.test.tsx
Added unit tests for the Collapsible, CollapsibleTrigger, and CollapsibleContent components covering rendering, toggle behavior, defaultOpen state, controlled open state, disabled state handling, callback execution, and asChild custom trigger support.
pagination.test.tsx
Added unit tests for the Pagination, PaginationContent, PaginationItem, PaginationLink, PaginationPrevious, PaginationNext, and PaginationEllipsis components covering rendering, active states, accessibility attributes, custom class merging, and ref forwarding.
Type of Change:
-
Bug Fix -
Feature Development -
Documentation
Testing:
-
Tested on desktop -
Tested on mobile -
Tested in different browsers
Screenshots (if applicable):
Checklist:
-
Code follows project style guidelines -
Self-review completed -
No console errors -
TypeScript types are correct
*Closes #268 (closed)