Repository navigation
Closed
Description
Describe the bug
When testing a component that uses the <Autocomplete /> component from mui-rff I encounter an error:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `AutocompleteWrapper`.
at input (/Users/code/mui-rff-autocomplete-test/node_modules/mui-rff/src/Autocomplete.tsx:76:3)
at Field (/Users/code/mui-rff-autocomplete-test/node_modules/react-final-form/dist/react-final-form.cjs.js:718:26)
at name (/Users/code/mui-rff-autocomplete-test/node_modules/mui-rff/src/Autocomplete.tsx:44:10)
at form
at ReactFinalForm (/Users/code/mui-rff-autocomplete-test/node_modules/react-final-form/dist/react-final-form.cjs.js:178:20)
My test minimal reproduction test case looks like:
import { render } from "@testing-library/react"
import {Autocomplete} from "mui-rff"
import { Form } from "react-final-form"
test("renders autocomplete", () => {
const options = [
{value: "1", label: "one"},
{value: "2", label: "two"},
]
const rendered = render(
<Form
onSubmit={() => {
}}
render={({handleSubmit}) => (
<form onSubmit={handleSubmit}>
<Autocomplete name="test" label="test" options={options}/>
</form>
)}
/>,
)
})
Any ideas or suggestions on what's causing the error in my tests would be much appreciated. I checked the tests in this repo to compare against my own, but with no luck.
To Reproduce
I've tried to create a minimal reproduction of the issue in https://github.com/d3spis3d/mui-rff-autocomplete-test
- Clone the repo
- Run
yarn && yarn test
Expected behavior
<Autocomplete /> renders in the test without errors.
Metadata
Metadata
Assignees
Labels
No labels
Activity