Testing · Senior · Question 38 of 75
How do you test a component that renders through a portal (modal)?
- ✓Correct answer: Query with
screen- it searches the wholedocument.body, including portal content - 2Render the portal target manually and query the container
- 3Portals can only be tested in E2E
Explanation
Queries bound to container miss portal content; screen doesn't.