@@ -90,20 +90,35 @@ describe('processVnodeData', () => {
9090 } ) ;
9191 } ) ;
9292
93- it ( 'should yield while eagerly deserializing container state before resume' , async ( ) => {
94- const serializedItems : unknown [ ] = [ ] ;
95- const expectedItems : number [ ] = [ ] ;
93+ it ( 'should yield while preprocessing container state without eager deserialization' , async ( ) => {
94+ const stateItems : unknown [ ] = [ TypeIds . VNode , '4' ] ;
9695 for ( let i = 0 ; i < 128 ; i ++ ) {
97- serializedItems . push ( TypeIds . Plain , i ) ;
98- expectedItems . push ( i ) ;
96+ stateItems . push ( TypeIds . Plain , i ) ;
9997 }
100- const stateData = JSON . stringify ( [ TypeIds . Array , serializedItems ] ) ;
98+ const stateData = JSON . stringify ( stateItems ) ;
99+ const vData =
100+ emitVNodeSeparators ( 0 , 2 ) +
101+ 'G2' +
102+ emitVNodeSeparators ( 2 , 4 ) +
103+ VNodeDataSeparator . REFERENCE_CH +
104+ emitVNodeSeparators ( 4 , 5 ) +
105+ 'FB' ;
101106 const document = createDocument ( {
102107 html : `
103108 <html q:container="paused" q:locale="" q:base="" q:instance="" q:manifest-hash="">
104109 <head :></head>
105110 <body :>
106- <script type="qwik/vnode"></script>
111+ <!--q:ignore=abc-->
112+ <section>
113+ <div>
114+ <!--q:container-island=some-id-2-->
115+ <span :><button :>Click</button></span>
116+ <!--/q:container-island-->
117+ </div>
118+ </section>
119+ <!--/q:ignore-->
120+ <b :>After!</b>
121+ <script type="qwik/vnode">${ vData } </script>
107122 <script type="qwik/state">${ stateData } </script>
108123 </body>
109124 </html>
@@ -130,7 +145,10 @@ describe('processVnodeData', () => {
130145
131146 await ready ;
132147 expect ( chunks ) . toBeGreaterThan ( 1 ) ;
133- expect ( container . $getObjectById$ ( 0 ) ) . toEqual ( expectedItems ) ;
148+ expect ( container . $getObjectById$ ( 1 ) ) . toBe ( 0 ) ;
149+ expect ( ( document . documentElement as ContainerElement ) . qVNodeRefs ?. get ( 4 ) ) . toBe (
150+ document . querySelector ( 'button' )
151+ ) ;
134152 expect ( document . documentElement . getAttribute ( QContainerAttr ) ) . toBe ( QContainerValue . RESUMED ) ;
135153 } ) ;
136154 } ) ;
0 commit comments