test(createRenderer): add tests for portal and fix found bugs

This commit is contained in:
sh7dm
2019-10-28 19:11:29 +03:00
committed by Evan You
parent 4b9483fd5e
commit 1a361e2e71
3 changed files with 111 additions and 3 deletions

View File

@@ -680,7 +680,11 @@ export function createRenderer<
isSVG: boolean,
optimized: boolean
) {
const targetSelector = n2.props && n2.props.target
let targetSelector = n2.props && n2.props.target
if (isRef(targetSelector)) {
targetSelector = targetSelector.value
}
const { patchFlag, shapeFlag, children } = n2
if (n1 == null) {
const target = (n2.target = isString(targetSelector)
@@ -733,7 +737,7 @@ export function createRenderer<
if (targetSelector !== (n1.props && n1.props.target)) {
const nextTarget = (n2.target = isString(targetSelector)
? hostQuerySelector(targetSelector)
: null)
: targetSelector)
if (nextTarget != null) {
// move content
if (shapeFlag & ShapeFlags.TEXT_CHILDREN) {