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 ownersListContext test #28240

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import type {Element} from 'react-devtools-shared/src/frontend/types';
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
import type Store from 'react-devtools-shared/src/devtools/store';

import {getVersionedRenderImplementation} from './utils';

describe('OwnersListContext', () => {
let React;
let TestRenderer: ReactTestRenderer;
let bridge: FrontendBridge;
let legacyRender;
let store: Store;
let utils;

Expand All @@ -30,8 +31,6 @@ describe('OwnersListContext', () => {
utils = require('./utils');
utils.beforeEachProfiling();

legacyRender = utils.legacyRender;

bridge = global.bridge;
store = global.store;
store.collapseNodesByDefault = false;
Expand All @@ -51,6 +50,8 @@ describe('OwnersListContext', () => {
require('react-devtools-shared/src/devtools/views/Components/TreeContext').TreeContextController;
});

const {render} = getVersionedRenderImplementation();

const Contexts = ({children, defaultOwnerID = null}) => (
<BridgeContext.Provider value={bridge}>
<StoreContext.Provider value={store}>
Expand Down Expand Up @@ -98,9 +99,7 @@ describe('OwnersListContext', () => {
};
const Child = () => null;

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand Down Expand Up @@ -143,9 +142,7 @@ describe('OwnersListContext', () => {
};
const Child = () => null;

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand All @@ -171,9 +168,7 @@ describe('OwnersListContext', () => {
const Grandparent = () => <Parent />;
const Parent = () => null;

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand All @@ -198,9 +193,7 @@ describe('OwnersListContext', () => {
return <Memo ref={ref} />;
};

utils.act(() =>
legacyRender(<Grandparent />, document.createElement('div')),
);
utils.act(() => render(<Grandparent />));

expect(store).toMatchInlineSnapshot(`
[root]
Expand Down