MCPcopy Index your code
hub / github.com/react/react / parent

Method parent

packages/react-test-renderer/src/ReactTestRenderer.js:347–363  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

345 }
346
347 get parent(): ?ReactTestInstance {
348 let parent = this._fiber.return;
349 while (parent !== null) {
350 if (validWrapperTypes.has(parent.tag)) {
351 if (parent.tag === HostRoot) {
352 // Special case: we only "materialize" instances for roots
353 // if they have more than a single child. So we'll check that now.
354 if (getChildren(parent).length < 2) {
355 return null;
356 }
357 }
358 return wrapFiber(parent);
359 }
360 parent = parent.return;
361 }
362 return null;
363 }
364
365 get children(): Array<ReactTestInstance | string> {
366 return getChildren(this._currentFiber());

Callers 1

Calls 3

wrapFiberFunction · 0.85
getChildrenFunction · 0.70
hasMethod · 0.65

Tested by

no test coverage detected