"use strict";

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

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

var _enzyme = require("enzyme");

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

describe('TextArea', function () {
  it('displays a TextArea', function () {
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], null));
    expect(node.find('textarea').hasClass('TextArea')).toBe(true);
  });
  it('TextArea resizes horizontally and vertically', function () {
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      resize: "both"
    }));
    expect(node.find('textarea').hasClass('TextArea_both')).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('textarea').simulate('change', {
      target: {
        value: 'world'
      }
    });
    expect(onChangeMock).toHaveBeenCalled();
  });
});