File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
packages/runtime-vapor/__tests__ Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 provide ,
1515 ref ,
1616 renderSlot ,
17+ resolveDynamicComponent ,
1718 shallowRef ,
1819 toDisplayString ,
1920 useModel ,
@@ -323,7 +324,38 @@ describe('vdomInterop', () => {
323324 } )
324325 } )
325326
326- describe . todo ( 'dynamic component' , ( ) => { } )
327+ describe ( 'dynamic component' , ( ) => {
328+ it ( 'dynamic component with vapor child' , async ( ) => {
329+ const VaporChild = defineVaporComponent ( {
330+ setup ( ) {
331+ return template ( '<div>vapor child</div>' ) ( ) as any
332+ } ,
333+ } )
334+
335+ const VdomChild = defineComponent ( {
336+ setup ( ) {
337+ return ( ) => h ( 'div' , 'vdom child' )
338+ } ,
339+ } )
340+
341+ const view = shallowRef < any > ( VaporChild )
342+ const { html } = define ( {
343+ setup ( ) {
344+ return ( ) => h ( resolveDynamicComponent ( view . value ) as any )
345+ } ,
346+ } ) . render ( )
347+
348+ expect ( html ( ) ) . toBe ( '<div>vapor child</div>' )
349+
350+ view . value = VdomChild
351+ await nextTick ( )
352+ expect ( html ( ) ) . toBe ( '<div>vdom child</div>' )
353+
354+ view . value = VaporChild
355+ await nextTick ( )
356+ expect ( html ( ) ) . toBe ( '<div>vapor child</div>' )
357+ } )
358+ } )
327359
328360 describe ( 'attribute fallthrough' , ( ) => {
329361 it ( 'should fallthrough attrs to vdom child' , ( ) => {
You can’t perform that action at this time.
0 commit comments