Home / File/ ReactPersistent-test.js — react Source File

ReactPersistent-test.js — react Source File

Architecture documentation for ReactPersistent-test.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @emails react-core
 * @jest-environment node
 */

'use strict';

let React;
let ReactNoopPersistent;

let act;
let waitForAll;

describe('ReactPersistent', () => {
  beforeEach(() => {
    jest.resetModules();

    React = require('react');
    ReactNoopPersistent = require('react-noop-renderer/persistent');
    ({act, waitForAll} = require('internal-test-utils'));
  });

  // Inlined from shared folder so we can run this test on a bundle.
  function createPortal(children, containerInfo, implementation, key) {
    return {
      $$typeof: Symbol.for('react.portal'),
      key: key == null ? null : String(key),
      children,
      containerInfo,
      implementation,
    };
  }

  function render(element) {
    ReactNoopPersistent.render(element);
  }

  function div(...children) {
    children = children.map(c =>
      typeof c === 'string' ? {text: c, hidden: false} : c,
    );
    return {type: 'div', children, prop: undefined, hidden: false};
  }

  function span(prop) {
    return {type: 'span', children: [], prop, hidden: false};
  }

  // For persistent renderers we have to mix deep equality and reference equality checks
  //  for which we need the actual children.
  //  None of the tests are gated and the underlying implementation is rarely touch
  //  so it's unlikely we deal with failing `toEqual` checks which cause bad performance.
  function dangerouslyGetChildren() {
    return ReactNoopPersistent.dangerouslyGetChildren();
  }
// ... (179 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does ReactPersistent-test.js do?
ReactPersistent-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is ReactPersistent-test.js in the architecture?
ReactPersistent-test.js is located at packages/react-reconciler/src/__tests__/ReactPersistent-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-reconciler/src/__tests__).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free