@@ -922,7 +922,9 @@ describe('SSR hydration', () => {
922
922
] )
923
923
}
924
924
}
925
- const { container, vnode } = mountWithHydration ( '<!--[--><!--]-->' , ( ) => h ( Comp ) )
925
+ const { container, vnode } = mountWithHydration ( '<!--[--><!--]-->' , ( ) =>
926
+ h ( Comp )
927
+ )
926
928
expect ( container . childNodes . length ) . toBe ( 3 )
927
929
const text = container . childNodes [ 1 ]
928
930
expect ( text . nodeType ) . toBe ( 3 )
@@ -931,6 +933,33 @@ describe('SSR hydration', () => {
931
933
expect ( ( vnode as any ) . component ?. subTree . children [ 0 ] . el ) . toBe ( text )
932
934
} )
933
935
936
+ test ( 'app.unmount()' , async ( ) => {
937
+ const container = document . createElement ( 'DIV' )
938
+ container . innerHTML = '<button></button>'
939
+ const App = defineComponent ( {
940
+ setup ( _ , { expose } ) {
941
+ const count = ref ( 0 )
942
+
943
+ expose ( { count } )
944
+
945
+ return ( ) =>
946
+ h ( 'button' , {
947
+ onClick : ( ) => count . value ++
948
+ } )
949
+ }
950
+ } )
951
+
952
+ const app = createSSRApp ( App )
953
+ const vm = app . mount ( container )
954
+ await nextTick ( )
955
+ expect ( ( container as any ) . _vnode ) . toBeDefined ( )
956
+ // @ts -expect-error - expose()'d properties are not available on vm type
957
+ expect ( vm . count ) . toBe ( 0 )
958
+
959
+ app . unmount ( )
960
+ expect ( ( container as any ) . _vnode ) . toBe ( null )
961
+ } )
962
+
934
963
describe ( 'mismatch handling' , ( ) => {
935
964
test ( 'text node' , ( ) => {
936
965
const { container } = mountWithHydration ( `foo` , ( ) => 'bar' )
0 commit comments