"use strict";

var _react = _interopRequireDefault(require("react"));
var _reactNative = require("@testing-library/react-native");
var _themeContext = require("./theme/src/theme-context");
var _pearl = require("./pearl");
var _reactNative2 = require("react-native");
var _index = require("./theme/src/base/index");
var _box = _interopRequireDefault(require("./components/atoms/box/box"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
jest.useFakeTimers();
describe("pearl/basic", () => {
  const PearlViewComponent = ({
    children,
    ...props
  }) => {
    const PearlView = (0, _pearl.pearl)(_reactNative2.View, {
      componentName: "TestView",
      type: "basic"
    });
    return /*#__PURE__*/_react.default.createElement(PearlView, props, children);
  };
  const PearlTextComponent = ({
    children,
    ...props
  }) => {
    const PearlText = (0, _pearl.pearl)(_reactNative2.Text, {
      componentName: "TestText",
      type: "basic"
    });
    return /*#__PURE__*/_react.default.createElement(PearlText, props, children);
  };
  it("passes the snapshot test for a <View> component", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(PearlViewComponent, null))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for a <Text> component", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(PearlTextComponent, null, "asdasd"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
});
describe("pearl/atoms", () => {
  const newTheme = (0, _index.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 = (0, _pearl.pearl)(_reactNative2.View, {
      componentName: "TestView",
      type: "atom"
    });
    return /*#__PURE__*/_react.default.createElement(PearlView, props, children);
  };
  const PearlTextComponent = ({
    children,
    ...props
  }) => {
    const PearlText = (0, _pearl.pearl)(_reactNative2.Text, {
      componentName: "TestText",
      type: "atom"
    });
    return /*#__PURE__*/_react.default.createElement(PearlText, props, children);
  };
  it("passes the snapshot test for a <View> component", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, {
      theme: newTheme
    }, /*#__PURE__*/_react.default.createElement(PearlViewComponent, null))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for a <Text> component", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, {
      theme: newTheme
    }, /*#__PURE__*/_react.default.createElement(PearlTextComponent, null, "asdasd"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
});
describe("pearl/molecules", () => {
  const newTheme = (0, _index.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.default.createElement(_box.default, props.root, /*#__PURE__*/_react.default.createElement(_box.default, props.box1), /*#__PURE__*/_react.default.createElement(_box.default, props.box2));
    };
    const PearlView = (0, _pearl.pearl)(MoleculeRender, {
      componentName: "TestView",
      type: "molecule"
    });
    return /*#__PURE__*/_react.default.createElement(PearlView, props, children);
  };
  it("passes the snapshot test for a <View> component", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, {
      theme: newTheme
    }, /*#__PURE__*/_react.default.createElement(PearlViewComponent, null))).toJSON();
    expect(tree).toMatchSnapshot();
  });
});
//# sourceMappingURL=pearl.spec.js.map