/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-devtools-shell/src/e2e-regression/app-legacy.js
35 строк
1 KB
Sebastian Markbåge
Move ReactDOMLegacy implementation into RootFB (#28656)
03 апр 2024, 04:56
Не верифицирован
03 апр 2024, 04:56
8f55a6a
Код
Авторство
О чём код?
/** @flow */ // This test harness mounts each test app as a separate root to test multi-root applications. import * as React from 'react'; import * as ReactDOM from 'react-dom'; import ListApp from '../e2e-apps/ListApp'; import ListAppLegacy from '../e2e-apps/ListAppLegacy'; import {gte} from 'react-devtools-shared/src/backend/utils'; const version = process.env.E2E_APP_REACT_VERSION; function mountApp(App: () => React$Node) { const container = document.createElement('div'); ((document.body: any): HTMLBodyElement).appendChild(container); // $FlowFixMe[prop-missing]: These are removed in 19. ReactDOM.render(<App />, container); } function mountTestApp() { // ListApp has hooks, which aren't available until 16.8.0 mountApp(gte(version, '16.8.0') ? ListApp : ListAppLegacy); } mountTestApp(); // ReactDOM Test Selector APIs used by Playwright e2e tests // If they don't exist, we mock them window.parent.REACT_DOM_APP = { createTestNameSelector: name => `[data-testname="${name}"]`, findAllNodes: (container, nodes) => container.querySelectorAll(nodes.join(' ')), ...ReactDOM, };