Skip to content

[SnackbarContent] Fix square prop not working #46196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/mui-material/src/SnackbarContent/SnackbarContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const SnackbarContentRoot = styled(Paper, {
alignItems: 'center',
flexWrap: 'wrap',
padding: '6px 16px',
borderRadius: (theme.vars || theme).shape.borderRadius,
flexGrow: 1,
[theme.breakpoints.up('sm')]: {
flexGrow: 'initial',
Expand Down Expand Up @@ -78,7 +77,6 @@ const SnackbarContent = React.forwardRef(function SnackbarContent(inProps, ref)
return (
<SnackbarContentRoot
role={role}
square
elevation={6}
className={clsx(classes.root, className)}
ownerState={ownerState}
Expand Down
16 changes: 16 additions & 0 deletions packages/mui-material/src/SnackbarContent/SnackbarContent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,20 @@ describe('<SnackbarContent />', () => {
).not.to.throw();
});
});

describe('prop: square', () => {
it('should disable the rounded class when square is true', () => {
const { getByTestId } = render(
<SnackbarContent data-testid="snackbar" message="test" square />,
);

expect(getByTestId('snackbar')).not.to.have.class('MuiPaper-rounded');
});

it('should apply the rounded class when square is not passed', () => {
const { getByTestId } = render(<SnackbarContent data-testid="snackbar" message="test" />);

expect(getByTestId('snackbar')).to.have.class('MuiPaper-rounded');
});
});
});
Loading