import React from "react";
import { render } from "@testing-library/react-native";
import { ThemeProvider } from "./theme/src/theme-context";
import { pearl } from "./pearl";
import { Text, View } from "react-native";
import { extendTheme } from "./theme/src/base/index";
import Box from "./components/atoms/box/box";
jest.useFakeTimers();
describe("pearl/basic", () => {
  const PearlViewComponent = ({
    children,
    ...props
  }) => {
    const PearlView = pearl(View, {
      componentName: "TestView",
      type: "basic"
    });
    return /*#__PURE__*/React.createElement(PearlView, props, children);
  };
  const PearlTextComponent = ({
    children,
    ...props
  }) => {
    const PearlText = pearl(Text, {
      componentName: "TestText",
      type: "basic"
    });
    return /*#__PURE__*/React.createElement(PearlText, props, children);
  };
  it("passes the snapshot test for a <View> component", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(PearlViewComponent, null))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for a <Text> component", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(PearlTextComponent, null, "asdasd"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
});
describe("pearl/atoms", () => {
  const newTheme = extendTheme({
    components: {
      TestView: {
        baseStyle: {
          width: 200,
          height: 200,
          backgroundColor: "danger.400",
          boxShadow: "4xl"
        }
      },
      TestText: {
        baseStyle: {
          color: "success.400",
          fontFamily: "body",
          fontWeight: "hairline"
        }
      }
    }
  });
  const PearlViewComponent = ({
    children,
    ...props
  }) => {
    const PearlView = pearl(View, {
      componentName: "TestView",
      type: "atom"
    });
    return /*#__PURE__*/React.createElement(PearlView, props, children);
  };
  const PearlTextComponent = ({
    children,
    ...props
  }) => {
    const PearlText = pearl(Text, {
      componentName: "TestText",
      type: "atom"
    });
    return /*#__PURE__*/React.createElement(PearlText, props, children);
  };
  it("passes the snapshot test for a <View> component", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, {
      theme: newTheme
    }, /*#__PURE__*/React.createElement(PearlViewComponent, null))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for a <Text> component", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, {
      theme: newTheme
    }, /*#__PURE__*/React.createElement(PearlTextComponent, null, "asdasd"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
});
describe("pearl/molecules", () => {
  const newTheme = extendTheme({
    components: {
      TestView: {
        parts: ["root", "box1", "box2"],
        baseStyle: {
          root: {
            width: 200,
            height: 200,
            backgroundColor: "danger.400",
            boxShadow: "4xl",
            p: "4xl"
          },
          box1: {
            width: 50,
            height: 50,
            backgroundColor: "success.500"
          }
        }
      }
    }
  });
  const PearlViewComponent = ({
    children,
    ...props
  }) => {
    const MoleculeRender = props => {
      return /*#__PURE__*/React.createElement(Box, props.root, /*#__PURE__*/React.createElement(Box, props.box1), /*#__PURE__*/React.createElement(Box, props.box2));
    };
    const PearlView = pearl(MoleculeRender, {
      componentName: "TestView",
      type: "molecule"
    });
    return /*#__PURE__*/React.createElement(PearlView, props, children);
  };
  it("passes the snapshot test for a <View> component", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, {
      theme: newTheme
    }, /*#__PURE__*/React.createElement(PearlViewComponent, null))).toJSON();
    expect(tree).toMatchSnapshot();
  });
});
//# sourceMappingURL=pearl.spec.js.map