UNPKG

@crossed/ui

Version:

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

55 lines (54 loc) 2.32 kB
import { jsx } from "react/jsx-runtime"; import { render } from "@crossed/test"; import { Layout } from "../Layout"; describe("Layout", () => { test("rend les enfants pass\xE9s en prop", () => { const { getByText } = render( /* @__PURE__ */ jsx( Layout, { footer: /* @__PURE__ */ jsx("div", { children: "Footer" }), showFooter: false, stickyFooter: false, children: /* @__PURE__ */ jsx("div", { children: "Contenu de Layout" }) } ) ); expect(getByText("Contenu de Layout")).toBeInTheDocument(); }); test("rend le footer lorsque showFooter est true et stickyFooter est true", () => { const { getByText } = render( /* @__PURE__ */ jsx(Layout, { footer: /* @__PURE__ */ jsx("div", { children: "Footer" }), showFooter: true, stickyFooter: true, children: /* @__PURE__ */ jsx("div", { children: "Contenu de Layout" }) }) ); expect(getByText("Footer")).toBeInTheDocument(); }); test("ne rend pas le footer lorsque showFooter est false", () => { const { queryByText } = render( /* @__PURE__ */ jsx(Layout, { footer: /* @__PURE__ */ jsx("div", { children: "Footer" }), showFooter: false, stickyFooter: true, children: /* @__PURE__ */ jsx("div", { children: "Contenu de Layout" }) }) ); expect(queryByText("Footer")).toBeNull(); }); test("ne rend pas le footer lorsque stickyFooter est false", () => { const { queryByText } = render( /* @__PURE__ */ jsx(Layout, { footer: /* @__PURE__ */ jsx("div", { children: "Footer" }), showFooter: true, stickyFooter: false, children: /* @__PURE__ */ jsx("div", { children: "Contenu de Layout" }) }) ); expect(queryByText("Footer")).toBeNull(); }); test("applique le style dynamique de paddingRight", () => { const { getByTestId } = render( /* @__PURE__ */ jsx( Layout, { footer: /* @__PURE__ */ jsx("div", { children: "Footer" }), showFooter: true, stickyFooter: true, paddingRight: 20, children: /* @__PURE__ */ jsx("div", { children: "Contenu de Layout" }) } ) ); const footerElement = getByTestId("stickyFooter"); expect(footerElement).toHaveStyle("padding-right: 20px"); }); }); //# sourceMappingURL=Layout.spec.js.map