Skip to content

Commit

Permalink
Convert ReactFreshMultipleRenderer to createRoot (#28000)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Jan 19, 2024
1 parent 601dba8 commit 4c58fc2
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ if (__DEV__) {
ReactFreshRuntime = require('react-refresh/runtime');
ReactFreshRuntime.injectIntoGlobalHook(global);
}
const ReactDOM = require('react-dom');
const ReactDOMClient = require('react-dom/client');
const act = require('internal-test-utils').act;

jest.resetModules();
const ReactART = require('react-art');
Expand All @@ -41,7 +42,7 @@ describe('ReactFresh', () => {
}
});

it('can update components managed by different renderers independently', () => {
it('can update components managed by different renderers independently', async () => {
if (__DEV__) {
const InnerV1 = function () {
return <ReactART.Shape fill="blue" />;
Expand All @@ -59,7 +60,10 @@ describe('ReactFresh', () => {
};
ReactFreshRuntime.register(OuterV1, 'Outer');

ReactDOM.render(<OuterV1 />, container);
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(<OuterV1 />);
});
const el = container.firstChild;
const pathEl = el.querySelector('path');
expect(el.style.color).toBe('blue');
Expand Down

0 comments on commit 4c58fc2

Please sign in to comment.