ReactIdentity-test.js — react Source File
Architecture documentation for ReactIdentity-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 ReactDOMClient;
let act;
let assertConsoleErrorDev;
describe('ReactIdentity', () => {
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactDOMClient = require('react-dom/client');
act = require('internal-test-utils').act;
assertConsoleErrorDev =
require('internal-test-utils').assertConsoleErrorDev;
});
it('should allow key property to express identity', async () => {
let node;
const Component = props => (
<div ref={c => (node = c)}>
<div key={props.swap ? 'banana' : 'apple'} />
<div key={props.swap ? 'apple' : 'banana'} />
</div>
);
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
await act(async () => {
root.render(<Component />);
});
const origChildren = Array.from(node.childNodes);
await act(async () => {
root.render(<Component swap={true} />);
});
const newChildren = Array.from(node.childNodes);
expect(origChildren[0]).toBe(newChildren[1]);
expect(origChildren[1]).toBe(newChildren[0]);
});
it('should use composite identity', async () => {
class Wrapper extends React.Component {
render() {
return <a>{this.props.children}</a>;
}
}
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
let node1;
let node2;
// ... (272 more lines)
Domain
Subdomains
Source
Frequently Asked Questions
What does ReactIdentity-test.js do?
ReactIdentity-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is ReactIdentity-test.js in the architecture?
ReactIdentity-test.js is located at packages/react-dom/src/__tests__/ReactIdentity-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