Browse Source

test(runtime-vapor): add assertions for listRef after timeout in KeepAlive branch switch

daiwei 2 months ago
parent
commit
aef545dabf
1 changed files with 5 additions and 0 deletions
  1. 5 0
      packages/runtime-vapor/__tests__/components/KeepAlive.spec.ts

+ 5 - 0
packages/runtime-vapor/__tests__/components/KeepAlive.spec.ts

@@ -2530,6 +2530,11 @@ describe('VaporKeepAlive', () => {
         },
       }),
     )
+
+    await timeout()
+    await nextTick()
+    expect(listRef.value).toHaveLength(2)
+    expect(listRef.value.map(item => item.name).sort()).toEqual(['B', 'C'])
   })
 
   test('should clear old ref when switching KeepAlive branches', async () => {