File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,37 @@ describe('suspense hydration', () => {
121121 } ) ;
122122 } ) ;
123123
124+ it ( 'should correct processed empty result of lazy component' , ( ) => {
125+ scratch . innerHTML = '<main><p>i am not from lazy</p></main>' ;
126+ clearLog ( ) ;
127+
128+ const [ Lazy , resolve ] = createLazy ( ) ;
129+ hydrate (
130+ < main >
131+ < Suspense fallback = { < p > will be never showed while hydration</ p > } >
132+ < Lazy />
133+ </ Suspense >
134+ < p > i am not from lazy</ p >
135+ </ main > ,
136+ scratch
137+ ) ;
138+ rerender ( ) ; // Flush rerender queue to mimic what preact will really do
139+ expect ( scratch . innerHTML ) . to . equal (
140+ '<main><p>i am not from lazy</p></main>'
141+ ) ;
142+ expect ( getLog ( ) ) . to . deep . equal ( [ ] ) ;
143+ clearLog ( ) ;
144+
145+ return resolve ( ( ) => null ) . then ( ( ) => {
146+ rerender ( ) ;
147+ expect ( scratch . innerHTML ) . to . equal (
148+ '<main><p>i am not from lazy</p></main>'
149+ ) ;
150+ expect ( getLog ( ) ) . to . deep . equal ( [ ] ) ;
151+ clearLog ( ) ;
152+ } ) ;
153+ } ) ;
154+
124155 it ( 'should properly attach event listeners when suspending while hydrating' , ( ) => {
125156 scratch . innerHTML = '<div>Hello</div><div>World</div>' ;
126157 clearLog ( ) ;
You can’t perform that action at this time.
0 commit comments