/*
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 { List, StyledItem } from '../index.js';
describe('List', function () {
  //$FlowFixMe
  console.warn = jest.fn(); // eslint-disable-line

  test('basic render', function () {
    var wrapper = mount(React.createElement(List, {
      items: ['Item 1', 'Item 2'],
      onChange: jest.fn()
    }));
    expect(wrapper.find(StyledItem)).toHaveLength(2);
  });
  test('label override', function () {
    var CustomLabel = function CustomLabel(_ref) {
      var children = _ref.children;
      return React.createElement("span", null, "Child: ", children);
    };

    var overrides = {
      Label: CustomLabel
    };
    var wrapper = mount(React.createElement(List, {
      items: ['Item 1', 'Item 2'],
      onChange: jest.fn(),
      overrides: overrides
    }));
    expect(wrapper.find(overrides.Label).at(0).text()).toBe('Child: Item 1');
    expect(wrapper.find(overrides.Label).at(1).text()).toBe('Child: Item 2');
  });
});