import * as React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { Container } from '../Container';
import render from '../../utils/_tests/render';
describe('props', () => {
it('should render correctly', () => {
const { container } = render(Hello world);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with CSS props', () => {
const { container } = render(Hello world);
expect(container.firstChild).toMatchSnapshot();
});
describe('alignment', () => {
it('renders correctly for a left aligned container', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
it('renders correctly for a center aligned container', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
it('renders correctly for a right aligned container', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('fixed width', () => {
it('renders correctly when breakpoint is fullHD', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
it('renders correctly when breakpoint is widescreen', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
it('renders correctly when breakpoint is desktop', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
it('renders correctly when breakpoint is tablet', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
it('renders correctly when breakpoint is mobile', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('fluid', () => {
it('renders correctly for a fluid container', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('layout', () => {
it('renders correctly for a layout container', () => {
const { container } = render(test);
expect(container.firstChild).toMatchSnapshot();
});
});
});
describe('composition', () => {
describe('as', () => {
it('should render correctly', () => {
const { container } = render(Hello world);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('hook', () => {
it('should return with Container props', () => {
const { result } = renderHook(() => Container.useProps());
expect(result.current).toMatchSnapshot();
});
});
describe('render props', () => {
it('should render correctly', () => {
const { container } = render(
{(ContainerProps) => Hello world
}
);
expect(container.firstChild).toMatchSnapshot();
});
});
});
describe('overrides', () => {
it('Container.base should render correctly', () => {
const { container } = render(
hello world
);
expect(container.firstChild).toMatchSnapshot();
});
it('Container.fluid should render correctly', () => {
const { container } = render(
hello world
);
expect(container.firstChild).toMatchSnapshot();
});
it('Container.layout should render correctly', () => {
const { container } = render(
hello world
);
expect(container.firstChild).toMatchSnapshot();
});
it('Container.fluidMargin should render correctly', () => {
const { container } = render(
hello world
);
expect(container.firstChild).toMatchSnapshot();
});
it('Container.tabletMargin should render correctly', () => {
const { container } = render(
hello world
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('theming', () => {
it('Container.base should render correctly', () => {
const { container } = render(hello world, {
theme: { Container: { styles: { base: { backgroundColor: 'red' } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Container.fluid should render correctly', () => {
const { container } = render(hello world, {
theme: { Container: { styles: { fluid: { backgroundColor: 'red' } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Container.layout should render correctly', () => {
const { container } = render(hello world, {
theme: { Container: { styles: { layout: { backgroundColor: 'red' } } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Container.fluidMargin should render correctly', () => {
const { container } = render(hello world, {
theme: { Container: { fluidMargin: 3 } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('Container.tabletMargin should render correctly', () => {
const { container } = render(hello world, {
theme: { Container: { tabletMargin: 5 } },
});
expect(container.firstChild).toMatchSnapshot();
});
});
describe('defaultProps', () => {
it('should render correctly for className', () => {
const { container } = render(hello world, {
theme: { Container: { defaultProps: { className: 'test' } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly for breakpoint', () => {
const { container } = render(hello world, {
theme: { Container: { defaultProps: { breakpoint: 'desktop' } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly for isFluid', () => {
const { container } = render(hello world, {
theme: { Container: { defaultProps: { isFluid: true } } },
});
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly for isLayout', () => {
const { container } = render(hello world, {
theme: { Container: { defaultProps: { isLayout: true } } },
});
expect(container.firstChild).toMatchSnapshot();
});
});