From ecca6347124210b598d48869558509fb9cab774c Mon Sep 17 00:00:00 2001 From: sai6855 Date: Fri, 7 Jun 2024 16:45:51 +0530 Subject: [PATCH] try zeeshan solution --- packages/mui-material/src/Tab/Tab.js | 3 +++ packages/mui-material/src/Tab/Tab.test.js | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/mui-material/src/Tab/Tab.js b/packages/mui-material/src/Tab/Tab.js index b25d9a5eae0217..d66d492fe4775f 100644 --- a/packages/mui-material/src/Tab/Tab.js +++ b/packages/mui-material/src/Tab/Tab.js @@ -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 }) => ({ diff --git a/packages/mui-material/src/Tab/Tab.test.js b/packages/mui-material/src/Tab/Tab.test.js index 01000e2c3d6819..434a8ceb5ceca4 100644 --- a/packages/mui-material/src/Tab/Tab.test.js +++ b/packages/mui-material/src/Tab/Tab.test.js @@ -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('', () => { @@ -167,4 +168,26 @@ describe('', () => { 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( + + hello} /> + , + ); + const tab = getByRole('tab'); + expect(tab).toHaveComputedStyle({ backgroundColor: 'rgb(0, 0, 255)' }); + }); });