From 4daf16f3b786e7eec8e5b07dbec4dbf6243d50bd Mon Sep 17 00:00:00 2001 From: eps1lon Date: Wed, 9 Jun 2021 20:18:13 +0200 Subject: [PATCH] Start enabling legacy roots where incompatible with React 18 --- .../src/DesktopDatePicker/DesktopDatePicker.test.tsx | 2 ++ .../src/DesktopDateTimePicker/DesktopDateTimePicker.test.tsx | 2 ++ packages/material-ui/src/Autocomplete/Autocomplete.test.js | 3 ++- test/utils/mochaHooks.js | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/material-ui-lab/src/DesktopDatePicker/DesktopDatePicker.test.tsx b/packages/material-ui-lab/src/DesktopDatePicker/DesktopDatePicker.test.tsx index 345325e08277fa..344f7af011eb61 100644 --- a/packages/material-ui-lab/src/DesktopDatePicker/DesktopDatePicker.test.tsx +++ b/packages/material-ui-lab/src/DesktopDatePicker/DesktopDatePicker.test.tsx @@ -78,6 +78,8 @@ describe('', () => { TransitionComponent={FakeTransitionComponent} renderInput={(params) => } />, + // TODO: React18Compat + { legacyRoot: true }, ); act(() => { diff --git a/packages/material-ui-lab/src/DesktopDateTimePicker/DesktopDateTimePicker.test.tsx b/packages/material-ui-lab/src/DesktopDateTimePicker/DesktopDateTimePicker.test.tsx index 8f56d6761dc37a..f329a52fce2e22 100644 --- a/packages/material-ui-lab/src/DesktopDateTimePicker/DesktopDateTimePicker.test.tsx +++ b/packages/material-ui-lab/src/DesktopDateTimePicker/DesktopDateTimePicker.test.tsx @@ -27,6 +27,8 @@ describe('', () => { onChange={() => {}} renderInput={(params) => } />, + // TODO: React18Compat + { legacyRoot: true }, ); userEvent.mousePress(screen.getByLabelText(/choose date/i)); diff --git a/packages/material-ui/src/Autocomplete/Autocomplete.test.js b/packages/material-ui/src/Autocomplete/Autocomplete.test.js index df42afe7c73301..0f2ef15fedcd9d 100644 --- a/packages/material-ui/src/Autocomplete/Autocomplete.test.js +++ b/packages/material-ui/src/Autocomplete/Autocomplete.test.js @@ -34,7 +34,8 @@ function checkHighlightIs(listbox, expected) { } describe('', () => { - const render = createClientRender(); + // TODO: React18Compat + const render = createClientRender({ legacyRoot: true }); const mount = createMount(); describeConformanceV5( diff --git a/test/utils/mochaHooks.js b/test/utils/mochaHooks.js index c0fba097eb25f9..ca8464a6820391 100644 --- a/test/utils/mochaHooks.js +++ b/test/utils/mochaHooks.js @@ -93,6 +93,11 @@ function createUnexpectedConsoleMessagesHooks(Mocha, methodName, expectedMatcher } } + // FIXME: ignore act warnings + if (message.indexOf('act(...)')) { + return; + } + unexpectedCalls.push([ // first line includes the (empty) error message // i.e. Remove the `Error:` line