File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,24 @@ describe('The `addToRegistry` helper', () => {
142142 }
143143 } ) ;
144144
145+ it ( 'should register child components' , async ( ) => {
146+ const registry = ( globalThis . __JS_TOOLKIT_REGISTRY__ ??= new Map ( ) ) ;
147+ const Child = withName ( Base , 'Child' ) ;
148+ const Parent = withName ( Base , 'Parent' ) ;
149+ Parent . config . components = { Child, div : Child } ;
150+
151+ addToRegistry ( 'Parent' , Parent ) ;
152+
153+ expect ( registry . has ( 'Parent' ) ) . toBe ( true ) ;
154+ expect ( registry . get ( 'Parent' ) ) . toBe ( Parent ) ;
155+
156+ expect ( registry . has ( 'Child' ) ) . toBe ( true ) ;
157+ expect ( registry . get ( 'Child' ) ) . toBe ( Child ) ;
158+
159+ expect ( registry . has ( 'div' ) ) . toBe ( true ) ;
160+ expect ( registry . get ( 'div' ) ) . toBe ( Child ) ;
161+ } ) ;
162+
145163 it ( 'should mount components newly injected in the DOM' , async ( ) => {
146164 const DynamicComponent = withName ( Base , 'DynamicComponent' ) ;
147165
You can’t perform that action at this time.
0 commit comments