"use strict";

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _index = require("../index");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/*
Copyright (c) 2018 Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
describe('Component', function () {
  test('basic click functionality', function () {
    var renderedRoot;
    var onClick = jest.fn();
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_index.Component, {
      onClick: onClick
    }));
    renderedRoot = wrapper.find(_index.StyledRoot).first();
    expect(renderedRoot).toExist(); // pass new prop value set to false

    wrapper.setProps({
      prop: false
    });
    renderedRoot = wrapper.find(_index.StyledRoot).first();
    expect(renderedRoot.props().$prop).toBe(false);
  });
  test('component overrides', function () {
    var overrides = {
      Root: jest.fn().mockImplementation(function (_ref) {
        var children = _ref.children;
        return _react.default.createElement("span", null, children);
      })
    };
    var wrapper = (0, _enzyme.mount)( // $FlowFixMe
    _react.default.createElement(_index.Component, {
      overrides: overrides
    }));
    var root = wrapper.find(overrides.Root);
    expect(root).toHaveLength(1);
  });
});