import * as React from 'react' import renderWithTheme from '../../tests/helpers/renderWithTheme' import FileInputField from './FileInputField' describe('component: FileInputField', (): void => { test('should render field validation messages', () => { const { getByText, rerender } = renderWithTheme( ) const successMsg = getByText('Mirror mirror on the wall') expect(successMsg).toBeInTheDocument() rerender( ) const warningMsg = getByText("Who's the boolest of them all?") expect(warningMsg).toBeInTheDocument() rerender( ) const errorMsg = getByText("My boy's the boolest of them all") expect(errorMsg).toBeInTheDocument() }) test('should support margin space props', (): void => { const { container } = renderWithTheme( <> ) const blank = { marginTop: '', marginRight: '', marginBottom: '', marginLeft: '' } const first = container.firstElementChild expect(first).toHaveStyle(blank) expect(first?.nextElementSibling).toHaveStyle({ ...blank, marginTop: '16px', marginBottom: '4px', }) expect(first?.nextElementSibling?.nextElementSibling).toHaveStyle({ ...blank, marginTop: '2px', }) }) test('should support flex item props', () => { const { container } = renderWithTheme( ) expect(container.firstElementChild).toHaveStyle('flex: 1') expect(container.firstElementChild).toHaveStyle('flex-grow: 1') expect(container.firstElementChild).toHaveStyle('flex-shrink: 0') expect(container.firstElementChild).toHaveStyle('flex-basis: 0') }) })