"use strict";

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

var _enzyme = require("enzyme");

var _FanSpeedControl = _interopRequireDefault(require("../FanSpeedControl"));

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

describe('FanSpeedControl Specs', function () {
  test('should change value when clicking on a certain arc segment', function () {
    var handleChange = jest.fn();
    var fanSpeedControl = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_FanSpeedControl["default"], {
      onChange: handleChange,
      min: 1,
      max: 10
    })); // find second Arc and click on it

    fanSpeedControl.find('Arc').at(1).find('path').at(1).simulate('click');
    var expected = 2;
    var actual = handleChange.mock.calls[0][0].value;
    expect(actual).toBe(expected); // find fourth Arc and click on it

    fanSpeedControl.find('Arc').at(3).find('path').at(1).simulate('click');
    var secondExpected = 4;
    var secondActual = handleChange.mock.calls[1][0].value;
    expect(secondActual).toBe(secondExpected); // find tenth Arc and click on it

    fanSpeedControl.find('Arc').at(9).find('path').at(1).simulate('click');
    var thirdExpected = 10;
    var thirdActual = handleChange.mock.calls[2][0].value;
    expect(thirdActual).toBe(thirdExpected);
  });
  test('should not call onChange handler when disabled', function () {
    var handleChange = jest.fn();
    var fanSpeedControl = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_FanSpeedControl["default"], {
      disabled: true,
      onChange: handleChange,
      min: 1,
      max: 10
    })); // find second Arc and click on it

    fanSpeedControl.find('Arc').at(1).find('path').at(1).simulate('click');
    var expected = 0;
    var actual = handleChange.mock.calls.length;
    expect(actual).toBe(expected);
  });
});