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

Function resize

packages/react-aria/test/utils/keyboard.test.ts:25–38  ·  view source on GitHub ↗
(rect: Pick<DOMRect, 'width' | 'height'>)

Source from the content-addressed store, hash-verified

23 let height = window.innerHeight;
24
25 function resize(rect: Pick<DOMRect, 'width' | 'height'>) {
26 if (rect.width > rect.height !== window.innerWidth > window.innerHeight) {
27 window.orientation = rect.width > rect.height ? 90 : 0;
28 screen.orientation.dispatchEvent(new Event('change'));
29 }
30
31 if (rect.width !== window.innerWidth || rect.height !== window.innerHeight) {
32 window.innerWidth = rect.width;
33 window.innerHeight = rect.height;
34 window.dispatchEvent(new Event('resize'));
35 visualViewport?.dispatchEvent(new Event('resize'));
36 jest.advanceTimersByTime(200);
37 }
38 }
39
40 beforeAll(() => {
41 document.body.appendChild(button);

Callers 3

keyboard.test.tsFile · 0.70
onMoveFunction · 0.50
onChangeFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected