"use strict";

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

var _enzyme = require("enzyme");

var _index = require("../index.js");

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

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

    var overrides = {
      Label: CustomLabel
    };
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_index.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');
  });
});