File tree Expand file tree Collapse file tree 3 files changed +36
-8
lines changed
test/fixtures/add-identifier-and-display-name Expand file tree Collapse file tree 3 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -137,9 +137,18 @@ export default t => (path, state) => {
137137 if (
138138 path . node . tag
139139 ? isStyled ( t ) ( path . node . tag , state )
140- : isStyled ( t ) ( path . node . callee , state ) &&
141- path . node . callee . property &&
142- path . node . callee . property . name !== 'withConfig'
140+ : /* styled()`` */ ( isStyled ( t ) ( path . node . callee , state ) &&
141+ path . node . callee . property &&
142+ path . node . callee . property . name !== 'withConfig' ) ||
143+ // styled(x)({})
144+ ( isStyled ( t ) ( path . node . callee , state ) &&
145+ ! t . isMemberExpression ( path . node . callee . callee ) ) ||
146+ // styled(x).attrs()({})
147+ ( isStyled ( t ) ( path . node . callee , state ) &&
148+ t . isMemberExpression ( path . node . callee . callee ) &&
149+ path . node . callee . callee . property &&
150+ path . node . callee . callee . property . name &&
151+ path . node . callee . callee . property . name !== 'withConfig' )
143152 ) {
144153 const displayName =
145154 useDisplayName ( state ) &&
Original file line number Diff line number Diff line change 1- const Test = styled . div `width: 100%;` ;
2- const Test2 = true ? styled . div `` : styled . div `` ;
1+ const Test = styled . div `
2+ width: 100%;
3+ `
4+ const Test2 = true ? styled . div `` : styled . div ``
35const styles = { One : styled . div `` }
4- let Component ;
5- Component = styled . div `` ;
6- const WrappedComponent = styled ( Inner ) `` ;
6+ let Component
7+ Component = styled . div ``
8+ const WrappedComponent = styled ( Inner ) ``
9+ const WrappedComponent2 = styled . div ( { } )
10+ const WrappedComponent3 = styled ( Inner ) ( { } )
11+ const WrappedComponent4 = styled ( Inner ) . attrs ( ( ) => ( { something : 'else' } ) ) ( { } )
Original file line number Diff line number Diff line change @@ -24,3 +24,17 @@ const WrappedComponent = styled(Inner).withConfig({
2424 displayName : "WrappedComponent" ,
2525 componentId : "sc-1cza72q-5"
2626} ) `` ;
27+ const WrappedComponent2 = styled . div . withConfig ( {
28+ displayName : "WrappedComponent2" ,
29+ componentId : "sc-1cza72q-6"
30+ } ) ( { } ) ;
31+ const WrappedComponent3 = styled ( Inner ) . withConfig ( {
32+ displayName : "WrappedComponent3" ,
33+ componentId : "sc-1cza72q-7"
34+ } ) ( { } ) ;
35+ const WrappedComponent4 = styled ( Inner ) . attrs ( ( ) => ( {
36+ something : 'else'
37+ } ) ) . withConfig ( {
38+ displayName : "WrappedComponent4" ,
39+ componentId : "sc-1cza72q-8"
40+ } ) ( { } ) ;
You can’t perform that action at this time.
0 commit comments