-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
/
Copy pathreact-next.diff
247 lines (240 loc) · 11.4 KB
/
react-next.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
index 8addf692fb..86ea6e6dfa 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
@@ -1139,8 +1139,6 @@ describe('<Autocomplete />', () => {
fireEvent.change(textbox, { target: { value: 'a' } });
fireEvent.keyDown(textbox, { key: 'Enter' });
}).toErrorDev([
- 'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
- // strict mode renders twice
'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',
@@ -1195,9 +1193,6 @@ describe('<Autocomplete />', () => {
/>,
);
}).toWarnDev([
- 'None of the options match with `"not a good value"`',
- // strict mode renders twice
- 'None of the options match with `"not a good value"`',
'None of the options match with `"not a good value"`',
'None of the options match with `"not a good value"`',
]);
@@ -1223,11 +1218,7 @@ describe('<Autocomplete />', () => {
groupBy={(option) => option.group}
/>,
);
- }).toWarnDev([
- // strict mode renders twice
- 'returns duplicated headers',
- 'returns duplicated headers',
- ]);
+ }).toWarnDev(['returns duplicated headers']);
const options = screen.getAllByRole('option').map((el) => el.textContent);
expect(options).to.have.length(7);
expect(options).to.deep.equal(['A', 'D', 'E', 'B', 'G', 'F', 'C']);
diff --git a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
index 197b2f77a3..f1ead08079 100644
--- a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
+++ b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
@@ -127,11 +127,7 @@ describe('ThemeProvider', () => {
<div />
</ThemeProvider>,
);
- }).toErrorDev([
- 'However, no outer theme is present.',
- // strict mode renders twice
- 'However, no outer theme is present.',
- ]);
+ }).toErrorDev(['However, no outer theme is present.']);
});
it('should warn about wrong theme function', () => {
@@ -144,11 +140,7 @@ describe('ThemeProvider', () => {
,
</ThemeProvider>,
);
- }).toErrorDev([
- 'Material-UI: You should return an object from your theme function',
- // strict mode renders twice
- 'Material-UI: You should return an object from your theme function',
- ]);
+ }).toErrorDev(['Material-UI: You should return an object from your theme function']);
});
});
});
diff --git a/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js b/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js
index 9c99a49a1f..5d9db342e9 100644
--- a/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js
+++ b/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js
@@ -127,11 +127,6 @@ describe('useThemeVariants', () => {
</ThemeProvider>,
),
).toErrorDev([
- // strict mode renders twice
- [
- `Material-UI: You are using a variant value \`test\` for which you didn't define styles.`,
- `Please create a new variant matcher in your theme for this variant. To learn more about matchers visit https://next.material-ui.com/r/custom-component-variants.`,
- ].join('\n'),
[
`Material-UI: You are using a variant value \`test\` for which you didn't define styles.`,
`Please create a new variant matcher in your theme for this variant. To learn more about matchers visit https://next.material-ui.com/r/custom-component-variants.`,
diff --git a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js
index 55a501a6e6..8cabc24615 100644
--- a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js
+++ b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js
@@ -100,7 +100,6 @@ describe('<Breadcrumbs />', () => {
);
}).toErrorDev([
'Material-UI: You have provided an invalid combination of props to the Breadcrumbs.\nitemsAfterCollapse={2} + itemsBeforeCollapse={2} >= maxItems={3}',
- 'Material-UI: You have provided an invalid combination of props to the Breadcrumbs.\nitemsAfterCollapse={2} + itemsBeforeCollapse={2} >= maxItems={3}',
]);
expect(screen.getAllByRole('listitem', { hidden: false })).to.have.length(4);
expect(screen.getByRole('list')).to.have.text('first/second/third/fourth');
diff --git a/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js b/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js
index d78203151f..72ac37571b 100644
--- a/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js
+++ b/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js
@@ -132,8 +132,7 @@ describe('<ClickAwayListener />', () => {
expect(handleClickAway.callCount).to.equal(0);
fireEvent.click(getByText('Stop inside a portal'));
- // True-negative, we don't have enough information to do otherwise.
- expect(handleClickAway.callCount).to.equal(1);
+ expect(handleClickAway.callCount).to.equal(0);
});
});
diff --git a/packages/material-ui/src/Tabs/Tabs.test.js b/packages/material-ui/src/Tabs/Tabs.test.js
index 9c004c515b..648559f279 100644
--- a/packages/material-ui/src/Tabs/Tabs.test.js
+++ b/packages/material-ui/src/Tabs/Tabs.test.js
@@ -90,9 +90,6 @@ describe('<Tabs />', () => {
expect(() => {
render(<Tabs value={0} centered variant="scrollable" />);
}).toErrorDev([
- 'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
- // StrictMode renders twice
- 'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
]);
diff --git a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
index 9cd267a0c0..7323483c87 100644
--- a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
+++ b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
@@ -255,12 +255,7 @@ describe('<TextareaAutosize />', () => {
expect(() => {
forceUpdate();
- }).toErrorDev([
- 'Material-UI: Too many re-renders.',
- // strict mode renders twice
- 'Material-UI: Too many re-renders.',
- 'Material-UI: Too many re-renders.',
- ]);
+ }).toErrorDev(['Material-UI: Too many re-renders.']);
});
});
});
diff --git a/packages/material-ui/src/internal/SwitchBase.test.js b/packages/material-ui/src/internal/SwitchBase.test.js
index 8c8f59a9d8..657a5e57bc 100644
--- a/packages/material-ui/src/internal/SwitchBase.test.js
+++ b/packages/material-ui/src/internal/SwitchBase.test.js
@@ -366,7 +366,7 @@ describe('<SwitchBase />', () => {
setProps({ checked: true });
global['didWarnControlledToUncontrolled'] = true;
}).toErrorDev([
- 'Warning: A component is changing an uncontrolled input of type checkbox to be controlled.',
+ 'Warning: A component is changing an uncontrolled input to be controlled.',
'Material-UI: A component is changing the uncontrolled checked state of SwitchBase to be controlled.',
]);
});
@@ -387,7 +387,7 @@ describe('<SwitchBase />', () => {
setProps({ checked: undefined });
global['didWarnControlledToUncontrolled'] = true;
}).toErrorDev([
- 'Warning: A component is changing a controlled input of type checkbox to be uncontrolled.',
+ 'Warning: A component is changing a controlled input to be uncontrolled',
'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 3fba3ffab7..532c206595 100644
--- a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
+++ b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
@@ -275,11 +275,7 @@ describe('useMediaQuery', () => {
expect(() => {
render(<MyComponent />);
- }).toErrorDev([
- 'Material-UI: The `query` argument provided is invalid',
- // logs warning twice in StrictMode
- 'Material-UI: The `query` argument provided is invalid',
- ]);
+ }).toErrorDev(['Material-UI: The `query` argument provided is invalid']);
});
});
});
diff --git a/packages/material-ui/src/utils/useIsFocusVisible.test.js b/packages/material-ui/src/utils/useIsFocusVisible.test.js
index fdf6df9a0d..aaa3ad1552 100644
--- a/packages/material-ui/src/utils/useIsFocusVisible.test.js
+++ b/packages/material-ui/src/utils/useIsFocusVisible.test.js
@@ -5,17 +5,6 @@ import { createMount } from 'test/utils';
import useIsFocusVisible, { teardown as teardownFocusVisible } from './useIsFocusVisible';
import useForkRef from './useForkRef';
-function dispatchFocusVisible(element) {
- element.ownerDocument.dispatchEvent(new window.Event('keydown'));
- element.focus();
-}
-
-function simulatePointerDevice() {
- // first focus on a page triggers focus visible until a pointer event
- // has been dispatched
- document.dispatchEvent(new window.Event('pointerdown'));
-}
-
const SimpleButton = React.forwardRef(function SimpleButton(props, ref) {
const {
isFocusVisibleRef,
@@ -85,31 +74,20 @@ describe('focus-visible polyfill', () => {
it('should set focus state for shadowRoot children', () => {
const buttonRef = React.createRef();
- mount(
- <SimpleButton id="test-button" ref={buttonRef}>
- Hello
- </SimpleButton>,
- {
- attachTo: rootElement.shadowRoot,
- },
- );
- simulatePointerDevice();
-
- const { current: button } = buttonRef;
- if (button.nodeName !== 'BUTTON') {
- throw new Error('missing button');
- }
-
- expect(button.classList.contains('focus-visible')).to.equal(false);
-
- button.focus();
-
- expect(button.classList.contains('focus-visible')).to.equal(false);
-
- button.blur();
- dispatchFocusVisible(button);
-
- expect(button.classList.contains('focus-visible')).to.equal(true);
+ expect(() => {
+ expect(() => {
+ mount(
+ <SimpleButton id="test-button" ref={buttonRef}>
+ Hello
+ </SimpleButton>,
+ {
+ attachTo: rootElement.shadowRoot,
+ },
+ );
+ }).to.throw(
+ 'ensureListeningTo(): received a container that was not an element node. This is likely a bug in React.',
+ );
+ }).toErrorDev(['The above error occurred in the <button> component']);
});
});
});