@@ -3987,21 +3987,19 @@ export const App = () => <Input readOnly value="test" />;
39873987 { adapter : fixtureAdapter } ,
39883988 ) ;
39893989 expect ( result . code ) . not . toBeNull ( ) ;
3990- // The base has physical longhands (from "8px 12px").
3990+ // The base has logical longhands (from "8px 12px" → paddingBlock/paddingInline ).
39913991 // The readonly block has padding: 0 which should be expanded to match.
3992- expect ( result . code ) . toContain ( "paddingTop" ) ;
3993- expect ( result . code ) . toContain ( "paddingRight" ) ;
3994- expect ( result . code ) . toContain ( "paddingBottom" ) ;
3995- expect ( result . code ) . toContain ( "paddingLeft" ) ;
3992+ expect ( result . code ) . toContain ( "paddingBlock" ) ;
3993+ expect ( result . code ) . toContain ( "paddingInline" ) ;
39963994 // The readonly style should NOT have the shorthand "padding" since it conflicts
3997- // with the base's physical longhands.
3995+ // with the base's logical longhands.
39983996 const readonlyMatch = result . code ! . match ( / i n p u t R e a d o n l y : \s * \{ ( [ ^ } ] + ) \} / ) ;
39993997 expect ( readonlyMatch ) . toBeTruthy ( ) ;
40003998 const readonlyBlock = readonlyMatch ! [ 1 ] ! ;
40013999 // Should have expanded longhands, not shorthand
4002- expect ( readonlyBlock ) . not . toMatch ( / \b p a d d i n g \b (? ! T o p | R i g h t | B o t t o m | L e f t ) / ) ;
4003- expect ( readonlyBlock ) . toContain ( "paddingTop " ) ;
4004- expect ( readonlyBlock ) . toContain ( "paddingLeft " ) ;
4000+ expect ( readonlyBlock ) . not . toMatch ( / \b p a d d i n g \b (? ! B l o c k | I n l i n e ) / ) ;
4001+ expect ( readonlyBlock ) . toContain ( "paddingBlock " ) ;
4002+ expect ( readonlyBlock ) . toContain ( "paddingInline " ) ;
40054003 } ) ;
40064004} ) ;
40074005
@@ -4059,18 +4057,16 @@ export const App = () => <Input />;
40594057 ) ;
40604058 expect ( result . code ) . not . toBeNull ( ) ;
40614059 // The base has paddingBlock (logical). The conditional has padding: 8px 12px.
4062- // The expansion should produce physical longhands: paddingTop: 8, paddingRight: 12, etc.
4063- expect ( result . code ) . toContain ( "paddingTop: 8" ) ;
4064- expect ( result . code ) . toContain ( "paddingRight: 12" ) ;
4065- expect ( result . code ) . toContain ( "paddingBottom: 8" ) ;
4066- expect ( result . code ) . toContain ( "paddingLeft: 12" ) ;
4060+ // Both expand to logical longhands (default), so no conflict normalization needed.
4061+ expect ( result . code ) . toContain ( "paddingBlock: 8" ) ;
4062+ expect ( result . code ) . toContain ( "paddingInline: 12" ) ;
40674063 // Should NOT have the unsplit value
40684064 expect ( result . code ) . not . toContain ( '"8px 12px"' ) ;
40694065 } ) ;
40704066} ) ;
40714067
4072- describe ( "useLogicalProperties adapter option" , ( ) => {
4073- it ( "should expand 2-value padding to logical properties when enabled " , ( ) => {
4068+ describe ( "usePhysicalProperties adapter option" , ( ) => {
4069+ it ( "should expand 2-value padding to logical properties by default " , ( ) => {
40744070 const source = `
40754071import styled from "styled-components";
40764072
@@ -4083,7 +4079,7 @@ export const App = () => <Box>test</Box>;
40834079 const result = transformWithWarnings (
40844080 { source, path : "test.tsx" } ,
40854081 { jscodeshift : j , j, stats : ( ) => { } , report : ( ) => { } } ,
4086- { adapter : { ... fixtureAdapter , useLogicalProperties : true } } ,
4082+ { adapter : fixtureAdapter } ,
40874083 ) ;
40884084 expect ( result . code ) . not . toBeNull ( ) ;
40894085 expect ( result . code ) . toContain ( "paddingBlock" ) ;
@@ -4092,7 +4088,7 @@ export const App = () => <Box>test</Box>;
40924088 expect ( result . code ) . not . toContain ( "paddingRight" ) ;
40934089 } ) ;
40944090
4095- it ( "should expand 2-value padding to physical properties when disabled (default) " , ( ) => {
4091+ it ( "should expand 2-value padding to physical properties when usePhysicalProperties is true " , ( ) => {
40964092 const source = `
40974093import styled from "styled-components";
40984094
@@ -4105,7 +4101,7 @@ export const App = () => <Box>test</Box>;
41054101 const result = transformWithWarnings (
41064102 { source, path : "test.tsx" } ,
41074103 { jscodeshift : j , j, stats : ( ) => { } , report : ( ) => { } } ,
4108- { adapter : fixtureAdapter } ,
4104+ { adapter : { ... fixtureAdapter , usePhysicalProperties : true } } ,
41094105 ) ;
41104106 expect ( result . code ) . not . toBeNull ( ) ;
41114107 expect ( result . code ) . toContain ( "paddingTop" ) ;
0 commit comments