MCPcopy Create free account
hub / github.com/adobe/react-spectrum / App

Function App

packages/react-aria-components/test/Tooltip.test.js:227–253  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

225 );
226 }
227 function App() {
228 let container = useRef(null);
229 return (
230 <>
231 <UNSAFE_PortalProvider getContainer={() => container.current}>
232 <InfoTooltip container={container} />
233 </UNSAFE_PortalProvider>
234 <div ref={container} data-testid="custom-container" />
235 </>
236 );
237 }
238 it('should render the tooltip in the portal container provided by the PortalProvider', async () => {
239 let {getByRole, getByTestId} = render(<App />);
240 let button = getByRole('button');
241
242 fireEvent.mouseMove(document.body);
243 await user.hover(button);
244 act(() => jest.runAllTimers());
245
246 expect(getByRole('tooltip').closest('[data-testid="custom-container"]')).toBe(
247 getByTestId('custom-container')
248 );
249
250 await user.unhover(button);
251 act(() => jest.runAllTimers());
252 });
253 });
254
255 // TODO: delete this test when we get rid of the deprecated prop
256 describe('portalContainer', () => {

Callers

nothing calls this directly

Calls 2

actFunction · 0.85
renderFunction · 0.50

Tested by

no test coverage detected