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 @@ -96,6 +96,37 @@ describe('suspense hydration', () => {
9696 } ) ;
9797 } ) ;
9898
99+ it ( 'should correct processed empty result of lazy component' , ( ) => {
100+ scratch . innerHTML = '<main><p>i am not from lazy</p></main>' ;
101+ clearLog ( ) ;
102+
103+ const [ Lazy , resolve ] = createLazy ( ) ;
104+ hydrate (
105+ < main >
106+ < Suspense fallback = { < p > will be never showed while hydration</ p > } >
107+ < Lazy />
108+ </ Suspense >
109+ < p > i am not from lazy</ p >
110+ </ main > ,
111+ scratch
112+ ) ;
113+ rerender ( ) ; // Flush rerender queue to mimic what preact will really do
114+ expect ( scratch . innerHTML ) . to . equal (
115+ '<main><p>i am not from lazy</p></main>'
116+ ) ;
117+ expect ( getLog ( ) ) . to . deep . equal ( [ ] ) ;
118+ clearLog ( ) ;
119+
120+ return resolve ( ( ) => null ) . then ( ( ) => {
121+ rerender ( ) ;
122+ expect ( scratch . innerHTML ) . to . equal (
123+ '<main><p>i am not from lazy</p></main>'
124+ ) ;
125+ expect ( getLog ( ) ) . to . deep . equal ( [ ] ) ;
126+ clearLog ( ) ;
127+ } ) ;
128+ } ) ;
129+
99130 it ( 'should properly attach event listeners when suspending while hydrating' , ( ) => {
100131 scratch . innerHTML = '<div>Hello</div><div>World</div>' ;
101132 clearLog ( ) ;
You can’t perform that action at this time.
0 commit comments