'Can't test mui accordion with react testing library
today I'm here because I'm having an issue with the Material UI Accordion and react testing library, when i try to run the render function over the accordion it responds with this message
console.error
Error: Uncaught [TypeError: Cannot read properties of undefined (reading 'appendChild')]
console.error
The above error occurred in the <WithStyles(ForwardRef(Accordion))> component:
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
TypeError: Cannot read properties of undefined (reading 'appendChild')
my render method is basically this:
render(
<Accordion>
Hello, I'm content
</Accordion>,
);
Solution 1:[1]
It looks like the trailing comma might be the issue here, e.g.
render(
<Accordion>
Hello, I'm content
- </Accordion>,
+ </Accordion>
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | barryels |
