feat(renderer): add shadcn dialog primitive

This commit is contained in:
2026-06-05 17:49:31 +05:30
parent a6fa14124d
commit 8f9dab1405
4 changed files with 244 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog';
describe('Dialog', () => {
it('opens on trigger click and shows content', async () => {
render(
<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent aria-describedby="d">
<DialogHeader>
<DialogTitle>Title</DialogTitle>
<DialogDescription id="d">Desc</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
);
await userEvent.click(screen.getByRole('button', { name: /open/i }));
expect(screen.getByRole('dialog')).toBeInTheDocument();
expect(screen.getByText(/title/i)).toBeInTheDocument();
});
});