Home / File/ validateDOMNesting-test.js — react Source File

validateDOMNesting-test.js — react Source File

Architecture documentation for validateDOMNesting-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';

const React = require('react');
const ReactDOM = require('react-dom');
const ReactDOMClient = require('react-dom/client');
const assertConsoleErrorDev =
  require('internal-test-utils').assertConsoleErrorDev;

function expectWarnings(tags, warnings = []) {
  tags = [...tags];
  warnings = [...warnings];

  document.removeChild(document.documentElement);
  document.appendChild(document.createElement('html'));
  document.documentElement.innerHTML = '<head></head><body></body>';

  let element = null;
  const containerTag = tags.shift();
  let container;
  switch (containerTag) {
    case '#document':
      container = document;
      break;
    case 'html':
      container = document.documentElement;
      break;
    case 'body':
      container = document.body;
      break;
    case 'head':
      container = document.head;
      break;
    case 'svg':
      container = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
      break;
    default:
      container = document.createElement(containerTag);
      break;
  }

  while (tags.length) {
    const Tag = tags.pop();
    if (Tag === '#text') {
      element = 'text';
    } else {
      element = <Tag>{element}</Tag>;
    }
  }

  const root = ReactDOMClient.createRoot(container);
  ReactDOM.flushSync(() => {
// ... (165 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does validateDOMNesting-test.js do?
validateDOMNesting-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in validateDOMNesting-test.js?
validateDOMNesting-test.js defines 1 function(s): expectWarnings.
Where is validateDOMNesting-test.js in the architecture?
validateDOMNesting-test.js is located at packages/react-dom/src/__tests__/validateDOMNesting-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