/*
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.
*/
import React from 'react';
import { mount } from 'enzyme';
import { Component, StyledRoot } from '../index.js';
describe('Component', function () {
  test('basic click functionality', function () {
    var renderedRoot;
    var onClick = jest.fn();
    var wrapper = mount(React.createElement(Component, {
      onClick: onClick
    }));
    renderedRoot = wrapper.find(StyledRoot).first();
    expect(renderedRoot).toExist(); // pass new prop value set to false

    wrapper.setProps({
      prop: false
    });
    renderedRoot = wrapper.find(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.createElement("span", null, children);
      })
    };
    var wrapper = mount( // $FlowFixMe
    React.createElement(Component, {
      overrides: overrides
    }));
    var root = wrapper.find(overrides.Root);
    expect(root).toHaveLength(1);
  });
});