ReactContextValidator-test.js — react Source File
Architecture documentation for ReactContextValidator-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
*/
// This test doesn't really have a good home yet. I'm leaving it here since this
// behavior belongs to the old propTypes system yet is currently implemented
// in the core ReactCompositeComponent. It should technically live in core's
// test suite but I'll leave it here to indicate that this is an issue that
// needs to be fixed.
'use strict';
let PropTypes;
let React;
let ReactDOMClient;
let act;
let assertConsoleErrorDev;
describe('ReactContextValidator', () => {
beforeEach(() => {
jest.resetModules();
PropTypes = require('prop-types');
React = require('react');
ReactDOMClient = require('react-dom/client');
({act, assertConsoleErrorDev} = require('internal-test-utils'));
});
// TODO: This behavior creates a runtime dependency on propTypes. We should
// ensure that this is not required for ES6 classes with Flow.
// @gate !disableLegacyContext
it('should filter out context not in contextTypes', async () => {
class Component extends React.Component {
render() {
return <div />;
}
}
Component.contextTypes = {
foo: PropTypes.string,
};
class ComponentInFooBarContext extends React.Component {
childRef = React.createRef();
getChildContext() {
return {
foo: 'abc',
bar: 123,
};
}
render() {
return <Component ref={this.childRef} />;
}
// ... (601 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does ReactContextValidator-test.js do?
ReactContextValidator-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is ReactContextValidator-test.js in the architecture?
ReactContextValidator-test.js is located at packages/react/src/__tests__/ReactContextValidator-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