File tree Expand file tree Collapse file tree 1 file changed +8
-20
lines changed
packages/material-ui/src/styles Expand file tree Collapse file tree 1 file changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -97,38 +97,26 @@ describe('experimentalStyled', () => {
9797 } ) ;
9898
9999 describe ( 'dynamic styles' , ( ) => {
100- /**
101- * @type {ReturnType<typeof styled> }
102- */
103- let Div ;
104-
105- /**
106- * @type {ReturnType<typeof styled> }
107- */
108- let DivObj ;
109-
110- before ( ( ) => {
111- Div = styled ( 'div' ) `
100+ it ( 'can adapt styles to props' , ( ) => {
101+ const Div = styled ( 'div' ) `
112102 font-size: ${ ( props ) => props . scale * 8 } px;
113103 padding-left: ${ ( props ) => props . scale * 2 } px;
114104 ` ;
115-
116- DivObj = styled ( 'div' ) ( ( props ) => ( {
117- fontSize : `${ props . scale * 8 } px` ,
118- paddingLeft : `${ props . scale * 2 } px` ,
119- } ) ) ;
120- } ) ;
121-
122- it ( 'can adapt styles to props' , ( ) => {
123105 render ( < Div scale = { 4 } data-testid = "target" /> ) ;
106+
124107 expect ( screen . getByTestId ( 'target' ) ) . toHaveComputedStyle ( {
125108 fontSize : '32px' ,
126109 paddingLeft : '8px' ,
127110 } ) ;
128111 } ) ;
129112
130113 it ( 'can adapt styles to props when styles are object' , ( ) => {
114+ const DivObj = styled ( 'div' ) ( ( props ) => ( {
115+ fontSize : `${ props . scale * 8 } px` ,
116+ paddingLeft : `${ props . scale * 2 } px` ,
117+ } ) ) ;
131118 render ( < DivObj scale = { 4 } data-testid = "target" /> ) ;
119+
132120 expect ( screen . getByTestId ( 'target' ) ) . toHaveComputedStyle ( {
133121 fontSize : '32px' ,
134122 paddingLeft : '8px' ,
You can’t perform that action at this time.
0 commit comments