"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_react_native2 = require("react-native");
var import_Theme = __toESM(require("../../Theme"));
var import__ = __toESM(require(".."));
const data = [
  { key: "Devin" },
  { key: "Dan" },
  { key: "Dominic" },
  { key: "Jackson" },
  { key: "James" },
  { key: "Joel" },
  { key: "John" },
  { key: "Jillian" },
  { key: "Jimmy" },
  { key: "Julie" }
];
describe("<List />", () => {
  describe("Snapshots", () => {
    describe("Without props", () => {
      it("should match snapshot with a default list", () => {
        const { toJSON } = (0, import_react_native.render)(
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
            import__.default,
            {
              data,
              renderItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { children: item.key }) })
            }
          ) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should match snapshot with a small list", () => {
        const { toJSON } = (0, import_react_native.render)(
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
            import__.default,
            {
              data,
              renderItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Item, { small: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { children: item.key }) })
            }
          ) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should match snapshot with a list without divisors", () => {
        const { toJSON } = (0, import_react_native.render)(
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
            import__.default,
            {
              data,
              renderItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Item, { divided: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { children: item.key }) })
            }
          ) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should match snapshot with a horizontal list", () => {
        const { toJSON } = (0, import_react_native.render)(
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
            import__.default,
            {
              horizontal: true,
              data,
              renderItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { children: item.key }) })
            }
          ) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should call onPress when selectable item is pressed", () => {
        const a = { key: "Devin", onPress: jest.fn() };
        const { getByText } = (0, import_react_native.render)(
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
            import__.default,
            {
              data: [a],
              renderItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Item, { onPress: item.onPress, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { children: item.key }) })
            }
          ) })
        );
        const selectableItem = getByText(a.key);
        import_react_native.fireEvent.press(selectableItem);
        expect(a.onPress).toHaveBeenCalled();
      });
    });
  });
});
