Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Jun 6, 2024
1 parent 02ed105 commit 1933dfe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mui-material/src/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const TabRoot = styled(ButtonBase, {
styles[`textColor${capitalize(ownerState.textColor)}`],
ownerState.fullWidth && styles.fullWidth,
ownerState.wrapped && styles.wrapped,
ownerState.icon && styles.iconWrapper,
];
},
})(({ theme }) => ({
Expand Down
23 changes: 23 additions & 0 deletions packages/mui-material/src/Tab/Tab.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { spy } from 'sinon';
import { act, createRenderer, fireEvent } from '@mui/internal-test-utils';
import Tab, { tabClasses as classes } from '@mui/material/Tab';
import ButtonBase from '@mui/material/ButtonBase';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import describeConformance from '../../test/describeConformance';

describe('<Tab />', () => {
Expand Down Expand Up @@ -167,4 +168,26 @@ describe('<Tab />', () => {
expect(style).to.have.property('alignText', 'center');
});
});

it('should apply iconWrapper styles from theme to Tab', () => {
const theme = createTheme({
components: {
MuiTab: {
styleOverrides: {
iconWrapper: {
color: 'red',
},
},
},
},
});

const { getByRole } = render(
<ThemeProvider theme={theme}>
<Tab icon={<div>hello</div>} />
</ThemeProvider>,
);
const { style } = getByRole('tab');
expect(style).to.have.property('color', 'red');
});
});

0 comments on commit 1933dfe

Please sign in to comment.