mirror of https://github.com/vuejs/core.git
Merge 0eaeb7af1b
into ba391f5fdf
This commit is contained in:
commit
1c5f69ecb3
|
@ -872,6 +872,23 @@ describe('renderer: teleport', () => {
|
|||
// children[0] is the start anchor
|
||||
expect(tRefInMounted).toBe(target.children[1])
|
||||
})
|
||||
|
||||
// 8146
|
||||
test(`ensure correct rendering when target is empty`, async () => {
|
||||
const root = nodeOps.createElement('div')
|
||||
const App = {
|
||||
setup() {
|
||||
return () => h(Teleport, { to: null }, h('div', 'teleported'))
|
||||
},
|
||||
}
|
||||
render(h(App), root)
|
||||
await nextTick()
|
||||
expect(serializeInner(root)).toMatchInlineSnapshot(
|
||||
`"<!--teleport start--><div>teleported</div><!--teleport end-->"`,
|
||||
)
|
||||
expect(`Invalid Teleport target: null`).toHaveBeenWarnedTimes(1)
|
||||
expect(`Invalid Teleport target on mount`).toHaveBeenWarnedTimes(1)
|
||||
})
|
||||
}
|
||||
|
||||
test('handle update and hmr rerender', async () => {
|
||||
|
|
|
@ -158,7 +158,7 @@ export const TeleportImpl = {
|
|||
}
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
if (disabled || !target) {
|
||||
mount(container, mainAnchor)
|
||||
updateCssVars(n2, true)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue