Skip to content

Commit

Permalink
try zeeshan solution
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Jun 7, 2024
1 parent 2a2ff79 commit ecca634
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/mui-material/src/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const TabRoot = styled(ButtonBase, {
styles[`textColor${capitalize(ownerState.textColor)}`],
ownerState.fullWidth && styles.fullWidth,
ownerState.wrapped && styles.wrapped,
{
[`& .${tabClasses.iconWrapper}`]: 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 { ThemeProvider, createTheme } 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', () => {
const theme = createTheme({
components: {
MuiTab: {
styleOverrides: {
iconWrapper: {
backgroundColor: 'rgb(0, 0, 255)',
},
},
},
},
});

const { getByRole } = render(
<ThemeProvider theme={theme}>
<Tab icon={<div>hello</div>} />
</ThemeProvider>,
);
const tab = getByRole('tab');
expect(tab).toHaveComputedStyle({ backgroundColor: 'rgb(0, 0, 255)' });
});
});

0 comments on commit ecca634

Please sign in to comment.