From fc206c7e5514acaf5e660cc20878f4df9a9ec57e Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sun, 6 Jan 2019 18:28:16 +0800 Subject: [PATCH] chore: fix isValidElement --- components/_util/props-util.js | 6 +++++- .../tooltip/__tests__/__snapshots__/demo.test.js.snap | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/_util/props-util.js b/components/_util/props-util.js index 3a4c0566c..00da029f5 100644 --- a/components/_util/props-util.js +++ b/components/_util/props-util.js @@ -252,7 +252,11 @@ export function mergeProps () { } function isValidElement (element) { - return element && typeof element === 'object' && ('componentOptions' in element && 'context' in element) + return element && + typeof element === 'object' && + 'componentOptions' in element && + 'context' in element && + element.tag !== undefined // remove text node } export { diff --git a/components/tooltip/__tests__/__snapshots__/demo.test.js.snap b/components/tooltip/__tests__/__snapshots__/demo.test.js.snap index 76c55f688..b279e5f74 100644 --- a/components/tooltip/__tests__/__snapshots__/demo.test.js.snap +++ b/components/tooltip/__tests__/__snapshots__/demo.test.js.snap @@ -4,7 +4,11 @@ exports[`renders ./components/tooltip/demo/arrow-point-at-center.md correctly 1` exports[`renders ./components/tooltip/demo/auto-adjust-overflow.md correctly 1`] = `
`; -exports[`renders ./components/tooltip/demo/basic.md correctly 1`] = `undefined`; +exports[`renders ./components/tooltip/demo/basic.md correctly 1`] = ` + + Tooltip will show when mouse enter. + +`; exports[`renders ./components/tooltip/demo/placement.md correctly 1`] = `