MCPcopy Create free account
hub / github.com/bvaughn/react-window / getRowCenter

Function getRowCenter

integrations/tests/tests/headless.spec.tsx:45–60  ·  view source on GitHub ↗
(page: Page, index: number, isWindow: boolean)

Source from the content-addressed store, hash-verified

43}
44
45async function getRowCenter(page: Page, index: number, isWindow: boolean) {
46 return page.evaluate(
47 ({ index, isWindow }) => {
48 const row = document.querySelector(`tr[data-index="${index}"]`);
49 if (!row) return null;
50 const rect = row.getBoundingClientRect();
51 const scroller = document.querySelector('[data-testid="scroller"]');
52 const viewTop = isWindow ? 0 : scroller!.getBoundingClientRect().top;
53 const viewHeight = isWindow
54 ? document.documentElement.clientHeight
55 : scroller!.clientHeight;
56 return (rect.top + rect.bottom) / 2 - viewTop - viewHeight / 2;
57 },
58 { index, isWindow }
59 );
60}
61
62for (const isWindow of [false, true]) {
63 for (const isDynamic of [false, true]) {

Callers 1

headless.spec.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected