import { jsx as _jsx } from "react/jsx-runtime";
import { fireEvent, render, screen } from "@testing-library/react";
import { it, vi } from "vitest";
import { Modal } from "./modal.js";
describe("Modal Component", () => {
    it("should match snapshot", () => {
        render(_jsx(Modal, { "data-testid": "modal", open: true, children: _jsx("div", { children: "Modal Content" }) }));
        const modalComponent = screen.getByTestId("modal");
        expect(modalComponent).toMatchSnapshot();
    });
    it("should display modal content when open", () => {
        render(_jsx(Modal, { open: true, children: _jsx("div", { children: "Modal Content" }) }));
        expect(screen.getByText("Modal Content")).toBeInTheDocument();
    });
    it("should call onClose callback when press esc", () => {
        const onClose = vi.fn();
        render(_jsx(Modal, { onOpenChange: onClose, open: true, children: _jsx("div", { children: "Modal Content" }) }));
        fireEvent.keyDown(screen.getByText("Modal Content"), {
            key: "Escape",
            code: "Escape",
        });
        expect(onClose).toHaveBeenCalled();
    });
});
//# sourceMappingURL=modal.test.js.map