import { jsx as ___EmotionJSX } from "@emotion/core";
import React from 'react';
import { mount } from 'enzyme';
import renderer from 'react-test-renderer';
import CameraIcon from '../../svgs/icons/camera-icon.svg';
import Button from './index';
describe('<Button />', function () {
  describe('UI snapshots', function () {
    it('renders with props', function () {
      var tree = renderer.create(___EmotionJSX(Button, {
        disabled: true,
        onClick: function onClick() {},
        icon: ___EmotionJSX(CameraIcon, null)
      }, "Button Text")).toJSON();
      expect(tree).toMatchSnapshot();
    });
  });
  describe('onClick callback', function () {
    it('should be invoked onClick', function () {
      var spy = jest.fn();
      var button = mount(___EmotionJSX(Button, {
        onClick: spy
      }, "Button Text"));
      button.simulate('click');
      expect(spy).toHaveBeenCalled();
    });
    it('should not be invoked if disabled', function () {
      var spy = jest.fn();
      var button = mount(___EmotionJSX(Button, {
        disabled: true,
        onClick: spy
      }, "Button Text"));
      button.simulate('click');
      expect(spy).not.toHaveBeenCalled();
    });
    it('should not be invoked if loading', function () {
      var spy = jest.fn();
      var button = mount(___EmotionJSX(Button, {
        loading: true,
        onClick: spy
      }, "Button Text"));
      button.simulate('click');
      expect(spy).not.toHaveBeenCalled();
    });
  });
});