Skip to content

Commit

Permalink
[test] Update react next patch
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jul 10, 2020
1 parent d345282 commit 1bf0188
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions scripts/react-next.diff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
index 1fd4bad8b..20d22063b 100644
index af7e296af..144de6de4 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
@@ -1038,8 +1038,6 @@ describe('<Autocomplete />', () => {
@@ -1109,8 +1109,6 @@ describe('<Autocomplete />', () => {
fireEvent.change(textbox, { target: { value: 'a' } });
fireEvent.keyDown(textbox, { key: 'Enter' });
}).toErrorDev([
Expand All @@ -11,7 +11,7 @@ index 1fd4bad8b..20d22063b 100644
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
@@ -1094,9 +1092,6 @@ describe('<Autocomplete />', () => {
@@ -1165,9 +1163,6 @@ describe('<Autocomplete />', () => {
/>,
);
}).toWarnDev([
Expand All @@ -21,7 +21,7 @@ index 1fd4bad8b..20d22063b 100644
'None of the options match with `"not a good value"`',
'None of the options match with `"not a good value"`',
]);
@@ -1122,11 +1117,7 @@ describe('<Autocomplete />', () => {
@@ -1193,11 +1188,7 @@ describe('<Autocomplete />', () => {
groupBy={(option) => option.group}
/>,
);
Expand All @@ -35,7 +35,7 @@ index 1fd4bad8b..20d22063b 100644
expect(options).to.have.length(7);
expect(options).to.deep.equal(['A', 'D', 'E', 'B', 'G', 'F', 'C']);
diff --git a/packages/material-ui-lab/src/TreeView/TreeView.test.js b/packages/material-ui-lab/src/TreeView/TreeView.test.js
index 056a9fcbc..21eeee2cf 100644
index 7169af632..481b8106c 100644
--- a/packages/material-ui-lab/src/TreeView/TreeView.test.js
+++ b/packages/material-ui-lab/src/TreeView/TreeView.test.js
@@ -8,6 +8,7 @@ import { getClasses } from '@material-ui/core/test-utils';
Expand All @@ -46,16 +46,6 @@ index 056a9fcbc..21eeee2cf 100644

describe('<TreeView />', () => {
let classes;
@@ -58,7 +59,8 @@ describe('<TreeView />', () => {

// should not throw eventually or with a better error message
// FIXME: https://github.com/mui-org/material-ui/issues/20832
- it('crashes when unmounting with duplicate ids', () => {
+ // FIXME: unclear what is happening in react@next
+ it.skip('crashes when unmounting with duplicate ids', () => {
const CustomTreeItem = () => {
return <TreeItem nodeId="iojerogj" />;
};
diff --git a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
index 46238825d..bcf275893 100644
--- a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
Expand Down Expand Up @@ -156,6 +146,35 @@ index ef6533f4b..bd5633dc4 100644
});
});
});
diff --git a/packages/material-ui/src/Unstable_TrapFocus/Unstable_TrapFocus.js b/packages/material-ui/src/Unstable_TrapFocus/Unstable_TrapFocus.js
index 97fac726d..e43c9f5d4 100644
--- a/packages/material-ui/src/Unstable_TrapFocus/Unstable_TrapFocus.js
+++ b/packages/material-ui/src/Unstable_TrapFocus/Unstable_TrapFocus.js
@@ -159,11 +159,19 @@ function Unstable_TrapFocus(props) {

// restoreLastFocus()
if (!disableRestoreFocus) {
- // In IE 11 it is possible for document.activeElement to be null resulting
- // in nodeToRestore.current being null.
- // Not all elements in IE 11 have a focus method.
- // Once IE 11 support is dropped the focus() call can be unconditional.
- if (nodeToRestore.current && nodeToRestore.current.focus) {
+ if (
+ // In IE 11 it is possible for document.activeElement to be null resulting
+ // in nodeToRestore.current being null.
+ nodeToRestore.current &&
+ // Not all elements in IE 11 have a focus method.
+ // Once IE 11 support is dropped the focus() call can be unconditional.
+ nodeToRestore.current.focus &&
+ // We actually only want a WeakRef to nodeToRestore.
+ // If it's already unmounted don't restore focus to it.
+ // Can't reproduce it on an isolated test but "should trap once the focus moves inside" failed due to interleaving restore logic from the previous test.
+ // TODO: Is this a JSDOM issue?
+ nodeToRestore.current.isConnected
+ ) {
nodeToRestore.current.focus();
}

diff --git a/packages/material-ui/src/internal/SwitchBase.test.js b/packages/material-ui/src/internal/SwitchBase.test.js
index 27b143abf..7c321b14a 100644
--- a/packages/material-ui/src/internal/SwitchBase.test.js
Expand Down

0 comments on commit 1bf0188

Please sign in to comment.