MCPcopy Index your code
hub / github.com/react/react / mountTestApp

Function mountTestApp

packages/react-devtools-shared/src/__tests__/editing-test.js:48–416  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 let hostComponentID;
47
48 async function mountTestApp() {
49 class ClassComponent extends React.Component {
50 componentDidMount() {
51 committedClassProps = this.props;
52 }
53 componentDidUpdate() {
54 committedClassProps = this.props;
55 }
56 render() {
57 return null;
58 }
59 }
60
61 function FunctionComponent(props) {
62 React.useLayoutEffect(() => {
63 committedFunctionProps = props;
64 });
65 return null;
66 }
67
68 inputRef = React.createRef(null);
69
70 await utils.actAsync(() =>
71 render(
72 <>
73 <ClassComponent
74 array={[1, 2, 3]}
75 object={{nested: 'initial'}}
76 shallow="initial"
77 />
78 ,
79 <FunctionComponent
80 array={[1, 2, 3]}
81 object={{nested: 'initial'}}
82 shallow="initial"
83 />
84 ,
85 <input ref={inputRef} onChange={jest.fn()} value="initial" />
86 </>,
87 ),
88 );
89
90 classID = ((store.getElementIDAtIndex(0): any): number);
91 functionID = ((store.getElementIDAtIndex(1): any): number);
92 hostComponentID = ((store.getElementIDAtIndex(2): any): number);
93
94 expect(committedClassProps).toStrictEqual({
95 array: [1, 2, 3],
96 object: {
97 nested: 'initial',
98 },
99 shallow: 'initial',
100 });
101 expect(committedFunctionProps).toStrictEqual({
102 array: [1, 2, 3],
103 object: {
104 nested: 'initial',
105 },

Callers 1

editing-test.jsFile · 0.70

Calls 9

overrideHookStateFunction · 0.85
getElementIDAtIndexMethod · 0.80
toStrictEqualMethod · 0.80
renderFunction · 0.70
overridePropsFunction · 0.70
renamePathFunction · 0.70
deletePathFunction · 0.70
overrideContextFunction · 0.70
toBeMethod · 0.65

Tested by

no test coverage detected