"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _enzyme = require("enzyme");

var _ = _interopRequireDefault(require("."));

describe('Input', function () {
  it('displays an input', function () {
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      id: "some-input"
    }));
    expect(node.getDOMNode().classList).toContain('Input');
  });
  it('displays a large input', function () {
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      size: "lg"
    }));
    expect(node.find('input').hasClass('Input_lg')).toBe(true);
  });
  it('should call the onChange handler', function () {
    var onChangeMock = jest.fn();
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      onChange: onChangeMock,
      value: "hello"
    }));
    expect(node.state().value).toBe('hello');
    node.find('input').simulate('change', {
      target: {
        value: 'test'
      }
    });
    expect(onChangeMock).toHaveBeenCalled();
  });
});