wip(vapor): test cases

This commit is contained in:
Evan You 2025-03-12 09:18:57 +08:00
parent 2a76b52d7f
commit e5e4d295ba
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
1 changed files with 30 additions and 6 deletions

View File

@ -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( expect(container.innerHTML).toMatchInlineSnapshot()
`"<div><span></span>foo<span></span></div>"`,
)
data.value = 'bar' data.value = 'bar'
await nextTick() await nextTick()
expect(container.innerHTML).toMatchInlineSnapshot( expect(container.innerHTML).toMatchInlineSnapshot()
`"<div><span></span>foo<span></span></div>"`, })
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')