Skip to content

Commit

Permalink
[material-ui][Dialog] Remove deprecated onBackdropClick from Dialog t…
Browse files Browse the repository at this point in the history
…ests (#40505)
  • Loading branch information
sai6855 authored Jan 10, 2024
1 parent 6aadbf9 commit 334561d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/mui-material/src/Dialog/Dialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ describe('<Dialog />', () => {
const onBackdropClick = spy();
const onClose = spy();
render(
<Dialog onBackdropClick={onBackdropClick} onClose={onClose} open>
<Dialog
onClose={(event, reason) => {
onClose();
if (reason === 'backdropClick') {
onBackdropClick();
}
}}
open
>
foo
</Dialog>,
);
Expand All @@ -187,7 +195,14 @@ describe('<Dialog />', () => {
it('should ignore the backdrop click if the event did not come from the backdrop', () => {
const onBackdropClick = spy();
const { getByRole } = render(
<Dialog onBackdropClick={onBackdropClick} open>
<Dialog
onClose={(event, reason) => {
if (reason === 'backdropClick') {
onBackdropClick();
}
}}
open
>
<div tabIndex={-1}>
<h2>my dialog</h2>
</div>
Expand Down

0 comments on commit 334561d

Please sign in to comment.