"use strict";

var _react = require("@testing-library/react");
var _FanSpeedControl = _interopRequireDefault(require("../FanSpeedControl"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
describe('FanSpeedControl Specs', function () {
  test('should change value when navigating to certain arc segment', function () {
    var handleChange = jest.fn();
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_FanSpeedControl["default"], {
      max: 10,
      min: 1,
      onChange: handleChange
    }));
    var arcPicker = _react.screen.getByRole('slider');
    _react.fireEvent.keyDown(arcPicker.children.item(1).children.item(0), {
      keyCode: 38
    });
    _react.fireEvent.keyDown(arcPicker.children.item(1).children.item(0), {
      keyCode: 38
    });
    var expected = 3;
    var actual = handleChange.mock.calls[1][0].value;
    expect(actual).toBe(expected);
    _react.fireEvent.keyDown(arcPicker.children.item(1).children.item(0), {
      keyCode: 38
    });
    _react.fireEvent.keyDown(arcPicker.children.item(1).children.item(0), {
      keyCode: 38
    });
    _react.fireEvent.keyDown(arcPicker.children.item(1).children.item(0), {
      keyCode: 38
    });
    var secondExpected = 6;
    var secondActual = handleChange.mock.calls[4][0].value;
    expect(secondActual).toBe(secondExpected);
  });
  test('should not call onChange handler when disabled', function () {
    var handleChange = jest.fn();
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_FanSpeedControl["default"], {
      disabled: true,
      max: 10,
      min: 1,
      onChange: handleChange
    }));
    var arcPicker = _react.screen.getByRole('slider');
    _react.fireEvent.keyDown(arcPicker.children.item(1).children.item(0), {
      keyCode: 38
    });
    expect(handleChange).not.toHaveBeenCalled();
  });
});