"use strict";

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

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

var _enzyme = require("enzyme");

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

var options = [{
  label: 'Choose Amount',
  disabled: true,
  value: ''
}, {
  label: '1 Owl',
  value: 1
}, {
  label: '2 Owls',
  value: 2
}, {
  label: '3 Owls',
  value: 3
}];
describe('Select', function () {
  it('displays the <Select> element', function () {
    var node = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      options: options
    }));
    expect(node.hasClass('Select')).toBe(true);
  });
  it('displays a large <Select>', function () {
    var node = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      options: options,
      size: "lg"
    }));
    expect(node.find('select').hasClass('Select-Input_lg')).toBe(true);
  });
  it('displays an initial value <Select>', function () {
    var node = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      options: options,
      value: 1
    }));
    expect(node.find('select').prop('value')).toBe(1);
  });
  it('displays a disabled <Select>', function () {
    var node = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_["default"], {
      disabled: true,
      options: options
    }));
    expect(node.find('select').prop('disabled')).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,
      options: options
    }));
    node.find('select').simulate('change', {
      target: {
        value: 'test'
      }
    });
    expect(onChangeMock).toHaveBeenCalled();
  });
});