()
| 28 | |
| 29 | it('supports server validation errors', async () => { |
| 30 | function Test() { |
| 31 | let [serverErrors, setServerErrors] = React.useState({}); |
| 32 | let onSubmit = e => { |
| 33 | e.preventDefault(); |
| 34 | setServerErrors({ |
| 35 | name: 'Invalid name.' |
| 36 | }); |
| 37 | }; |
| 38 | |
| 39 | return ( |
| 40 | <Form data-testid="form" onSubmit={onSubmit} validationErrors={serverErrors}> |
| 41 | <TextField name="name"> |
| 42 | <Label>Name</Label> |
| 43 | <Input /> |
| 44 | <FieldError /> |
| 45 | </TextField> |
| 46 | <Button type="submit">Submit</Button> |
| 47 | </Form> |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | let {getByTestId, getByRole} = render(<Test />); |
| 52 |
nothing calls this directly
no outgoing calls
no test coverage detected