import React from 'react';
import { mount } from 'enzyme';
import Button from '../index';
import mountTest from '../../../tests/shared/mountTest';
describe('Button', function () {
  mountTest(Button);
  mountTest(function () {
    return /*#__PURE__*/React.createElement(Button, {
      type: "primary"
    });
  });
  it('renders correctly', function () {
    expect( /*#__PURE__*/React.createElement(Button, null)).toMatchRenderedSnapshot();
  });
  it('mount correctly', function () {
    expect(function () {
      return mount( /*#__PURE__*/React.createElement(Button, null));
    }).not.toThrow();
  });
  it('should render empty button without errors', function () {
    var wrapper = mount( /*#__PURE__*/React.createElement(Button, null, null, undefined));
    expect(wrapper.render()).toMatchSnapshot();
  });
  it('should simulate click event', function () {
    var wrapper = mount( /*#__PURE__*/React.createElement(Button, null));
    expect(wrapper.simulate('click').length).toEqual(1);
  });
  it('should not emit click event when disabled', function () {
    var onClick = jest.fn();
    var wrapper = mount( /*#__PURE__*/React.createElement(Button, {
      disabled: true,
      onClick: onClick
    }));
    wrapper.simulate('click');
    expect(onClick).not.toHaveBeenCalled();
  });
  it('should hide border when color is gradient', function () {
    var wrapper = mount( /*#__PURE__*/React.createElement(Button, {
      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 = mount( /*#__PURE__*/React.createElement(Button, {
      icon: "success"
    }));
    expect(wrapper.html()).toMatchSnapshot();
  });
});