Sfoglia il codice sorgente

wip(vapor): test cases

Evan You 1 anno fa
parent
commit
e5e4d295ba
1 ha cambiato i file con 30 aggiunte e 6 eliminazioni
  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 () => {
   test.todo('component with anchor insertion', async () => {
     const { container, data } = await testHydration(
     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>`,
         Child: `<template>{{ data }}</template>`,
       },
       },
     )
     )
-    expect(container.innerHTML).toMatchInlineSnapshot(
-      `"<div><span></span>foo<span></span></div>"`,
-    )
+    expect(container.innerHTML).toMatchInlineSnapshot()
 
 
     data.value = 'bar'
     data.value = 'bar'
     await nextTick()
     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')
   test.todo('if')