Просмотр исходного кода

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

daiwei 2 месяцев назад
Родитель
Сommit
aef545dabf
1 измененных файлов с 5 добавлено и 0 удалено
  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 () => {