From 00ff574950ef09ede5b368ee8688e31c124654bf Mon Sep 17 00:00:00 2001
From: aleksandrjet
Date: Mon, 17 Jul 2023 09:36:45 +0300
Subject: [PATCH] added test for empty lazy component
---
.../test/browser/suspense-hydration.test.js | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/compat/test/browser/suspense-hydration.test.js b/compat/test/browser/suspense-hydration.test.js
index b364cf41c6..ebb196bed1 100644
--- a/compat/test/browser/suspense-hydration.test.js
+++ b/compat/test/browser/suspense-hydration.test.js
@@ -121,6 +121,37 @@ describe('suspense hydration', () => {
});
});
+ it('should correct processed empty result of lazy component', () => {
+ scratch.innerHTML = 'i am not from lazy
';
+ clearLog();
+
+ const [Lazy, resolve] = createLazy();
+ hydrate(
+
+ will be never showed while hydration
}>
+
+
+ i am not from lazy
+ ,
+ scratch
+ );
+ rerender(); // Flush rerender queue to mimic what preact will really do
+ expect(scratch.innerHTML).to.equal(
+ 'i am not from lazy
'
+ );
+ expect(getLog()).to.deep.equal([]);
+ clearLog();
+
+ return resolve(() => null).then(() => {
+ rerender();
+ expect(scratch.innerHTML).to.equal(
+ 'i am not from lazy
'
+ );
+ expect(getLog()).to.deep.equal([]);
+ clearLog();
+ });
+ });
+
it('should properly attach event listeners when suspending while hydrating', () => {
scratch.innerHTML = 'Hello
World
';
clearLog();