import * as React from 'react'; import { renderHook } from '@testing-library/react-hooks'; import { List } from '../index'; 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(
Item 1 Item 2 Item 1 Item 2 Item 1 Item 2
); expect(container.firstChild).toMatchSnapshot(); }); it('should render a basic list', () => { const { container } = render( Item One Item Two Item Three Item Four ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly as an ordered list', () => { const { container } = render( Item One Item Two Item Three Item Four ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly as a horizontal list', () => { const { container } = render( Item One Item Two Item Three Item Four ); 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 List props', () => { const { result } = renderHook(() => List.useProps()); expect(result.current).toMatchSnapshot(); }); }); describe('render props', () => { it('should render correctly', () => { const { container } = render({(ListProps) =>
Hello world
}
); expect(container.firstChild).toMatchSnapshot(); }); }); }); describe('overrides', () => { it('List.base should render correctly', () => { const { container } = render( hello world ); expect(container.firstChild).toMatchSnapshot(); }); }); describe('theming', () => { it('List.base should render correctly', () => { const { container } = render( Item One Item Two Item Three Item Four , { theme: { List: { styles: { base: { backgroundColor: 'red' } } } }, } ); expect(container.firstChild).toMatchSnapshot(); }); it('List.ordered should render correctly', () => { const { container } = render( Item One Item Two Item Three Item Four , { theme: { List: { styles: { ordered: { backgroundColor: 'red' } } } }, } ); expect(container.firstChild).toMatchSnapshot(); }); it('List.ordered should render correctly', () => { const { container } = render( Item One Item Two Item Three Item Four , { theme: { List: { styles: { horizontal: { backgroundColor: 'red' } } } }, } ); expect(container.firstChild).toMatchSnapshot(); }); it('List.Item.base should render correctly', () => { const { container } = render( Item One Item Two Item Three Item Four , { theme: { List: { Item: { styles: { base: { backgroundColor: 'red' } } } } }, } ); expect(container.firstChild).toMatchSnapshot(); }); }); describe('defaultProps', () => { it('should render correctly for isOrdered', () => { const { container } = render( Item One Item Two Item Three Item Four , { theme: { List: { defaultProps: { className: 'test', isOrdered: true } } }, } ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly for List.Item', () => { const { container } = render( Item One Item Two Item Three Item Four , { theme: { List: { Item: { defaultProps: { className: 'test' } } } }, } ); expect(container.firstChild).toMatchSnapshot(); }); });