Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use versioned render in editing test #28239

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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