Skip to content

Commit d25e880

Browse files
[SnackbarContent] Fix square prop not working (#46196)
Co-authored-by: ZeeshanTamboli <[email protected]>
1 parent 6f22130 commit d25e880

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

packages/mui-material/src/SnackbarContent/SnackbarContent.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const SnackbarContentRoot = styled(Paper, {
4141
alignItems: 'center',
4242
flexWrap: 'wrap',
4343
padding: '6px 16px',
44-
borderRadius: (theme.vars || theme).shape.borderRadius,
4544
flexGrow: 1,
4645
[theme.breakpoints.up('sm')]: {
4746
flexGrow: 'initial',
@@ -78,7 +77,6 @@ const SnackbarContent = React.forwardRef(function SnackbarContent(inProps, ref)
7877
return (
7978
<SnackbarContentRoot
8079
role={role}
81-
square
8280
elevation={6}
8381
className={clsx(classes.root, className)}
8482
ownerState={ownerState}

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { expect } from 'chai';
3-
import { createRenderer } from '@mui/internal-test-utils';
4-
import Paper from '@mui/material/Paper';
3+
import { createRenderer, screen } from '@mui/internal-test-utils';
4+
import Paper, { paperClasses } from '@mui/material/Paper';
55
import SnackbarContent, { snackbarContentClasses as classes } from '@mui/material/SnackbarContent';
66
import { ThemeProvider, createTheme } from '@mui/material/styles';
77
import describeConformance from '../../test/describeConformance';
@@ -75,4 +75,18 @@ describe('<SnackbarContent />', () => {
7575
).not.to.throw();
7676
});
7777
});
78+
79+
describe('prop: square', () => {
80+
it('should disable the rounded class when square is true', () => {
81+
render(<SnackbarContent data-testid="snackbar" message="test" square />);
82+
83+
expect(screen.getByTestId('snackbar')).not.to.have.class(paperClasses.rounded);
84+
});
85+
86+
it('should apply the rounded class when square is not passed', () => {
87+
render(<SnackbarContent data-testid="snackbar" message="test" />);
88+
89+
expect(screen.getByTestId('snackbar')).to.have.class(paperClasses.rounded);
90+
});
91+
});
7892
});

0 commit comments

Comments
 (0)