import { expectTypeOf } from "vitest"; import { ModalProps } from "./types"; test("ModalProps works as intended", () => { expectTypeOf({ header: { heading: "Label" }, children: "OK", }).toMatchTypeOf(); expectTypeOf({ header: { heading: "Label" }, "aria-label": "Label", children: "OK", }).toMatchTypeOf(); expectTypeOf({ header: { heading: "Label" }, "aria-labelledby": "Label", children: "OK", }).toMatchTypeOf(); expectTypeOf({ "aria-label": "Label", children: "OK", }).toMatchTypeOf(); expectTypeOf({ "aria-labelledby": "Label", children: "OK", }).toMatchTypeOf(); expectTypeOf({ "aria-label": "Label", open: true, onClose: () => null, children: "OK", }).toMatchTypeOf(); expectTypeOf({ children: "Mangler label", }).not.toMatchTypeOf(); expectTypeOf({ open: true, children: "Mangler onClose eller label", }).not.toMatchTypeOf(); expectTypeOf({ open: true, "aria-label": "Label", children: "Mangler onClose", }).not.toMatchTypeOf(); expectTypeOf({ open: true, onClose: () => null, children: "Mangler label", }).not.toMatchTypeOf(); expectTypeOf({ header: { heading: "Label" }, open: true, children: "Mangler onClose", }).not.toMatchTypeOf(); expectTypeOf({ header: { heading: "Label" }, "aria-label": "Label", "aria-labelledby": "Label", children: "For mange labels", }).not.toMatchTypeOf(); expectTypeOf({ "aria-label": "Label", "aria-labelledby": "Label", children: "For mange labels", }).not.toMatchTypeOf(); });