/*
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 SingleValue from '../value.js';
import { StyledSingleValue } from '../styled-components.js';
describe('Single Value component', function () {
  test('renders StyledSingleValue', function () {
    var props = {
      children: 'test'
    };
    var wrapper = mount(React.createElement(SingleValue, props));
    var renderedStyledComponent = wrapper.find(StyledSingleValue).first();
    expect(renderedStyledComponent).toExist();
    expect(renderedStyledComponent.props()).toMatchObject({
      'aria-selected': 'true',
      children: 'test',
      role: 'option'
    });
  });
  test('renders custom SingleValue', function () {
    var mock = jest.fn().mockImplementation(function () {
      return React.createElement("span", null);
    });
    var props = {
      children: 'test',
      overrides: {
        SingleValue: mock
      }
    };
    mount(React.createElement(SingleValue, props));
    expect(mock).toHaveBeenCalled();
    var passedProps = mock.mock.calls[0][0];
    expect(passedProps).toMatchObject({
      'aria-selected': 'true',
      children: 'test',
      role: 'option'
    });
  });
});