"use strict";

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

var _enzyme = require("enzyme");

var _value = _interopRequireDefault(require("../value"));

var _styledComponents = require("../styled-components");

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('Single Value component', function () {
  test('renders StyledSingleValue', function () {
    var props = {
      children: 'test'
    };
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_value.default, props));
    var renderedStyledComponent = wrapper.find(_styledComponents.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.default.createElement("span", null);
    });
    var props = {
      children: 'test',
      overrides: {
        SingleValue: mock
      }
    };
    (0, _enzyme.mount)(_react.default.createElement(_value.default, props));
    expect(mock).toHaveBeenCalled();
    var passedProps = mock.mock.calls[0][0];
    expect(passedProps).toMatchObject({
      'aria-selected': 'true',
      children: 'test',
      role: 'option'
    });
  });
});