@@ -810,7 +810,7 @@ test('theme values in the extend section can extend values that are depended on
810810 } )
811811} )
812812
813- test ( 'theme values in the extend section are not deeply merged' , ( ) => {
813+ test ( 'theme values in the extend section are not deeply merged when they are simple arrays ' , ( ) => {
814814 const userConfig = {
815815 theme : {
816816 extend : {
@@ -856,6 +856,76 @@ test('theme values in the extend section are not deeply merged', () => {
856856 } )
857857} )
858858
859+ test ( 'theme values in the extend section are deeply merged, when they are arrays of objects' , ( ) => {
860+ const userConfig = {
861+ theme : {
862+ extend : {
863+ typography : {
864+ ArrayArray : {
865+ css : [ { a : { backgroundColor : 'red' } } , { a : { color : 'green' } } ] ,
866+ } ,
867+ ObjectArray : {
868+ css : { a : { backgroundColor : 'red' } } ,
869+ } ,
870+ ArrayObject : {
871+ css : [ { a : { backgroundColor : 'red' } } , { a : { color : 'green' } } ] ,
872+ } ,
873+ } ,
874+ } ,
875+ } ,
876+ }
877+
878+ const defaultConfig = {
879+ prefix : '-' ,
880+ important : false ,
881+ separator : ':' ,
882+ theme : {
883+ typography : {
884+ ArrayArray : {
885+ css : [ { a : { underline : 'none' } } ] ,
886+ } ,
887+ ObjectArray : {
888+ css : [ { a : { underline : 'none' } } ] ,
889+ } ,
890+ ArrayObject : {
891+ css : { a : { underline : 'none' } } ,
892+ } ,
893+ } ,
894+ } ,
895+ variants : { } ,
896+ }
897+
898+ const result = resolveConfig ( [ userConfig , defaultConfig ] )
899+
900+ expect ( result ) . toMatchObject ( {
901+ prefix : '-' ,
902+ important : false ,
903+ separator : ':' ,
904+ theme : {
905+ typography : {
906+ ArrayArray : {
907+ css : [
908+ { a : { underline : 'none' } } ,
909+ { a : { backgroundColor : 'red' } } ,
910+ { a : { color : 'green' } } ,
911+ ] ,
912+ } ,
913+ ObjectArray : {
914+ css : [ { a : { underline : 'none' } } , { a : { backgroundColor : 'red' } } ] ,
915+ } ,
916+ ArrayObject : {
917+ css : [
918+ { a : { underline : 'none' } } ,
919+ { a : { backgroundColor : 'red' } } ,
920+ { a : { color : 'green' } } ,
921+ ] ,
922+ } ,
923+ } ,
924+ } ,
925+ variants : { } ,
926+ } )
927+ } )
928+
859929test ( 'the theme function can use a default value if the key is missing' , ( ) => {
860930 const userConfig = {
861931 theme : {
0 commit comments