"use strict";

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

var _enzyme = require("enzyme");

var _multiValue = _interopRequireDefault(require("../multi-value"));

var _tag = require("../../tag");

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('Multi Value component', function () {
  test('renders Tag by default', function () {
    var props = {
      children: 'test'
    };
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_multiValue.default, props));
    var renderedTag = wrapper.find(_tag.Tag).first();
    expect(renderedTag).toExist();
  });
  test('renders MultiValue', function () {
    var mock = jest.fn().mockImplementation(function () {
      return _react.default.createElement("span", null);
    });
    var props = {
      children: 'test',
      removeValue: jest.fn(),
      overrides: {
        MultiValue: mock
      }
    };
    (0, _enzyme.mount)(_react.default.createElement(_multiValue.default, props));
    expect(mock).toHaveBeenCalled();
    var passedProps = mock.mock.calls[0][0];
    expect(passedProps.onActionClick).toEqual(props.removeValue);
    expect(passedProps).toMatchSnapshot('passes corect props to an underlying component');
  });
});