@@ -35,6 +35,74 @@ describe('renderNode', () => {
3535 const result = renderNode ( component , props , deps , children )
3636 expect ( result ) . toBe ( expected )
3737 } )
38+
39+ test ( 'replaces boxShadow with __boxShadowToken when boxShadow is string' , ( ) => {
40+ const result = renderNode (
41+ 'Box' ,
42+ {
43+ boxShadow : '0 8px 16px 0 $shadow' ,
44+ __boxShadowToken : '$testShadow' ,
45+ } ,
46+ 0 ,
47+ [ ] ,
48+ )
49+
50+ expect ( result ) . toBe ( '<Box boxShadow="$testShadow" />' )
51+ } )
52+
53+ test ( 'does not replace boxShadow with __boxShadowToken when boxShadow is array' , ( ) => {
54+ const result = renderNode (
55+ 'Box' ,
56+ {
57+ boxShadow : [ '0 8px 16px 0 $shadow' , null , '$testShadow' ] ,
58+ __boxShadowToken : '$testShadow' ,
59+ } ,
60+ 0 ,
61+ [ ] ,
62+ )
63+
64+ expect ( result ) . toBe ( `<Box
65+ boxShadow={[
66+ "0 8px 16px 0 $shadow",
67+ null,
68+ "$testShadow"
69+ ]}
70+ />` )
71+ } )
72+
73+ test ( 'replaces textShadow with __textShadowToken when textShadow is string' , ( ) => {
74+ const result = renderNode (
75+ 'Text' ,
76+ {
77+ textShadow : '0 4px 8px $shadow' ,
78+ __textShadowToken : '$titleShadow' ,
79+ } ,
80+ 0 ,
81+ [ ] ,
82+ )
83+
84+ expect ( result ) . toBe ( '<Text textShadow="$titleShadow" />' )
85+ } )
86+
87+ test ( 'does not replace textShadow with __textShadowToken when textShadow is array' , ( ) => {
88+ const result = renderNode (
89+ 'Text' ,
90+ {
91+ textShadow : [ '0 2px 4px $shadow' , null , '$titleShadow' ] ,
92+ __textShadowToken : '$titleShadow' ,
93+ } ,
94+ 0 ,
95+ [ ] ,
96+ )
97+
98+ expect ( result ) . toBe ( `<Text
99+ textShadow={[
100+ "0 2px 4px $shadow",
101+ null,
102+ "$titleShadow"
103+ ]}
104+ />` )
105+ } )
38106} )
39107
40108/**
0 commit comments