Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Nov 26, 2022
1 parent 70114ee commit 84bcab4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/runtime-core/__tests__/hydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,24 @@ describe('SSR hydration', () => {
expect((vnode as any).component?.subTree.children[0].el).toBe(text)
})

// #7215
test('empty text node', () => {
const txt = ref('')
const Comp = {
render(this: any) {
return h('p', [ txt.value ])
}
}
const { container } = mountWithHydration('<p></p>', () =>
h(Comp)
)
expect(container.childNodes.length).toBe(1)
const p = container.childNodes[0]
expect(p.childNodes.length).toBe(1)
const text = p.childNodes[0]
expect(text.nodeType).toBe(3)
})

test('app.unmount()', async () => {
const container = document.createElement('DIV')
container.innerHTML = '<button></button>'
Expand Down

0 comments on commit 84bcab4

Please sign in to comment.