Procházet zdrojové kódy

wip(vapor): test cases

Evan You před 1 rokem
rodič
revize
e5e4d295ba
1 změnil soubory, kde provedl 30 přidání a 6 odebrání
  1. 30 6
      packages/runtime-vapor/__tests__/hydration.spec.ts

+ 30 - 6
packages/runtime-vapor/__tests__/hydration.spec.ts

@@ -243,21 +243,45 @@ describe('Vapor Mode hydration', () => {
   test.todo('component with anchor insertion', async () => {
     const { container, data } = await testHydration(
       `
-      <template><div><span/><components.Child/><span/></div></template>
+      <template>
+        <div>
+          <span/>
+          <components.Child/>
+          <span/>
+        </div>
+      </template>
       `,
       {
         Child: `<template>{{ data }}</template>`,
       },
     )
-    expect(container.innerHTML).toMatchInlineSnapshot(
-      `"<div><span></span>foo<span></span></div>"`,
-    )
+    expect(container.innerHTML).toMatchInlineSnapshot()
 
     data.value = 'bar'
     await nextTick()
-    expect(container.innerHTML).toMatchInlineSnapshot(
-      `"<div><span></span>foo<span></span></div>"`,
+    expect(container.innerHTML).toMatchInlineSnapshot()
+  })
+
+  test.todo('consecutive component with anchor insertion', async () => {
+    const { container, data } = await testHydration(
+      `<template>
+        <div>
+          <span/>
+          <components.Child/>
+          <components.Child/>
+          <span/>
+        </div>
+      </template>
+      `,
+      {
+        Child: `<template>{{ data }}</template>`,
+      },
     )
+    expect(container.innerHTML).toMatchInlineSnapshot()
+
+    data.value = 'bar'
+    await nextTick()
+    expect(container.innerHTML).toMatchInlineSnapshot()
   })
 
   test.todo('if')