MCPcopy
hub / github.com/adobe/react-spectrum / App

Function App

packages/@adobe/react-spectrum/test/menu/MenuTrigger.test.js:958–994  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

956 }
957
958 function App() {
959 let container = React.useRef(null);
960 return (
961 <>
962 <InfoMenu container={container} />
963 <div ref={container} data-testid="custom-container" />
964 </>
965 );
966 }
967
968 it('should render the menu in the portal container', async () => {
969 tree = render(<App />);
970
971 let button = tree.getByRole('button');
972 await user.click(button);
973
974 expect(tree.getByRole('menu').closest('[data-testid="custom-container"]')).toBe(
975 tree.getByTestId('custom-container')
976 );
977 await user.keyboard('{Escape}');
978 act(() => {
979 jest.runAllTimers();
980 });
981 });
982
983 it('should render the menu tray in the portal container', async () => {
984 windowSpy.mockImplementation(() => 700);
985 tree = render(<App />);
986
987 let button = tree.getByRole('button');
988 await user.click(button);
989
990 expect(tree.getByRole('menu').closest('[data-testid="custom-container"]')).toBe(
991 tree.getByTestId('custom-container')
992 );
993 });
994 });
995
996 it('does not close if menu is tabbed away from', async function () {
997 let tree = render(

Callers

nothing calls this directly

Calls 2

renderFunction · 0.90
actFunction · 0.90

Tested by

no test coverage detected