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

Function mockRect

packages/react-aria-components/test/PreviewTrigger.test.js:61–73  ·  view source on GitHub ↗
(el, rect)

Source from the content-addressed store, hash-verified

59 installPointerEvent();
60
61 let mockRect = (el, rect) => {
62 el.getBoundingClientRect = () => ({
63 left: rect.left,
64 right: rect.right,
65 top: rect.top,
66 bottom: rect.bottom,
67 width: rect.right - rect.left,
68 height: rect.bottom - rect.top,
69 x: rect.left,
70 y: rect.top,
71 toJSON() {}
72 });
73 };
74
75 it('opens on hover, stays open across the safe area, and closes when the pointer leaves', async () => {
76 let {getByRole, getByTestId, queryByTestId} = render(<TestPreviewTrigger />);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected