Skip to content

Commit

Permalink
[Checkbox] Fix disableRipple regression (#44099)
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp authored Oct 14, 2024
1 parent c8c7b5e commit 56a7044
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mui-material/src/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
ownerState={ownerState}
ref={ref}
className={clsx(classes.root, className)}
disableRipple={disableRipple}
{...other}
classes={classes}
/>
Expand Down
17 changes: 17 additions & 0 deletions packages/mui-material/src/Checkbox/Checkbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import FormControl from '@mui/material/FormControl';
import ButtonBase from '@mui/material/ButtonBase';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import describeConformance from '../../test/describeConformance';
import * as ripple from '../../test/ripple';

describe('<Checkbox />', () => {
const { render } = createRenderer();
Expand Down Expand Up @@ -197,4 +198,20 @@ describe('<Checkbox />', () => {

expect(fontSizeSpy.args[0][0]).to.equal('foo');
});

it('should have a ripple', async () => {
const { getByRole } = render(<Checkbox TouchRippleProps={{ className: 'touch-ripple' }} />);
const checkbox = getByRole('checkbox').parentElement;
await ripple.startTouch(checkbox);
expect(checkbox.querySelector('.touch-ripple')).not.to.equal(null);
});

it('should not have ripple', async () => {
const { getByRole } = render(
<Checkbox disableRipple TouchRippleProps={{ className: 'touch-ripple' }} />,
);
const checkbox = getByRole('checkbox').parentElement;
await ripple.startTouch(checkbox);
expect(checkbox.querySelector('.touch-ripple')).to.equal(null);
});
});

0 comments on commit 56a7044

Please sign in to comment.