import React from 'react' import { render, fireEvent } from '@toptal/picasso-test-utils' import { Button } from '@toptal/picasso-button' import type { Props as FormProps } from '../Form' import { FormCompound as Form } from '../FormCompound' import type { Props as InputProps } from './Input' type TestFormProps = Pick & Pick const renderForm = (props: TestFormProps) => { const { onFocus, onSubmit } = props return render(
) } describe('Input', () => { it('fires the onFocus callback after focusing the input', () => { const handleFocus = jest.fn() const { getByPlaceholderText } = renderForm({ onSubmit: () => {}, onFocus: handleFocus, }) fireEvent.focus(getByPlaceholderText('test input')) expect(handleFocus).toHaveBeenCalled() }) })