From a9496dedb847f488791904d9bab986a9e0f912d1 Mon Sep 17 00:00:00 2001 From: daiwei Date: Tue, 29 Apr 2025 15:37:42 +0800 Subject: [PATCH] test: more tests --- .../runtime-vapor/__tests__/hydration.spec.ts | 31 ++++++++++++++----- packages/runtime-vapor/src/component.ts | 2 +- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/runtime-vapor/__tests__/hydration.spec.ts b/packages/runtime-vapor/__tests__/hydration.spec.ts index 5e369e3439..fbc27f1d41 100644 --- a/packages/runtime-vapor/__tests__/hydration.spec.ts +++ b/packages/runtime-vapor/__tests__/hydration.spec.ts @@ -252,6 +252,19 @@ describe('Vapor Mode hydration', () => { `"
bar
"`, ) }) + + test('element with ref', async () => { + const { data, container } = await testHydration( + ` + `, + {}, + ref(null), + ) + + expect(data.value).toBe(container.firstChild) + }) }) describe('component', () => { @@ -2343,14 +2356,16 @@ describe('Vapor Mode hydration', () => { }) }) - // test('element with ref', () => { - // const el = ref() - // const { vnode, container } = mountWithHydration('
', () => - // h('div', { ref: el }), - // ) - // expect(vnode.el).toBe(container.firstChild) - // expect(el.value).toBe(vnode.el) - // }) + describe.todo('transition', async () => { + test('transition appear', async () => {}) + test('transition appear with v-if', async () => {}) + test('transition appear with v-show', async () => {}) + test('transition appear w/ event listener', async () => {}) + }) + + describe.todo('async component') + + describe.todo('data-allow-mismatch') // test('with data-allow-mismatch component when using onServerPrefetch', async () => { // const Comp = { diff --git a/packages/runtime-vapor/src/component.ts b/packages/runtime-vapor/src/component.ts index 23b54acc70..e0396aa2e7 100644 --- a/packages/runtime-vapor/src/component.ts +++ b/packages/runtime-vapor/src/component.ts @@ -278,7 +278,7 @@ export function createComponent( onScopeDispose(() => unmountComponent(instance), true) if (!isHydrating && _insertionParent) { - insert(instance.block, _insertionParent, _insertionAnchor) + mountComponent(instance, _insertionParent, _insertionAnchor) } return instance -- 2.47.3