"use strict";

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

var _enzyme = require("enzyme");

var _Button = _interopRequireDefault(require("../Button"));

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

describe('Button Specs', function () {
  test('should have \'disabled\' HTML attribute when \'disabled\' prop is provided', function () {
    var button = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
      disabled: true,
      children: "I am a disabled Button"
    }));
    var expected = true;
    var actual = button.find('div').at(0).prop('disabled');
    expect(actual).toBe(expected);
  });
  describe('events', function () {
    test('should call onClick when not disabled', function () {
      var handleClick = jest.fn();
      var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
        onClick: handleClick,
        children: "I am a disabled Button"
      }));
      subject.simulate('click');
      var expected = 1;
      var actual = handleClick.mock.calls.length;
      expect(actual).toBe(expected);
    });
    test('should not call onClick when disabled', function () {
      var handleClick = jest.fn();
      var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
        disabled: true,
        onClick: handleClick,
        children: "I am a disabled Button"
      }));
      subject.simulate('click');
      var expected = 0;
      var actual = handleClick.mock.calls.length;
      expect(actual).toBe(expected);
    });
  });
});