]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: more tests
authordaiwei <daiwei521@126.com>
Tue, 29 Apr 2025 07:37:42 +0000 (15:37 +0800)
committerdaiwei <daiwei521@126.com>
Tue, 29 Apr 2025 07:51:47 +0000 (15:51 +0800)
packages/runtime-vapor/__tests__/hydration.spec.ts
packages/runtime-vapor/src/component.ts

index 5e369e3439d34c9d55f2c557cb0d47d7a1485936..fbc27f1d4192f156d0eea023a38f57f2b6f8ec2f 100644 (file)
@@ -252,6 +252,19 @@ describe('Vapor Mode hydration', () => {
         `"<div><span>bar</span><span class="bar"></span></div>"`,
       )
     })
+
+    test('element with ref', async () => {
+      const { data, container } = await testHydration(
+        `<template>
+          <div ref="data">hi</div>
+        </template>
+      `,
+        {},
+        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('<div></div>', () =>
-  //     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 = {
index 23b54acc70edee03f413d77b5c2b176c934e9693..e0396aa2e71e462c0a52c4c2b43f7690436cb038 100644 (file)
@@ -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