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

Convert ReactUpdaters-test.internal to createRoot #28005

Merged
merged 1 commit into from
Jan 19, 2024
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
Convert ReactUpdaters-test.internal to createRoot
  • Loading branch information
kassens committed Jan 19, 2024

Verified

This commit was created on github.com and signed with GitHub’s verified signature.
commit 44c993b7f582a7b81d4a6b5fd38ea5a815fa3d9d
Original file line number Diff line number Diff line change
@@ -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]]);
});
@@ -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();
@@ -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]]);