ReactComponent-test.js — react Source File
Architecture documentation for ReactComponent-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';
let React;
let ReactDOM;
let ReactDOMClient;
let ReactDOMServer;
let act;
let assertConsoleErrorDev;
describe('ReactComponent', () => {
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactDOM = require('react-dom');
ReactDOMClient = require('react-dom/client');
ReactDOMServer = require('react-dom/server');
act = require('internal-test-utils').act;
assertConsoleErrorDev =
require('internal-test-utils').assertConsoleErrorDev;
});
// @gate !disableLegacyMode
it('should throw on invalid render targets in legacy roots', () => {
const container = document.createElement('div');
// jQuery objects are basically arrays; people often pass them in by mistake
expect(function () {
ReactDOM.render(<div />, [container]);
}).toThrowError(/Target container is not a DOM element./);
expect(function () {
ReactDOM.render(<div />, null);
}).toThrowError(/Target container is not a DOM element./);
});
it('should throw (in dev) when children are mutated during render', async () => {
function Wrapper(props) {
props.children[1] = <p key={1} />; // Mutation is illegal
return <div>{props.children}</div>;
}
if (__DEV__) {
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
await expect(
act(() => {
root.render(
<Wrapper>
<span key={0} />
<span key={1} />
<span key={2} />
</Wrapper>,
// ... (651 more lines)
Domain
Subdomains
Source
Frequently Asked Questions
What does ReactComponent-test.js do?
ReactComponent-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is ReactComponent-test.js in the architecture?
ReactComponent-test.js is located at packages/react-dom/src/__tests__/ReactComponent-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free