mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
0b4f443020
This setting is an incremental path to the next Flow version enforcing type annotations on most functions (except some inline callbacks). Used ``` node_modules/.bin/flow codemod annotate-functions-and-classes --write . ``` to add a majority of the types with some hand cleanup when for large inferred objects that should just be `Fiber` or weird constructs including `any`. Suppressed the remaining issues. Builds on #25918
32 lines
859 B
JavaScript
32 lines
859 B
JavaScript
/** @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 {createRoot} from 'react-dom/client';
|
|
import ListApp from '../e2e-apps/ListApp';
|
|
|
|
function mountApp(App: () => React$Node) {
|
|
const container = document.createElement('div');
|
|
|
|
((document.body: any): HTMLBodyElement).appendChild(container);
|
|
|
|
const root = createRoot(container);
|
|
root.render(<App />);
|
|
}
|
|
function mountTestApp() {
|
|
mountApp(ListApp);
|
|
}
|
|
|
|
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,
|
|
};
|