UNPKG

@crossed/ui

Version:

A universal & performant styling library for React Native, Next.js & React

33 lines (32 loc) 927 B
import { jsx } from "react/jsx-runtime"; import { render, screen } from "@crossed/test"; import { FloatingOverlay } from "../Overlay"; import { FloatingProvider } from "../context"; describe("Floating.Overlay", () => { const mount = async (open) => { expect(FloatingOverlay.displayName).toEqual("Floating.Overlay"); render( /* @__PURE__ */ jsx( FloatingProvider, { onClose: () => { }, onOpen: () => { }, open: open ?? false, removeScroll: false, children: /* @__PURE__ */ jsx(FloatingOverlay, { animatedProps: { testID: "trigger" } }) } ) ); }; test("hide", async () => { mount(); expect(() => screen.getByTestId("trigger")).toThrow(); }); test("open", async () => { mount(true); expect(screen.getByTestId("trigger")).toBeTruthy(); }); }); //# sourceMappingURL=Overlay.spec.js.map