Skip to content

Commit

Permalink
[core] Fix react next patch and prevent regression (#21482)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 17, 2020
1 parent ff6bde2 commit 151fa81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
22 changes: 9 additions & 13 deletions scripts/react-next.diff
@@ -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 5e83281c0..3c995f97c 100644
index 2f3ea31dc..4ad337e85 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
@@ -963,7 +963,7 @@ describe('<Autocomplete />', () => {
@@ -1018,7 +1018,7 @@ describe('<Autocomplete />', () => {
fireEvent.keyDown(textbox, { key: 'Enter' });
expect(handleChange.callCount).to.equal(1);
expect(handleChange.args[0][1]).to.equal('a');
Expand All @@ -11,7 +11,7 @@ index 5e83281c0..3c995f97c 100644
expect(consoleErrorMock.messages()[0]).to.include(
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
);
@@ -993,7 +993,7 @@ describe('<Autocomplete />', () => {
@@ -1070,7 +1070,7 @@ describe('<Autocomplete />', () => {
/>,
);

Expand All @@ -20,7 +20,7 @@ index 5e83281c0..3c995f97c 100644
expect(consoleWarnMock.messages()[0]).to.include(
'None of the options match with `"not a good value"`',
);
@@ -1022,7 +1022,7 @@ describe('<Autocomplete />', () => {
@@ -1099,7 +1099,7 @@ describe('<Autocomplete />', () => {
const options = getAllByRole('option').map((el) => el.textContent);
expect(options).to.have.length(7);
expect(options).to.deep.equal(['A', 'D', 'E', 'B', 'G', 'F', 'C']);
Expand All @@ -30,7 +30,7 @@ index 5e83281c0..3c995f97c 100644
});
});
diff --git a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
index 5c9d0be26..7f0862466 100644
index 9013d9095..7f0862466 100644
--- a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
+++ b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
@@ -135,7 +135,7 @@ describe('ThemeProvider', () => {
Expand Down Expand Up @@ -65,7 +65,7 @@ index ed0e37f21..49d8ea9b0 100644
'Material-UI: You have provided an invalid combination of props to the Breadcrumbs.\nitemsAfterCollapse={2} + itemsBeforeCollapse={2} >= maxItems={3}',
);
diff --git a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
index cea126a0d..1eaf80628 100644
index 09daadd96..1eaf80628 100644
--- a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
+++ b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
@@ -261,7 +261,7 @@ describe('<TextareaAutosize />', () => {
Expand Down Expand Up @@ -100,19 +100,15 @@ index 41a38bc07..c9397fd13 100644
expect(consoleErrorMock.messages()[1]).to.include(
'Material-UI: A component is changing the controlled checked state of SwitchBase to be uncontrolled.',
diff --git a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
index 68b0a4a5c..e31152c44 100644
index ba9977d1a..b5ca0ca4b 100644
--- a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
+++ b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
@@ -284,14 +284,10 @@ describe('useMediaQuery', () => {
}
@@ -285,7 +285,7 @@ describe('useMediaQuery', () => {

render(<MyComponent />);
- // logs warning twice in StrictMode
// logs warning twice in StrictMode
- expect(consoleErrorMock.callCount()).to.equal(2); // strict mode renders twice
+ expect(consoleErrorMock.callCount()).to.equal(1);
expect(consoleErrorMock.messages()[0]).to.include(
'Material-UI: The `query` argument provided is invalid',
);
});
});
});
9 changes: 1 addition & 8 deletions scripts/use-react-dist-tag.js
Expand Up @@ -51,14 +51,7 @@ async function main(distTag) {
// add newline for clean diff
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}${os.EOL}`);

try {
await exec(`git apply ${path.resolve(__dirname, `./react-${distTag}.diff`)}`);
} catch (error) {
// ignore if the patch doesn't exist
if (error.code !== 128) {
throw error;
}
}
await exec(`git apply ${path.resolve(__dirname, `./react-${distTag}.diff`)}`);
}

main(process.env.REACT_DIST_TAG).catch((error) => {
Expand Down

0 comments on commit 151fa81

Please sign in to comment.