ReactChildren-test.js — react Source File
Architecture documentation for ReactChildren-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
*/
'use strict';
describe('ReactChildren', () => {
let React;
let ReactDOMClient;
let act;
let assertConsoleErrorDev;
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactDOMClient = require('react-dom/client');
({act, assertConsoleErrorDev} = require('internal-test-utils'));
});
it('should support identity for simple', () => {
const context = {};
const callback = jest.fn().mockImplementation(function (kid, index) {
expect(this).toBe(context);
return kid;
});
const simpleKid = <span key="simple" />;
// First pass children into a component to fully simulate what happens when
// using structures that arrive from transforms.
const instance = <div>{simpleKid}</div>;
React.Children.forEach(instance.props.children, callback, context);
expect(callback).toHaveBeenCalledWith(simpleKid, 0);
callback.mockClear();
const mappedChildren = React.Children.map(
instance.props.children,
callback,
context,
);
expect(callback).toHaveBeenCalledWith(simpleKid, 0);
expect(mappedChildren[0]).toEqual(<span key=".$simple" />);
});
it('should support Portal components', () => {
const context = {};
const callback = jest.fn().mockImplementation(function (kid, index) {
expect(this).toBe(context);
return kid;
});
const ReactDOM = require('react-dom');
const portalContainer = document.createElement('div');
const simpleChild = <span key="simple" />;
const reactPortal = ReactDOM.createPortal(simpleChild, portalContainer);
// ... (1168 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does ReactChildren-test.js do?
ReactChildren-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is ReactChildren-test.js in the architecture?
ReactChildren-test.js is located at packages/react/src/__tests__/ReactChildren-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free