@@ -52,4 +52,58 @@ describe('usePluginSlots', () => {
5252      expect ( slotConfig . plugins ) . toStrictEqual ( [ ] ) ; 
5353    } ) ; 
5454  } ) ; 
55+ 
56+   describe ( 'when the plugin slot is defined via alias' ,  ( )  =>  { 
57+     it ( 'returns keepDefault and plugin changes' ,  ( )  =>  { 
58+       getConfig . mockImplementation ( ( )  =>  ( 
59+         { 
60+           pluginSlots : { 
61+             example_plugin_slot_alias : { 
62+               plugins : mockSlotChanges , 
63+               keepDefault : true , 
64+             } , 
65+           } , 
66+         } 
67+       ) ) ; 
68+ 
69+       const  slotConfig  =  usePluginSlot ( 'example_plugin_slot' ,  [ 'example_plugin_slot_alias' ] ) ; 
70+       expect ( slotConfig . keepDefault ) . toBe ( true ) ; 
71+       expect ( slotConfig . plugins ) . toBe ( mockSlotChanges ) ; 
72+     } ) ; 
73+   } ) ; 
74+ 
75+   describe ( 'when no matching plugin slot is found' ,  ( )  =>  { 
76+     it ( 'returns true for keepDefault and no plugin changes' ,  ( )  =>  { 
77+       getConfig . mockImplementation ( ( )  =>  ( 
78+         { 
79+           pluginSlots : { 
80+             wrong_plugin_slot_alias : { 
81+               plugins : mockSlotChanges , 
82+               keepDefault : true , 
83+             } , 
84+           } , 
85+         } 
86+       ) ) ; 
87+ 
88+       const  slotConfig  =  usePluginSlot ( 'example_plugin_slot' ,  [ 'example_plugin_slot_alias' ] ) ; 
89+       expect ( slotConfig . keepDefault ) . toBe ( true ) ; 
90+       expect ( slotConfig . plugins ) . toStrictEqual ( [ ] ) ; 
91+     } ) ; 
92+   } ) ; 
93+ 
94+   describe ( 'when the defined plugin is null' ,  ( )  =>  { 
95+     it ( 'returns true for keepDefault and no plugin changes' ,  ( )  =>  { 
96+       getConfig . mockImplementation ( ( )  =>  ( 
97+         { 
98+           pluginSlots : { 
99+             example_plugin_slot_alias : null , 
100+           } , 
101+         } 
102+       ) ) ; 
103+ 
104+       const  slotConfig  =  usePluginSlot ( 'example_plugin_slot' ,  [ 'example_plugin_slot_alias' ] ) ; 
105+       expect ( slotConfig . keepDefault ) . toBe ( true ) ; 
106+       expect ( slotConfig . plugins ) . toStrictEqual ( [ ] ) ; 
107+     } ) ; 
108+   } ) ; 
55109} ) ; 
0 commit comments