@@ -4,6 +4,7 @@ import { spy } from 'sinon';
4
4
import { act , createRenderer , fireEvent } from '@mui-internal/test-utils' ;
5
5
import Tab , { tabClasses as classes } from '@mui/material/Tab' ;
6
6
import ButtonBase from '@mui/material/ButtonBase' ;
7
+ import { ThemeProvider , createTheme } from '@mui/material/styles' ;
7
8
import describeConformance from '../../test/describeConformance' ;
8
9
9
10
describe ( '<Tab />' , ( ) => {
@@ -167,4 +168,32 @@ describe('<Tab />', () => {
167
168
expect ( style ) . to . have . property ( 'alignText' , 'center' ) ;
168
169
} ) ;
169
170
} ) ;
171
+
172
+ it ( 'should apply iconWrapper styles from theme' , function test ( ) {
173
+ if ( / j s d o m / . test ( window . navigator . userAgent ) ) {
174
+ this . skip ( ) ;
175
+ }
176
+
177
+ const theme = createTheme ( {
178
+ components : {
179
+ MuiTab : {
180
+ styleOverrides : {
181
+ iconWrapper : {
182
+ backgroundColor : 'rgb(0, 0, 255)' ,
183
+ } ,
184
+ } ,
185
+ } ,
186
+ } ,
187
+ } ) ;
188
+
189
+ const { getByRole } = render (
190
+ < ThemeProvider theme = { theme } >
191
+ < Tab icon = { < div > hello</ div > } label = "icon" />
192
+ </ ThemeProvider > ,
193
+ ) ;
194
+ const icon = getByRole ( 'tab' ) . querySelector ( `.${ classes . iconWrapper } ` ) ;
195
+ expect ( icon ) . toHaveComputedStyle ( {
196
+ backgroundColor : 'rgb(0, 0, 255)' ,
197
+ } ) ;
198
+ } ) ;
170
199
} ) ;
0 commit comments