import * as React from 'react' import renderWithTheme from '../../tests/helpers/renderWithTheme' import List from './List' describe('component: List', () => { test('should render all items', () => { const { getByText } = renderWithTheme( List Item 1 List Item 2 List Item 3 ) expect(getByText('List Item 1')).toBeInTheDocument() expect(getByText('List Item 2')).toBeInTheDocument() expect(getByText('List Item 3')).toBeInTheDocument() }) test('should indent nested lists by 24px', () => { const { getByTestId } = renderWithTheme( Indented 24px I am not indented further But I am ) expect(getByTestId('level-2-nested')).toHaveStyle('margin-left: 24px') expect(getByTestId('level-3-nested')).toHaveStyle('margin-left: 24px') }) test('should be able to set headers', () => { const { getByText } = renderWithTheme( I am a headerI am the content ) expect(getByText('I am a header')).toHaveStyle('font-weight: 600') }) test('should be able to render headers as other elements', () => { const { getByText } = renderWithTheme( I am an h3 headerI am the content ) const header = getByText('I am an h3 header') expect(header.tagName).toBe('H3') }) test('should support flex item props', () => { const { getByTestId } = renderWithTheme( List Item 1 List Item 2 List Item 3 ) const list = getByTestId('flex-list') expect(list).toHaveStyle('flex: 1') expect(list).toHaveStyle('flex-grow: 1') expect(list).toHaveStyle('flex-shrink: 0') expect(list).toHaveStyle('flex-basis: 0') }) })