MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Test

Function Test

packages/react-aria-components/test/Form.test.js:30–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected