text: "use strict";
  
  var _react = _interopRequireDefault(require("react"));
  
  var _enzyme = require("enzyme");
  
  var _MonthSelect = _interopRequireDefault(require("../MonthSelect"));
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": 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); }
  
  /* eslint-disable comma-dangle */
  describe('MonthSelect', function () {
    var defaultProps = {
      className: 'className',
      onChange: function onChange() {}
    };
    it('renders a select', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], defaultProps));
      var select = component.find('select');
      var options = select.find('option');
      expect(select).toHaveLength(1);
      expect(options).toHaveLength(13); // 12 months + empty option
    });
    it('applies given aria-label properly', function () {
      var monthAriaLabel = 'Month';
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        monthAriaLabel: monthAriaLabel
      })));
      var select = component.find('select');
      expect(select.prop('aria-label')).toBe(monthAriaLabel);
    });
    it('has proper name defined', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], defaultProps));
      var select = component.find('select');
      expect(select.prop('name')).toBe('month');
    });
    it('has proper className defined', function () {
      var className = 'react-date-picker';
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        className: className
      })));
      var select = component.find('select');
      expect(select.hasClass('react-date-picker__input')).toBe(true);
      expect(select.hasClass('react-date-picker__month')).toBe(true);
    });
    it('displays given value properly', function () {
      var value = 11;
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        value: value
      })));
      var select = component.find('select');
      expect(select.prop('value')).toBe(value);
    });
    it('does not disable select by default', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], defaultProps));
      var select = component.find('select');
      expect(select.prop('disabled')).toBeFalsy();
    });
    it('disables select given disabled flag', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        disabled: true
      })));
      var select = component.find('select');
      expect(select.prop('disabled')).toBeTruthy();
    });
    it('is not required select by default', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], defaultProps));
      var select = component.find('select');
      expect(select.prop('required')).toBeFalsy();
    });
    it('required select given required flag', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        required: true
      })));
      var select = component.find('select');
      expect(select.prop('required')).toBeTruthy();
    });
    it('calls itemRef properly', function () {
      var itemRef = jest.fn();
      (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        itemRef: itemRef
      })));
      expect(itemRef).toHaveBeenCalled();
      expect(itemRef).toHaveBeenCalledWith(expect.any(HTMLSelectElement), 'month');
    });
    it('has all options enabled by default', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], defaultProps));
      var select = component.find('select');
      var options = select.find('option');
      options.forEach(function (option) {
        expect(option.prop('disabled')).toBeFalsy();
      });
    });
    it('has all options enabled given minDate in a past year', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        year: 2018,
        minDate: new Date(2017, 6, 1)
      })));
      var select = component.find('select');
      var options = select.find('option[value]');
      options.forEach(function (option) {
        expect(option.prop('disabled')).toBeFalsy();
      });
    });
    it('has first (month in minDate) options disabled given minDate in a current year', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        year: 2018,
        minDate: new Date(2018, 6, 1)
      })));
      var select = component.find('select');
      var options = select.find('option').slice(1); // Getting rid of "--" option
      // January - June
  
      options.slice(0, 6).forEach(function (option) {
        expect(option.prop('disabled')).toBeTruthy();
      }); // July - December
  
      options.slice(6).forEach(function (option) {
        expect(option.prop('disabled')).toBeFalsy();
      });
    });
    it('has all options enabled given maxDate in a future year', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        year: 2018,
        maxDate: new Date(2019, 6, 1)
      })));
      var select = component.find('select');
      var options = select.find('option').slice(1); // Getting rid of "--" option
  
      options.forEach(function (option) {
        expect(option.prop('disabled')).toBeFalsy();
      });
    });
    it('has last (month in maxDate) options disabled given maxDate in a current year', function () {
      var component = (0, _enzyme.mount)(_react["default"].createElement(_MonthSelect["default"], _extends({}, defaultProps, {
        year: 2018,
        maxDate: new Date(2018, 6, 1)
      })));
      var select = component.find('select');
      var options = select.find('option').slice(1); // Getting rid of "--" option
      // January - July
  
      options.slice(0, 7).forEach(function (option) {
        expect(option.prop('disabled')).toBeFalsy();
      }); // August - December
  
      options.slice(7).forEach(function (option) {
        expect(option.prop('disabled')).toBeTruthy();
      });
    });
  });