"use strict";

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

var _enzyme = require("enzyme");

var _WindDirectionControl = _interopRequireDefault(require("../WindDirectionControl"));

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

describe('WindDirectionControl Specs', function () {
  test('should change value when clicking on the second arc segment', function () {
    var handleChange = jest.fn();
    var windDirectionControl = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_WindDirectionControl["default"], {
      onChange: handleChange
    })); // find second Arc and click on it

    windDirectionControl.find('Arc').at(1).find('path').at(1).simulate('click');
    var expected = 'airRight';
    var actual = handleChange.mock.calls[0][0].value;
    expect(actual).toBe(expected);
  });
  test('should change value when clicking on the third arc segment', function () {
    var handleChange = jest.fn();
    var windDirectionControl = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_WindDirectionControl["default"], {
      onChange: handleChange
    })); // find third Arc and click on it

    windDirectionControl.find('Arc').at(2).find('path').at(1).simulate('click');
    var expected = 'airUp';
    var actual = handleChange.mock.calls[0][0].value;
    expect(actual).toBe(expected);
  });
  test('should change value when clicking on the first arc segment', function () {
    var handleChange = jest.fn(); // initiate WindDirectionControl with second arc selected

    var windDirectionControl = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_WindDirectionControl["default"], {
      value: "airRight",
      onChange: handleChange
    })); // find first Arc and click on it

    windDirectionControl.find('Arc').at(0).find('path').at(1).simulate('click');
    var expected = 'airDown';
    var actual = handleChange.mock.calls[0][0].value;
    expect(actual).toBe(expected);
  });
  test('should not call onChange handler when disabled', function () {
    var handleChange = jest.fn();
    var windDirectionControl = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_WindDirectionControl["default"], {
      disabled: true,
      onChange: handleChange
    })); // find second Arc and click on the third <path> element inside of it

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