Skip to content

Commit

Permalink
Fix tests related to double console calls
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 13, 2021
1 parent 417f531 commit 6c5e504
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
7 changes: 5 additions & 2 deletions packages/material-ui/src/InputBase/InputBase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,12 @@ describe('<InputBase />', () => {
</div>
</FormControl>,
);
}).toErrorDev(
}).toErrorDev([
'Material-UI: There are multiple `InputBase` components inside a FormControl.\nThis creates visual inconsistencies, only use one `InputBase`.',
);
// React 18 Strict Effects run mount effects twice
React.version.startsWith('18') &&
'Material-UI: There are multiple `InputBase` components inside a FormControl.\nThis creates visual inconsistencies, only use one `InputBase`.',
]);
});

it('should not warn if only one input is rendered', () => {
Expand Down
7 changes: 5 additions & 2 deletions packages/material-ui/src/ListItem/ListItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,12 @@ describe('<ListItem />', () => {
it('should warn (but not error) with autoFocus with a function component with no content', () => {
expect(() => {
render(<ListItem component={NoContent} autoFocus />);
}).toErrorDev(
}).toErrorDev([
'Material-UI: Unable to set focus to a ListItem whose component has not been rendered.',
);
// React 18 Strict Effects run mount effects twice
React.version.startsWith('18') &&
'Material-UI: Unable to set focus to a ListItem whose component has not been rendered.',
]);
});
});
});
Expand Down
4 changes: 4 additions & 0 deletions packages/material-ui/src/Select/Select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,10 @@ describe('<Select />', () => {
}).toErrorDev([
'Material-UI: The `value` prop must be an array',
'The above error occurred in the <ForwardRef(SelectInput)> component',
// React 18 Strict Effects run mount effects twice
React.version.startsWith('18') && 'Material-UI: The `value` prop must be an array',
React.version.startsWith('18') &&
'The above error occurred in the <ForwardRef(SelectInput)> component',
]);
const {
current: { errors },
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Tabs/Tabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,11 @@ describe('<Tabs />', () => {
);
}).toErrorDev([
'You can provide one of the following values: 1, 3',
// StrictMode renders twice
// React 18 Strict Effects run mount effects twice
React.version.startsWith('18') && 'You can provide one of the following values: 1, 3',
'You can provide one of the following values: 1, 3',
// React 18 Strict Effects run mount effects twice
React.version.startsWith('18') && 'You can provide one of the following values: 1, 3',
'You can provide one of the following values: 1, 3',
'You can provide one of the following values: 1, 3',
]);
Expand Down

0 comments on commit 6c5e504

Please sign in to comment.