import { jsx as _jsx } from "react/jsx-runtime";
import { render, screen } from "@testing-library/react";
import { FormMessage } from "./form-message.js";
describe("FormMessage", () => {
    it("should match snapshot", () => {
        const { asFragment } = render(_jsx(FormMessage, { children: "message" }));
        expect(asFragment()).toMatchSnapshot();
    });
    it("renders children correctly", () => {
        render(_jsx(FormMessage, { children: "Test message" }));
        expect(screen.getByText("Test message")).toBeInTheDocument();
    });
    it("applies correct classes for error type", () => {
        render(_jsx(FormMessage, { type: "error", children: "Error message" }));
        const message = screen.getByText("Error message");
        expect(message).toHaveClass("text-red-900");
    });
    it("applies correct classes for info type", () => {
        render(_jsx(FormMessage, { type: "info", children: "Info message" }));
        const message = screen.getByText("Info message");
        expect(message).toHaveClass("text-blue-900");
    });
    it("applies correct classes for warning type", () => {
        render(_jsx(FormMessage, { type: "warning", children: "Warning message" }));
        const message = screen.getByText("Warning message");
        expect(message).toHaveClass("text-yellow-900");
    });
    it("renders with custom props", () => {
        render(_jsx(FormMessage, { type: "info", role: "alert", children: "Info message" }));
        const message = screen.getByText("Info message");
        expect(message).toHaveAttribute("role", "alert");
    });
    it("renders without children", () => {
        render(_jsx(FormMessage, { type: "info", "data-testid": "form-message" }));
        expect(screen.getByTestId("form-message")).toBeEmptyDOMElement();
    });
    it("renders with custom element", () => {
        render(_jsx(FormMessage, { as: "span", children: "Custom element" }));
        const element = screen.getByText("Custom element");
        expect(element).toBeInTheDocument();
        expect(element.tagName).toBe("SPAN");
    });
    it("renders with custom className", () => {
        // this is a custom class name for testing purposes
        render(_jsx(FormMessage, { className: "custom-class", children: "Custom class" }));
        expect(screen.getByText("Custom class")).toHaveClass("custom-class");
    });
});
//# sourceMappingURL=form-message.test.js.map