summaryrefslogtreecommitdiff
path: root/src/components/ui/card.test.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ui/card.test.tsx')
-rw-r--r--src/components/ui/card.test.tsx40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/components/ui/card.test.tsx b/src/components/ui/card.test.tsx
new file mode 100644
index 0000000..aba3d00
--- /dev/null
+++ b/src/components/ui/card.test.tsx
@@ -0,0 +1,40 @@
+import { render, screen } from '@testing-library/react';
+import { describe, expect, test } from 'vitest';
+import {
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+} from './card';
+
+describe('Card', () => {
+ test('renders all card slots', () => {
+ render(
+ <Card>
+ <CardHeader>
+ <CardTitle>Card Title</CardTitle>
+ <CardDescription>Card Description</CardDescription>
+ <CardAction>Action</CardAction>
+ </CardHeader>
+ <CardContent>Content</CardContent>
+ <CardFooter>Footer</CardFooter>
+ </Card>,
+ );
+
+ expect(screen.getByText('Card Title')).toHaveAttribute(
+ 'data-slot',
+ 'card-title',
+ );
+ expect(screen.getByText('Card Description')).toHaveAttribute(
+ 'data-slot',
+ 'card-description',
+ );
+ expect(screen.getByText('Action')).toHaveAttribute('data-slot', 'card-action');
+ expect(screen.getByText('Content')).toHaveAttribute('data-slot', 'card-content');
+ expect(screen.getByText('Footer')).toHaveAttribute('data-slot', 'card-footer');
+ });
+});
+