With prior versions of react-tooltip, I was able to simply render the tooltip without even having to trigger a user interaction, with v5.28, even with userEvents, I am still unable to get the tooltip div to appear.
it('should render tooltip', async () => {
const user = userEvent.setup();
const SampleComponent = () => (
<>
<div
data-tooltip-id="sample-tooltip"
data-tooltip-content="Test Tooltip popup"
role="button"
data-testid="sample-field-help"
>
Tooltip Content
</div>
<ReactTooltip
id="sample-tooltip"
role="tooltip"
delayShow={100}
clickable
globalCloseEvents={{ clickOutsideAnchor: true, scroll: true }}
openOnClick
render={
dataTip => (
<div className="tooltip-content" data-testid="tooltip-content">
<div className="tooltip-text" data-testid="tooltip-text">
{dataTip.content}
</div>
</div>
)
}
/>
</>
);
render(<SampleComponent />);
const anchorElement = screen.getByTestId('sample-field-help');
await user.click(anchorElement);
// none of the below works
// await user.hover(anchorElement);
// await userEvent.dblClick(anchorElement);
screen.debug()
});
screen.debug()?div.