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; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

/*
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 AutosizeInput from '../autosize-input.js';
import { StyledInput, StyledInputSizer } from '../styled-components.js';
describe('AutosizeInput component', function () {
  var props = {
    value: 'test',
    id: 'test-id'
  };
  var ref = React.createRef();
  test('renders correctly', function () {
    // $FlowFixMe
    var wrapper = mount(React.createElement(AutosizeInput, _extends({}, props, {
      inputRef: ref
    })));
    var renderedInput = wrapper.find(StyledInput).first();
    var renderedSizer = wrapper.find(StyledInputSizer).first();
    expect(renderedInput).toExist();
    expect(renderedInput.props()).toMatchObject(_objectSpread({
      $width: '5px'
    }, props, {
      $ref: ref
    }));
    expect(renderedSizer).toExist();
    expect(renderedSizer.props()).toMatchObject({
      children: props.value,
      $ref: wrapper.instance().sizerRef
    });
  });
  test('had correct initial state', function () {
    var props = {
      value: 'test'
    }; // $FlowFixMe

    var wrapper = mount(React.createElement(AutosizeInput, props));
    expect(wrapper.state().inputWidth).toEqual(5);
  });
});