"use strict";

var _react = _interopRequireDefault(require("react"));
var _text = _interopRequireDefault(require("../../components/atoms/text/text"));
var _reactNative = require("@testing-library/react-native");
var _themeContext = require("../../theme/src/theme-context");
var _box = _interopRequireDefault(require("../../components/atoms/box/box"));
var _useStyleProps = require("../useStyleProps");
var _styleFunctions = require("../../theme/src/style-functions");
var _typeHelpers = require("../../theme/utils/type-helpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
jest.useFakeTimers();
const TestComponent = props => {
  const rest = (0, _useStyleProps.useStyleProps)(props.object, _styleFunctions.allStyleFunctions);
  return /*#__PURE__*/_react.default.createElement(_box.default, rest, /*#__PURE__*/_react.default.createElement(_text.default, null, (0, _typeHelpers.getKeys)(rest.style).length));
};
describe("useStyleProps", () => {
  it("return empty style object for missing props", () => {
    const comp = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(TestComponent, {
      object: null
    })));
    const tree = comp.toJSON();
    expect(tree).toMatchSnapshot();
    expect(comp.getByText("0")).toBeTruthy();
  });
  it("return correct style object for props", () => {
    const comp = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(TestComponent, {
      object: {
        backgroundColor: "pink",
        p: "0.75"
      }
    })));
    const tree = comp.toJSON();
    expect(tree).toMatchSnapshot();
    expect(comp.getByText("2")).toBeTruthy();
  });
});
//# sourceMappingURL=useStyledProps.spec.js.map