Skip to content

Commit db2968e

Browse files
authored
[Modal] Remove deprecated BackdropComponent and BackdropProps from tests (#38018)
1 parent 5bedd50 commit db2968e

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

packages/mui-material/src/Modal/Modal.test.js

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('<Modal />', () => {
132132
}
133133

134134
render(
135-
<Modal open BackdropComponent={TestBackdrop}>
135+
<Modal open slots={{ backdrop: TestBackdrop }}>
136136
<div />
137137
</Modal>,
138138
);
@@ -165,7 +165,15 @@ describe('<Modal />', () => {
165165
return <div data-testid="backdrop" data-timeout={transitionDuration} />;
166166
}
167167
render(
168-
<Modal open BackdropComponent={TestBackdrop} BackdropProps={{ transitionDuration: 200 }}>
168+
<Modal
169+
open
170+
slots={{ backdrop: TestBackdrop }}
171+
slotProps={{
172+
backdrop: {
173+
transitionDuration: 200,
174+
},
175+
}}
176+
>
169177
<div />
170178
</Modal>,
171179
);
@@ -176,7 +184,15 @@ describe('<Modal />', () => {
176184
it('should attach a handler to the backdrop that fires onClose', () => {
177185
const onClose = spy();
178186
const { getByTestId } = render(
179-
<Modal onClose={onClose} open BackdropProps={{ 'data-testid': 'backdrop' }}>
187+
<Modal
188+
onClose={onClose}
189+
open
190+
slotProps={{
191+
backdrop: {
192+
'data-testid': 'backdrop',
193+
},
194+
}}
195+
>
180196
<div />
181197
</Modal>,
182198
);
@@ -220,7 +236,15 @@ describe('<Modal />', () => {
220236
it('should call through to the user specified onBackdropClick callback', () => {
221237
const onBackdropClick = spy();
222238
const { getByTestId } = render(
223-
<Modal onBackdropClick={onBackdropClick} open BackdropProps={{ 'data-testid': 'backdrop' }}>
239+
<Modal
240+
onClose={(event, reason) => {
241+
if (reason === 'backdropClick') {
242+
onBackdropClick();
243+
}
244+
}}
245+
open
246+
slotProps={{ backdrop: { 'data-testid': 'backdrop' } }}
247+
>
224248
<div />
225249
</Modal>,
226250
);
@@ -241,7 +265,15 @@ describe('<Modal />', () => {
241265
}
242266
const onBackdropClick = spy();
243267
const { getByTestId } = render(
244-
<Modal onBackdropClick={onBackdropClick} open BackdropComponent={CustomBackdrop}>
268+
<Modal
269+
onClose={(event, reason) => {
270+
if (reason === 'backdropClick') {
271+
onBackdropClick();
272+
}
273+
}}
274+
open
275+
slots={{ backdrop: CustomBackdrop }}
276+
>
245277
<div />
246278
</Modal>,
247279
);

packages/mui-material/src/Popover/Popover.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,17 @@ describe('<Popover />', () => {
8787
return <div data-testid="backdrop" data-invisible={invisible} />;
8888
}
8989
render(
90-
<Popover open anchorEl={document.createElement('div')} BackdropComponent={TestBackdrop}>
90+
<Popover
91+
open
92+
anchorEl={document.createElement('div')}
93+
slotProps={{
94+
root: {
95+
slots: {
96+
backdrop: TestBackdrop,
97+
},
98+
},
99+
}}
100+
>
91101
<div />
92102
</Popover>,
93103
);

0 commit comments

Comments
 (0)