Skip to content

Commit

Permalink
chore: use versioned render in editing test (facebook#28239)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxyq authored and AndyPengc12 committed Apr 15, 2024
1 parent c39c0ea commit 2f19a11
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions packages/react-devtools-shared/src/__tests__/editing-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
import type Store from 'react-devtools-shared/src/devtools/store';

import {getVersionedRenderImplementation} from './utils';

describe('editing interface', () => {
let PropTypes;
let React;
let bridge: FrontendBridge;
let legacyRender;
let store: Store;
let utils;

Expand All @@ -25,8 +26,6 @@ describe('editing interface', () => {
beforeEach(() => {
utils = require('./utils');

legacyRender = utils.legacyRender;

bridge = global.bridge;
store = global.store;
store.collapseNodesByDefault = false;
Expand All @@ -36,6 +35,8 @@ describe('editing interface', () => {
React = require('react');
});

const {render} = getVersionedRenderImplementation();

describe('props', () => {
let committedClassProps;
let committedFunctionProps;
Expand Down Expand Up @@ -66,9 +67,8 @@ describe('editing interface', () => {

inputRef = React.createRef(null);

const container = document.createElement('div');
await utils.actAsync(() =>
legacyRender(
render(
<>
<ClassComponent
array={[1, 2, 3]}
Expand All @@ -84,7 +84,6 @@ describe('editing interface', () => {
,
<input ref={inputRef} onChange={jest.fn()} value="initial" />
</>,
container,
),
);

Expand Down Expand Up @@ -440,11 +439,9 @@ describe('editing interface', () => {
}
}

const container = document.createElement('div');
await utils.actAsync(() =>
legacyRender(
render(
<ClassComponent object={{nested: 'initial'}} shallow="initial" />,
container,
),
);

Expand Down Expand Up @@ -662,10 +659,7 @@ describe('editing interface', () => {
return null;
}

const container = document.createElement('div');
await utils.actAsync(() =>
legacyRender(<FunctionComponent />, container),
);
await utils.actAsync(() => render(<FunctionComponent />));

hookID = 0; // index
id = ((store.getElementIDAtIndex(0): any): number);
Expand Down Expand Up @@ -917,13 +911,11 @@ describe('editing interface', () => {
}
}

const container = document.createElement('div');
await utils.actAsync(() =>
legacyRender(
render(
<LegacyContextProvider>
<ClassComponent />
</LegacyContextProvider>,
container,
),
);

Expand Down

0 comments on commit 2f19a11

Please sign in to comment.