Skip to content

Commit

Permalink
Convert ReactUpdaters-test.internal to createRoot (facebook#28005)
Browse files Browse the repository at this point in the history
Convert ReactUpdaters-test.internal to createRoot
  • Loading branch information
kassens authored and AndyPengc12 committed Apr 15, 2024
1 parent d197469 commit 79a5b01
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ describe('updaters', () => {

const Parent = () => <Child />;
const Child = () => null;
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(document.createElement('div'));

await act(() => {
ReactDOM.render(<Parent />, container);
root.render(<Parent />);
});
expect(allSchedulerTags).toEqual([[HostRoot]]);

await act(() => {
ReactDOM.render(<Parent />, container);
root.render(<Parent />);
});
expect(allSchedulerTags).toEqual([[HostRoot], [HostRoot]]);
});
Expand All @@ -141,8 +141,9 @@ describe('updaters', () => {
};
const Child = () => null;

const root = ReactDOMClient.createRoot(document.createElement('div'));
await act(() => {
ReactDOM.render(<Parent />, document.createElement('div'));
root.render(<Parent />);
});
expect(scheduleForA).not.toBeNull();
expect(scheduleForB).not.toBeNull();
Expand Down Expand Up @@ -174,8 +175,9 @@ describe('updaters', () => {
}
const Child = () => null;
let instance;
const root = ReactDOMClient.createRoot(document.createElement('div'));
await act(() => {
ReactDOM.render(<Parent />, document.createElement('div'));
root.render(<Parent />);
});
expect(allSchedulerTypes).toEqual([[null]]);

Expand Down

0 comments on commit 79a5b01

Please sign in to comment.