"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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_react_native = require("@testing-library/react-native");
var import__ = __toESM(require(".."));
var import_Theme = __toESM(require("../../Theme"));
describe("<RadioGroup />", () => {
  describe("Snapshots", () => {
    it("should match snapshot with radio button as children", () => {
      const { root, getAllByText, toJSON } = (0, import_react_native.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.default, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 1" }),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 2" }),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 3" })
        ] }) })
      );
      expect(toJSON(root)).toMatchSnapshot();
      expect(getAllByText(/^Option/)).toHaveLength(3);
    });
    it("should match snapshot with small radios", () => {
      const { root, toJSON } = (0, import_react_native.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.default, { small: true, children: [
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 1" }),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 2" }),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 3" })
        ] }) })
      );
      expect(toJSON(root)).toMatchSnapshot();
    });
    it("should has setted the selected value", () => {
      const { toJSON, getByText } = (0, import_react_native.render)(
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.default, { selectedValue: "Option 2", children: [
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 1" }),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 2" }),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 3" })
        ] }) })
      );
      expect(toJSON()).toMatchSnapshot();
      expect(getByText("Option 2").props.checked).toBe(true);
    });
  });
});
describe("Events", () => {
  it("should set the onchange for its children", () => {
    const onChangeMock = jest.fn();
    const { getByText } = (0, import_react_native.render)(
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.default, { onChange: onChangeMock, children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 1" }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 2" }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Button, { children: "Option 3" })
      ] }) })
    );
    const firstOption = getByText("Option 1");
    import_react_native.fireEvent.press(firstOption);
    expect(onChangeMock).toHaveBeenCalled();
  });
});
