function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return 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.
*/
import React from 'react';
import { mount } from 'enzyme';
import { ListItem } from '../styled-components.js';
import OptionList from '../option-list.js';
var mockItem = {
  label: 'item1'
};

function getSharedProps() {
  return {
    item: mockItem,
    getItemLabel: function getItemLabel(item) {
      return item.label;
    }
  };
}

describe('Option List Stateless Component', function () {
  test('basic renders', function () {
    var component = mount(React.createElement(OptionList, getSharedProps()));
    expect(component.find(ListItem)).toExist();
    expect(component.find(ListItem).first().text()).toEqual(mockItem.label);
  });
  test('renders with components overrides', function () {
    var NewListItem = function NewListItem() {
      return React.createElement("div", {
        id: "list-item"
      });
    };

    var props = _objectSpread({}, getSharedProps(), {
      overrides: {
        ListItem: {
          component: NewListItem,
          props: {
            custom: 'prop'
          }
        }
      }
    });

    var component = mount(React.createElement(OptionList, props));
    expect(component.find(ListItem)).not.toExist();
    expect(component.find(NewListItem)).toExist();
    expect(component.find(NewListItem).prop('custom')).toEqual('prop');
  });
});