"use strict";

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _index = _interopRequireDefault(require("../index"));

var _mountTest = _interopRequireDefault(require("../../../tests/shared/mountTest"));

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

describe('Button', function () {
  (0, _mountTest.default)(_index.default);
  (0, _mountTest.default)(function () {
    return /*#__PURE__*/_react.default.createElement(_index.default, {
      type: "primary"
    });
  });
  it('renders correctly', function () {
    expect( /*#__PURE__*/_react.default.createElement(_index.default, null)).toMatchRenderedSnapshot();
  });
  it('mount correctly', function () {
    expect(function () {
      return (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_index.default, null));
    }).not.toThrow();
  });
  it('should render empty button without errors', function () {
    var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_index.default, null, null, undefined));
    expect(wrapper.render()).toMatchSnapshot();
  });
  it('should simulate click event', function () {
    var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_index.default, null));
    expect(wrapper.simulate('click').length).toEqual(1);
  });
  it('should not emit click event when disabled', function () {
    var onClick = jest.fn();
    var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_index.default, {
      disabled: true,
      onClick: onClick
    }));
    wrapper.simulate('click');
    expect(onClick).not.toHaveBeenCalled();
  });
  it('should hide border when color is gradient', function () {
    var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_index.default, {
      color: "linear-gradient(#000, #fff)"
    }));
    expect(wrapper.getDOMNode().style.border).toEqual('0px');
  });
  it('should change icon class prefix when using icon-prefix prop', function () {
    var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_index.default, {
      icon: "success"
    }));
    expect(wrapper.html()).toMatchSnapshot();
  });
});