import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { CloseButton } from './';
afterEach(cleanup);
test('should take a snapshot', () => {
const { asFragment } = render(
);
expect(asFragment()).toMatchSnapshot();
});
describe('tests the adjustable size props', () => {
test('renders a CloseButton with falsy size', () => {
const { getByTestId } = render(
);
expect(getByTestId('button-id')).toBeInTheDocument();
expect(getByTestId('button-id')).toHaveStyle({
height: '1rem',
width: '1rem',
});
});
test('renders a CloseButton with height and width', () => {
const { getByTestId } = render(
);
expect(getByTestId('button-id')).toBeInTheDocument();
expect(getByTestId('button-id')).toHaveStyle({
height: '3rem',
width: '3rem',
});
});
test('renders a CloseButton with min-height and min-width', () => {
const { getByTestId } = render(
);
expect(getByTestId('button-id')).toBeInTheDocument();
expect(getByTestId('button-id')).toHaveStyle({
'min-height': '3rem',
'min-width': '3rem',
});
});
test('renders a CloseButton with max-height and max-width', () => {
const { getByTestId } = render(
);
expect(getByTestId('button-id')).toBeInTheDocument();
expect(getByTestId('button-id')).toHaveStyle({
'max-height': '3rem',
'max-width': '3rem',
});
});
});