From b5762b57aeaac32c3d25730391617fe2e8cbf75b Mon Sep 17 00:00:00 2001 From: daiwei Date: Thu, 24 Apr 2025 09:26:33 +0800 Subject: [PATCH] wip: add tests + skip fragment end anchor --- .../runtime-vapor/__tests__/hydration.spec.ts | 189 ++++++++++++++++++ packages/runtime-vapor/src/dom/node.ts | 7 +- 2 files changed, 194 insertions(+), 2 deletions(-) diff --git a/packages/runtime-vapor/__tests__/hydration.spec.ts b/packages/runtime-vapor/__tests__/hydration.spec.ts index 67f5c634b..ecb8d8202 100644 --- a/packages/runtime-vapor/__tests__/hydration.spec.ts +++ b/packages/runtime-vapor/__tests__/hydration.spec.ts @@ -264,6 +264,48 @@ describe('Vapor Mode hydration', () => { ) }) + test('nested components with anchor insertion', async () => { + const { container, data } = await testHydration( + ` + + `, + { + Parent: ``, + Child: ``, + }, + ) + expect(container.innerHTML).toMatchInlineSnapshot( + `"
foo
"`, + ) + + data.value = 'bar' + await nextTick() + expect(container.innerHTML).toMatchInlineSnapshot( + `"
bar
"`, + ) + }) + + test('nested components with multi level anchor insertion', async () => { + const { container, data } = await testHydration( + ` + + `, + { + Parent: ``, + Child: ``, + }, + ) + expect(container.innerHTML).toMatchInlineSnapshot( + `"
foo
"`, + ) + + data.value = 'bar' + await nextTick() + expect(container.innerHTML).toMatchInlineSnapshot( + `"
bar
"`, + ) + }) + test('consecutive components with anchor insertion', async () => { const { container, data } = await testHydration( `