UNPKG

@uva-glass/component-library

Version:

React components UvA

68 lines (67 loc) 3.34 kB
import { jsxs as s, jsx as e } from "react/jsx-runtime"; import "../../index-dmBn99rF.js"; import { r as n, s as t, f as c } from "../../react.esm-DI5ilWeT.js"; import { BrowserRouter as u, Routes as a, Route as d } from "react-router"; import { LinkButton as o } from "./LinkButton.js"; const r = ({ children: i }) => /* @__PURE__ */ s(u, { children: [ /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(d, { path: "/", element: /* @__PURE__ */ e("div", { children: "Test route" }) }) }), i ] }); describe("LinkButton", () => { it("should render", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "primary", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(); }), it("should render primary", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "primary", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(), expect(t.getByText("Test LinkButton")).toHaveClass("button--primary"); }), it("should render secondary", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "secondary", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(), expect(t.getByText("Test LinkButton")).toHaveClass("button--secondary"); }), it("should render destructive-primary", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "destructive-primary", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(), expect(t.getByText("Test LinkButton")).toHaveClass("button--destructive-primary"); }), it("should render destructive-secondary", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "destructive-secondary", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(), expect(t.getByText("Test LinkButton")).toHaveClass("button--destructive-secondary"); }), it("should render blank", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "blank", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(), expect(t.getByText("Test LinkButton")).toHaveClass("button--blank"); }), it("should render blank-subtle", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "blank-subtle", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(), expect(t.getByText("Test LinkButton")).toHaveClass("button--blank-subtle"); }), it("should render blank-icon", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "blank-icon", to: "/", children: "Test LinkButton" }) }) ), expect(t.getByText("Test LinkButton")).toBeInTheDocument(), expect(t.getByText("Test LinkButton")).toHaveClass("button--blank-icon"); }), it("should goto route when clicked", () => { n( r({ children: /* @__PURE__ */ e(o, { variant: "primary", to: "/", children: "Test LinkButton" }) }) ), c.click(t.getByText("Test LinkButton")), expect(t.getByText("Test route")).toBeInTheDocument(); }); }); //# sourceMappingURL=LinkButton.test.js.map