This is a follow-up to a previous post of mine: Testing Semantic-UI Dropdown: How to wait for it to be populated?
My React Bootstrap Modal is defined like this:
<Modal
backdrop={'static'}
size='lg'
show={true}
centered={true}
onHide={handleCancelClick}
onEntered={e => setIsLoaded(true)}
data-testid='add-vehicles-modal'
>
The onEntered
event works perfectly in production, and as you can see, sets isLoaded = true
, which in turn causes a bunch of companies to be fetched from an API to populate my dropdown list.
Trigger modal shown for React Bootstrap
However, I've discovered that onEntered
isn't triggered in the Jest test environment, which is why the companies are never loaded, when tests are expecting them to be.
I wonder if anyone has any suggested workarounds?