From b03cb784c1ff7982957a3f1ae8dad15ed008a5f1 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Thu, 18 Jul 2024 20:59:14 +0200 Subject: [PATCH] add additional test --- .../test/browser/suspense-hydration.test.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/compat/test/browser/suspense-hydration.test.js b/compat/test/browser/suspense-hydration.test.js index a90f2c7a18..010aa15832 100644 --- a/compat/test/browser/suspense-hydration.test.js +++ b/compat/test/browser/suspense-hydration.test.js @@ -131,6 +131,38 @@ describe('suspense hydration', () => { }); }); + it('Should hydrate a fragment with no children correctly', () => { + scratch.innerHTML = '
Hello world
'; + clearLog(); + + const [Lazy, resolve] = createLazy(); + hydrate( + <> + + + +
Hello world
+ , + scratch + ); + rerender(); // Flush rerender queue to mimic what preact will really do + expect(scratch.innerHTML).to.equal( + '
Hello world
' + ); + expect(getLog()).to.deep.equal([]); + clearLog(); + + return resolve(() => null).then(() => { + rerender(); + expect(scratch.innerHTML).to.equal( + '
Hello world
' + ); + expect(getLog()).to.deep.equal([]); + + clearLog(); + }); + }); + it('should leave DOM untouched when suspending while hydrating', () => { scratch.innerHTML = '
Hello
'; clearLog();