Skip to content

Commit

Permalink
Revert "[IconButton] Fix hover background color behavior (mui#43271)"
Browse files Browse the repository at this point in the history
This reverts commit d9d0a37.
  • Loading branch information
sai6855 committed Sep 11, 2024
1 parent 94cc3d0 commit 679a841
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
3 changes: 0 additions & 3 deletions packages/mui-material/src/IconButton/IconButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ const IconButton = React.forwardRef(function IconButton(inProps, ref) {
color = 'default',
disabled = false,
disableFocusRipple = false,
disableRipple = false,
size = 'medium',
...other
} = props;
Expand All @@ -175,7 +174,6 @@ const IconButton = React.forwardRef(function IconButton(inProps, ref) {
color,
disabled,
disableFocusRipple,
disableRipple,
size,
};

Expand All @@ -187,7 +185,6 @@ const IconButton = React.forwardRef(function IconButton(inProps, ref) {
centerRipple
focusRipple={!disableFocusRipple}
disabled={disabled}
disableRipple={disableRipple}
ref={ref}
{...other}
ownerState={ownerState}
Expand Down
32 changes: 1 addition & 31 deletions packages/mui-material/src/IconButton/IconButton.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { expect } from 'chai';
import PropTypes from 'prop-types';
import { createRenderer, reactMajor, fireEvent } from '@mui/internal-test-utils';
import { createRenderer, reactMajor } from '@mui/internal-test-utils';
import capitalize from '@mui/utils/capitalize';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import IconButton, { iconButtonClasses as classes } from '@mui/material/IconButton';
Expand Down Expand Up @@ -141,34 +141,4 @@ describe('<IconButton />', () => {
</ThemeProvider>
)).not.to.throw();
});

it('should apply the hover background by default', function test() {
if (!/jsdom/.test(window.navigator.userAgent)) {
this.skip();
}

const { container, getByTestId } = render(<IconButton data-testid="icon-button" />);

fireEvent.mouseMove(container.firstChild, {
clientX: 19,
});
expect(getByTestId('icon-button')).toHaveComputedStyle({
backgroundColor: 'rgba(0, 0, 0, 0.04)',
});
});

it('should not apply the hover background if disableRipple is true', function test() {
if (!/jsdom/.test(window.navigator.userAgent)) {
this.skip();
}

const { container, getByTestId } = render(
<IconButton disableRipple data-testid="icon-button" />,
);

fireEvent.mouseMove(container.firstChild, {
clientX: 19,
});
expect(getByTestId('icon-button')).toHaveComputedStyle({ backgroundColor: 'rgba(0, 0, 0, 0)' });
});
});

0 comments on commit 679a841

Please sign in to comment.