import React from 'react';
import { shallow } from 'enzyme';
import Button from './Button';
describe('Button', () => {
it('exists', () => {
expect(Button).toBeDefined();
});
it('basic', () => {
expect(shallow()).toMatchSnapshot();
});
it('#children', () => {
expect(shallow()).toMatchSnapshot();
});
it('#accessibleLabel', () => {
expect(shallow()).toMatchSnapshot();
});
it('#icon', () => {
expect(shallow()).toMatchSnapshot();
});
it('#target', () => {
expect(shallow()).toMatchSnapshot();
});
it('#multiple icons', () => {
expect(shallow()).toMatchSnapshot();
});
it('#icon changes with #isLoading', () => {
expect(shallow()).toMatchSnapshot();
});
it('is clickable', () => {
const onClick = jest.fn();
shallow().simulate('click', {
preventDefault() {},
stopPropagation() {},
});
expect(onClick).toHaveBeenCalledTimes(1);
});
it('dismisses clicks', () => {
const preventDefault = jest.fn();
shallow().simulate('click', {
preventDefault,
stopPropagation() {},
});
expect(preventDefault).toHaveBeenCalledTimes(1);
});
});