Skip to content

Commit

Permalink
[Fab] Add disabled class to FAB button #34227
Browse files Browse the repository at this point in the history
  • Loading branch information
Meena Ramakrishnan authored and Meena Ramakrishnan committed Sep 9, 2022
1 parent 5f13a49 commit e08d0fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/mui-material/src/Fab/Fab.js
Expand Up @@ -9,11 +9,12 @@ import fabClasses, { getFabUtilityClass } from './fabClasses';
import styled from '../styles/styled';

const useUtilityClasses = (ownerState) => {
const { color, variant, classes, size } = ownerState;
const { color, variant, classes, size, disabled } = ownerState;

const slots = {
root: [
'root',
disabled && 'disabled',
variant,
`size${capitalize(size)}`,
color === 'inherit' ? 'colorInherit' : color,
Expand Down
7 changes: 7 additions & 0 deletions packages/mui-material/src/Fab/Fab.test.js
Expand Up @@ -142,6 +142,13 @@ describe('<Fab />', () => {
expect(button.querySelector('.pulsate-focus-visible')).to.equal(null);
});

it('should pass disabled class to ButtonBase', () => {
const disabledClassName = 'testDisabledClassName';
const { container } = render(<Fab disabled classes={{ disabled: disabledClassName }} />);

expect(container.querySelector('button')).to.have.class(disabledClassName);
});

it('should render Icon children with right classes', () => {
const childClassName = 'child-woof';
const iconChild = <Icon data-testid="icon" className={childClassName} />;
Expand Down

0 comments on commit e08d0fc

Please sign in to comment.