import * as React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { Dialog } from '../index';
import render from '../../utils/_tests/render';
describe('props', () => {
it('should render correctly', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with CSS props', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with a title', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with a close button', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with action buttons', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with a footer', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
describe('type', () => {
['info', 'success', 'danger', 'warning'].forEach((type) => {
it(`should render correctly with type ${type}`, () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
});
});
it('should render correctly for standalone', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('composition', () => {
describe('as', () => {
it('should render correctly', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
});
describe('hook', () => {
it('should return with Dialog props', () => {
const { result } = renderHook(() => Dialog.useProps());
expect(result.current).toMatchSnapshot();
});
});
describe('render props', () => {
it('should render correctly', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
});
});
describe('overrides', () => {
it('Dialog.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Content.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Header.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Title.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Footer.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.IconWrapper.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Close.base should render correctly', () => {
const { container } = render(
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('theming', () => {
it('Dialog.base should render correctly', () => {
const { container } = render(, {
theme: { Dialog: { styles: { base: { backgroundColor: 'red' } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Content.base should render correctly', () => {
const { container } = render(, {
theme: { Dialog: { Content: { styles: { base: { backgroundColor: 'red' } } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Header.base should render correctly', () => {
const { container } = render(, {
theme: { Dialog: { Header: { styles: { base: { backgroundColor: 'red' } } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Title.base should render correctly', () => {
const { container } = render(, {
theme: { Dialog: { Title: { styles: { base: { backgroundColor: 'red' } } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Footer.base should render correctly', () => {
const { container } = render(, {
theme: { Dialog: { Footer: { styles: { base: { backgroundColor: 'red' } } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.IconWrapper.base should render correctly', () => {
const { container } = render(, {
theme: { Dialog: { IconWrapper: { styles: { base: { backgroundColor: 'red' } } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Dialog.Close.base should render correctly', () => {
const { container } = render(, {
theme: { Dialog: { Close: { styles: { base: { backgroundColor: 'red' } } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
});
describe('defaultProps', () => {
it('should render correctly for className', () => {
const { container } = render(, {
theme: { Dialog: { defaultProps: { className: 'test', color: 'primary' } } },
});
expect(container.firstChild).toMatchSnapshot();
});
});