@@ -56,10 +56,31 @@ describe('SSR hydration', () => {
56
56
test ( 'static' , ( ) => {
57
57
const html = '<div><span>hello</span></div>'
58
58
const { vnode, container } = mountWithHydration ( html , ( ) =>
59
- createStaticVNode ( html )
59
+ createStaticVNode ( '' , 1 )
60
60
)
61
61
expect ( vnode . el ) . toBe ( container . firstChild )
62
62
expect ( vnode . el . outerHTML ) . toBe ( html )
63
+ expect ( vnode . anchor ) . toBe ( container . firstChild )
64
+ expect ( vnode . children ) . toBe ( html )
65
+ } )
66
+
67
+ test ( 'static (multiple elements)' , ( ) => {
68
+ const staticContent = '<div></div><span>hello</span>'
69
+ const html = `<div><div>hi</div>` + staticContent + `<div>ho</div></div>`
70
+
71
+ const n1 = h ( 'div' , 'hi' )
72
+ const s = createStaticVNode ( '' , 2 )
73
+ const n2 = h ( 'div' , 'ho' )
74
+
75
+ const { container } = mountWithHydration ( html , ( ) => h ( 'div' , [ n1 , s , n2 ] ) )
76
+
77
+ const div = container . firstChild !
78
+
79
+ expect ( n1 . el ) . toBe ( div . firstChild )
80
+ expect ( n2 . el ) . toBe ( div . lastChild )
81
+ expect ( s . el ) . toBe ( div . childNodes [ 1 ] )
82
+ expect ( s . anchor ) . toBe ( div . childNodes [ 2 ] )
83
+ expect ( s . children ) . toBe ( staticContent )
63
84
} )
64
85
65
86
test ( 'element with text children' , async ( ) => {
0 commit comments