import { render, screen } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogTitle, } from "@/components/ui/dialog"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; describe("UI shape system", () => { it.each(["center", "bottom"] as const)("declares a scroll owner inside the %s modal boundary", (placement) => { render( Long dialog Content that can outgrow a keyboard-fitted frame. ); const dialog = screen.getByRole("dialog"); expect(dialog.parentElement).toHaveClass("items-start", placement === "bottom" ? "overflow-clip" : "overflow-y-auto"); if (placement === "bottom") expect(dialog).toHaveClass("overflow-y-auto"); // The scroll owner stays inside Radix's overlay/scroll-lock boundary. expect(dialog.parentElement?.parentElement).toHaveAttribute("data-state", "open"); expect(dialog).toHaveClass(placement === "bottom" ? "mt-auto" : "my-auto"); }); it("uses pill-shaped inputs and the shared radius for other controls", () => { render( <>