MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / getMountNode

Function getMountNode

lib/utils/test/render.ts:25–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23 * By default, it is appended to the body; tests may move it elsewhere (e.g. into a scroll container, see scrollElement.ts).
24 */
25export function getMountNode(): HTMLDivElement {
26 if (!mountNode) {
27 mountNode = document.createElement("div");
28
29 // Unless we attach the mount-node to body, getBoundingClientRect() won't work
30 document.body.appendChild(mountNode);
31
32 root = createRoot(mountNode);
33 }
34 return mountNode;
35}
36
37/**
38 * Helper method for testing components that may use Portal and thus require cleanup.

Callers 3

Grid.test.tsxFile · 0.90
adoptFunction · 0.90
renderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected