"use strict";

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

var _enzyme = require("enzyme");

var _ArcPicker = _interopRequireDefault(require("../ArcPicker"));

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

describe('ArcPicker Specs', function () {
  test('should change value when clicking on a certain arc segment', function () {
    var handleChange = jest.fn();
    var arcPicker = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArcPicker["default"], {
      onChange: handleChange,
      children: [1, 2, 3, 4]
    })); // find second Arc and click on the second <path> element inside of it

    arcPicker.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 the second <path> element inside of it

    arcPicker.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);
  });
  test('should not run the onChange handler when disabled', function () {
    var handleChange = jest.fn();
    var arcPicker = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArcPicker["default"], {
      disabled: true,
      onChange: handleChange,
      children: [1, 2, 3, 4]
    })); // find second Arc and click on the second <path> element inside of it

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