Skip to content

Commit

Permalink
test: add test for hydrate Static vnode
Browse files Browse the repository at this point in the history
  • Loading branch information
liulinboyi committed May 27, 2022
1 parent 8d4c569 commit 03289f9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/runtime-core/__tests__/hydration.spec.ts
Expand Up @@ -1050,4 +1050,31 @@ describe('SSR hydration', () => {
expect(`Hydration children mismatch`).toHaveBeenWarned()
})
})

// #6008
describe('hydrate Static vnode', () => {
test('domType is ELEMENT should match', () => {
const html = ` A <wbr> <code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`
const { vnode, container } = mountWithHydration(html, () =>
createStaticVNode(
` A <wbr> <code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`,
18
)
)
expect(vnode.el).toBe(container.firstChild)
expect(`Hydration node mismatch`).not.toHaveBeenWarned()
})

test('domType is TEXT should match', () => {
const html = `<wbr>A<wbr><code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`
const { vnode, container } = mountWithHydration(html, () =>
createStaticVNode(
`<wbr>A<wbr><code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`,
18
)
)
expect(vnode.el).toBe(container.firstChild)
expect(`Hydration node mismatch`).not.toHaveBeenWarned()
})
})
})

0 comments on commit 03289f9

Please sign in to comment.