()
| 879 | |
| 880 | it('has a value immediately after rendering', async () => { |
| 881 | function Example() { |
| 882 | const ref = useRef(null); |
| 883 | const [formData, setFormData] = useState(() => new FormData()); |
| 884 | |
| 885 | useEffect(() => { |
| 886 | if (ref.current) { |
| 887 | setFormData(new FormData(ref.current)); |
| 888 | } |
| 889 | }, []); |
| 890 | |
| 891 | const selectValue = formData.get('select'); |
| 892 | |
| 893 | if (selectValue instanceof File) { |
| 894 | throw new Error(''); |
| 895 | } |
| 896 | |
| 897 | return ( |
| 898 | <form ref={ref}> |
| 899 | <Select name="select" defaultValue="1" aria-label="Select"> |
| 900 | <Button> |
| 901 | <SelectValue /> |
| 902 | <span aria-hidden="true">▼</span> |
| 903 | </Button> |
| 904 | <Popover> |
| 905 | <ListBox> |
| 906 | <ListBoxItem id="1">value</ListBoxItem> |
| 907 | </ListBox> |
| 908 | </Popover> |
| 909 | </Select> |
| 910 | <div data-testid="select-value">select value: {selectValue}</div> |
| 911 | </form> |
| 912 | ); |
| 913 | } |
| 914 | let {getByTestId} = render(<Example />); |
| 915 | let selectValue = getByTestId('select-value'); |
| 916 | expect(selectValue).toHaveTextContent('select value: 1'); |
nothing calls this directly
no outgoing calls
no test coverage detected