UNPKG

@uva-glass/component-library

Version:

React components UvA

52 lines (51 loc) 2.52 kB
import { jsx as l } from "react/jsx-runtime"; import "../../index-dmBn99rF.js"; import { r as n, s as t } from "../../react.esm-CMg7bmSn.js"; import { CheckboxButton as a } from "./CheckboxButton.js"; const c = jest.fn(); describe("CheckboxButton", () => { it("should render", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(); }), it("should be checked if clicked", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(), e.click(), expect(e).toBeChecked(), expect(c).toHaveBeenCalledTimes(1); }), it("should be disabled", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c, disabled: !0 })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(), expect(e).toBeDisabled(); }), it("should show noValid", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c, notValid: !0 })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(); const o = t.getByText("2.1"); expect(o).toHaveClass("checkbox-button--not-valid"); }), it("should render single variant", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c, notValid: !0 })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(); const o = t.getByText("2.1"); expect(o).toHaveClass("checkbox-button--single"); }), it("should render start variant", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c, notValid: !0, variant: "start" })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(); const o = t.getByText("2.1"); expect(o).toHaveClass("checkbox-button--start"); }), it("should render middle variant", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c, notValid: !0, variant: "middle" })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(); const o = t.getByText("2.1"); expect(o).toHaveClass("checkbox-button--middle"); }), it("should render end variant", () => { n(/* @__PURE__ */ l(a, { label: "2.1", value: "4", onSetValue: c, notValid: !0, variant: "end" })); const e = t.getByRole("checkbox"); expect(e).toBeInTheDocument(); const o = t.getByText("2.1"); expect(o).toHaveClass("checkbox-button--end"); }); }); //# sourceMappingURL=CheckboxButton.test.js.map