Skip to content

Commit 03289f9

Browse files
committed
test: add test for hydrate Static vnode
1 parent 8d4c569 commit 03289f9

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

packages/runtime-core/__tests__/hydration.spec.ts

+27
Original file line numberDiff line numberDiff line change
@@ -1050,4 +1050,31 @@ describe('SSR hydration', () => {
10501050
expect(`Hydration children mismatch`).toHaveBeenWarned()
10511051
})
10521052
})
1053+
1054+
// #6008
1055+
describe('hydrate Static vnode', () => {
1056+
test('domType is ELEMENT should match', () => {
1057+
const html = ` A <wbr> <code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`
1058+
const { vnode, container } = mountWithHydration(html, () =>
1059+
createStaticVNode(
1060+
` A <wbr> <code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`,
1061+
18
1062+
)
1063+
)
1064+
expect(vnode.el).toBe(container.firstChild)
1065+
expect(`Hydration node mismatch`).not.toHaveBeenWarned()
1066+
})
1067+
1068+
test('domType is TEXT should match', () => {
1069+
const html = `<wbr>A<wbr><code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`
1070+
const { vnode, container } = mountWithHydration(html, () =>
1071+
createStaticVNode(
1072+
`<wbr>A<wbr><code>0</code> <wbr> B <wbr> <code>1</code> C <code>2</code> <wbr> D <wbr> <code>E</code>`,
1073+
18
1074+
)
1075+
)
1076+
expect(vnode.el).toBe(container.firstChild)
1077+
expect(`Hydration node mismatch`).not.toHaveBeenWarned()
1078+
})
1079+
})
10531080
})

0 commit comments

Comments
 (0)