parent
47d87ca4ad
commit
420c8f4580
@ -9,7 +9,8 @@ import {
|
|||||||
Suspense,
|
Suspense,
|
||||||
onMounted,
|
onMounted,
|
||||||
defineAsyncComponent,
|
defineAsyncComponent,
|
||||||
defineComponent
|
defineComponent,
|
||||||
|
createTextVNode
|
||||||
} from '@vue/runtime-dom'
|
} from '@vue/runtime-dom'
|
||||||
import { renderToString, SSRContext } from '@vue/server-renderer'
|
import { renderToString, SSRContext } from '@vue/server-renderer'
|
||||||
|
|
||||||
@ -47,6 +48,14 @@ describe('SSR hydration', () => {
|
|||||||
expect(container.textContent).toBe('bar')
|
expect(container.textContent).toBe('bar')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('empty text', async () => {
|
||||||
|
const { container } = mountWithHydration('<div></div>', () =>
|
||||||
|
h('div', createTextVNode(''))
|
||||||
|
)
|
||||||
|
expect(container.textContent).toBe('')
|
||||||
|
expect(`Hydration children mismatch in <div>`).not.toHaveBeenWarned()
|
||||||
|
})
|
||||||
|
|
||||||
test('comment', () => {
|
test('comment', () => {
|
||||||
const { vnode, container } = mountWithHydration('<!---->', () => null)
|
const { vnode, container } = mountWithHydration('<!---->', () => null)
|
||||||
expect(vnode.el).toBe(container.firstChild)
|
expect(vnode.el).toBe(container.firstChild)
|
||||||
|
@ -359,6 +359,8 @@ export function createHydrationFunctions(
|
|||||||
slotScopeIds,
|
slotScopeIds,
|
||||||
optimized
|
optimized
|
||||||
)
|
)
|
||||||
|
} else if (vnode.type === Text && !vnode.children) {
|
||||||
|
continue
|
||||||
} else {
|
} else {
|
||||||
hasMismatch = true
|
hasMismatch = true
|
||||||
if (__DEV__ && !hasWarned) {
|
if (__DEV__ && !hasWarned) {
|
||||||
|
Loading…
Reference in New Issue
Block a user