"use strict";

var _jsxRuntime = require("react/jsx-runtime");

var _enzyme = require("enzyme");

var _RangePicker = require("../RangePicker");

var _PickerModule = _interopRequireDefault(require("../../internal/Picker/Picker.module.css"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var decrement = function decrement(picker) {
  return picker.find(".".concat(_PickerModule["default"].itemDecrement)).first().simulate('click');
};

var increment = function increment(picker) {
  return picker.find(".".concat(_PickerModule["default"].itemIncrement)).first().simulate('click');
};

describe('RangePicker Specs', function () {
  test('should render a single child with the current value', function () {
    var picker = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_RangePicker.RangePicker, {
      min: -10,
      max: 20,
      value: 10
    }));
    var expected = '10';
    var actual = picker.find('.active').first().text();
    expect(actual).toBe(expected);
  });
  test('should increase by step amount on increment press', function () {
    var picker = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_RangePicker.RangePicker, {
      defaultValue: 10,
      min: 0,
      max: 100,
      noAnimation: true,
      step: 1
    }));
    increment(picker);
    var expected = '11';
    var actual = picker.find('.active').first().text();
    expect(actual).toBe(expected);
  });
  test('should decrease by step amount on decrement press', function () {
    var picker = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_RangePicker.RangePicker, {
      defaultValue: 10,
      min: 0,
      max: 100,
      noAnimation: true,
      step: 1
    }));
    decrement(picker);
    var expected = '9';
    var actual = picker.find('.active').first().text();
    expect(actual).toBe(expected);
  });
  test('should be disabled when limited to a single value', function () {
    var picker = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_RangePicker.RangePickerBase, {
      min: 0,
      max: 0,
      value: 0
    }));
    var actual = picker.find('Picker').last().prop('disabled');
    expect(actual).toBe(true);
  });
});