Home / File/ ReactFiberHostContext-test.internal.js — react Source File

ReactFiberHostContext-test.internal.js — react Source File

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

Entity Profile

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 act;
let ReactFiberReconciler;
let ConcurrentRoot;
let DefaultEventPriority;
let NoEventPriority;

describe('ReactFiberHostContext', () => {
  beforeEach(() => {
    jest.resetModules();
    React = require('react');
    act = React.act;
    ReactFiberReconciler = require('react-reconciler');
    ConcurrentRoot =
      require('react-reconciler/src/ReactRootTags').ConcurrentRoot;
    DefaultEventPriority =
      require('react-reconciler/src/ReactEventPriorities').DefaultEventPriority;
    NoEventPriority =
      require('react-reconciler/src/ReactEventPriorities').NoEventPriority;
  });

  global.IS_REACT_ACT_ENVIRONMENT = true;

  // @gate __DEV__
  it('should send the context to prepareForCommit and resetAfterCommit', () => {
    const rootContext = {};
    const childContext = {};
    let updatePriority: typeof DefaultEventPriority = NoEventPriority;
    const Renderer = ReactFiberReconciler({
      prepareForCommit: function (hostContext) {
        expect(hostContext).toBe(rootContext);
        return null;
      },
      resetAfterCommit: function (hostContext) {
        expect(hostContext).toBe(rootContext);
      },
      getRootHostContext: function () {
        return rootContext;
      },
      getChildHostContext: function () {
        return childContext;
      },
      shouldSetTextContent: function () {
        return false;
      },
      createInstance: function () {
        return null;
      },
// ... (87 more lines)

Frequently Asked Questions

What does ReactFiberHostContext-test.internal.js do?
ReactFiberHostContext-test.internal.js is a source file in the react codebase, written in javascript.
Where is ReactFiberHostContext-test.internal.js in the architecture?
ReactFiberHostContext-test.internal.js is located at packages/react-reconciler/src/__tests__/ReactFiberHostContext-test.internal.js (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