"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = __toESM(require("react"));
var import_react2 = require("@testing-library/react");
var import__ = __toESM(require(".."));
var import_Theme = __toESM(require("../../Theme"));
jest.mock("../../hooks/useId", () => ({
  useId: () => "jest-id"
}));
const data = {
  label: "Checkbox Component",
  helper: "Helper Text"
};
const originalError = console.error;
beforeEach(() => {
  console.error = jest.fn();
});
afterEach(() => {
  console.error = originalError;
});
describe("<Checkbox />", () => {
  describe("Snapshots", () => {
    it("should match snapshot without props", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {}) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with default checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadValues({}, data)) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with disabled checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { disabled: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with checked checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { checked: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with disabled and checked checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { disabled: true, checked: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with error checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { error: "Error msg" })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with error and checked checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { error: "Error msg", checked: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with inverted", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { inverted: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with inverted and checked", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { inverted: true, checked: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with inverted and checked and disabled", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { inverted: true, checked: true, disabled: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with indeterminate", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { indeterminate: true }) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with indeterminate and disabled checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { indeterminate: true, disabled: true }) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with error and indeterminate checkbox", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { error: "Error msg", indeterminate: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with inverted and indeterminate", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { inverted: true, indeterminate: true })) })
      );
      expect(container).toMatchSnapshot();
    });
    it("should match snapshot with a given value", () => {
      const { container } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { value: "test_value" })) })
      );
      expect(container).toMatchSnapshot();
    });
  });
  describe("Events", () => {
    it("should call onChange function when press on Checkbox", () => {
      const onChangeMock = jest.fn();
      const { getByTestId } = (0, import_react2.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, __spreadProps(__spreadValues({}, data), { onChange: onChangeMock })) })
      );
      import_react2.fireEvent.click(getByTestId("checkbox-checkMark"));
      expect(onChangeMock).toHaveBeenCalled();
    });
  });
});
