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

Function Test

packages/react-aria-components/test/Select.test.js:685–703  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

683 const onSubmit = jest.fn().mockImplementation(e => e.preventDefault());
684
685 function Test() {
686 const [selectedKey, setSelectedKey] = React.useState(null);
687 return (
688 <Form onSubmit={onSubmit}>
689 <TestSelect
690 isRequired
691 name="select"
692 selectedKey={selectedKey}
693 onSelectionChange={setSelectedKey}
694 />
695 <Button data-testid="submit" type="submit">
696 Submit
697 </Button>
698 <Button data-testid="clear" onPress={() => setSelectedKey(null)}>
699 Reset
700 </Button>
701 </Form>
702 );
703 }
704
705 const {getByTestId} = render(<Test />);
706 const wrapper = getByTestId('select');

Callers

nothing calls this directly

Calls 1

setSelectedKeyFunction · 0.85

Tested by

no test coverage detected