/*
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 MultiValue from '../multi-value.js';
import { Tag } from '../../tag/index.js';
describe('Multi Value component', function () {
  test('renders Tag by default', function () {
    var props = {
      children: 'test'
    };
    var wrapper = mount(React.createElement(MultiValue, props));
    var renderedTag = wrapper.find(Tag).first();
    expect(renderedTag).toExist();
  });
  test('renders MultiValue', function () {
    var mock = jest.fn().mockImplementation(function () {
      return React.createElement("span", null);
    });
    var props = {
      children: 'test',
      removeValue: jest.fn(),
      overrides: {
        MultiValue: mock
      }
    };
    mount(React.createElement(MultiValue, props));
    expect(mock).toHaveBeenCalled();
    var passedProps = mock.mock.calls[0][0];
    expect(passedProps.onActionClick).toEqual(props.removeValue);
    expect(passedProps).toMatchSnapshot('passes correct props to an underlying component');
  });
});