From ca34d4aa29381052760c74d8fbfa4898b89fb13d Mon Sep 17 00:00:00 2001 From: daiwei Date: Sat, 26 Apr 2025 21:12:07 +0800 Subject: [PATCH] wip: add more tests --- .../runtime-vapor/__tests__/hydration.spec.ts | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/packages/runtime-vapor/__tests__/hydration.spec.ts b/packages/runtime-vapor/__tests__/hydration.spec.ts index d8c40bdc6..016872b56 100644 --- a/packages/runtime-vapor/__tests__/hydration.spec.ts +++ b/packages/runtime-vapor/__tests__/hydration.spec.ts @@ -98,7 +98,57 @@ describe('Vapor Mode hydration', () => { expect(container.innerHTML).toMatchInlineSnapshot(`"bar"`) }) - test.todo('consecutive text nodes', () => {}) + test('consecutive text nodes', async () => { + const { data, container } = await testHydration(` + + `) + expect(container.innerHTML).toMatchInlineSnapshot(`"foofoo"`) + + data.value = 'bar' + await nextTick() + expect(container.innerHTML).toMatchInlineSnapshot(`"barbar"`) + }) + + test('consecutive text nodes with anchor insertion', async () => { + const { data, container } = await testHydration(` + + `) + expect(container.innerHTML).toMatchInlineSnapshot( + `"foofoo"`, + ) + + data.value = 'bar' + await nextTick() + expect(container.innerHTML).toMatchInlineSnapshot( + `"barbar"`, + ) + }) + + test('mixed text nodes', async () => { + const { data, container } = await testHydration(` + + `) + expect(container.innerHTML).toMatchInlineSnapshot(`"fooAfooBfoo"`) + + data.value = 'bar' + await nextTick() + expect(container.innerHTML).toMatchInlineSnapshot(`"barAbarBbar"`) + }) + + test('mixed text nodes with anchor insertion', async () => { + const { data, container } = await testHydration(` + + `) + expect(container.innerHTML).toMatchInlineSnapshot( + `"fooAfooBfoo"`, + ) + + data.value = 'bar' + await nextTick() + expect(container.innerHTML).toMatchInlineSnapshot( + `"barAbarBbar"`, + ) + }) }) describe('element', () => {