Skip to content

Commit fc206c7

Browse files
committed
chore: fix isValidElement
1 parent bbc6c29 commit fc206c7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

components/_util/props-util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ export function mergeProps () {
252252
}
253253

254254
function isValidElement (element) {
255-
return element && typeof element === 'object' && ('componentOptions' in element && 'context' in element)
255+
return element &&
256+
typeof element === 'object' &&
257+
'componentOptions' in element &&
258+
'context' in element &&
259+
element.tag !== undefined // remove text node
256260
}
257261

258262
export {

components/tooltip/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ exports[`renders ./components/tooltip/demo/arrow-point-at-center.md correctly 1`
44

55
exports[`renders ./components/tooltip/demo/auto-adjust-overflow.md correctly 1`] = `<div style="overflow: hidden; position: relative; padding: 24px; border: 1px solid #e9e9e9;"><button type="button" class="ant-btn ant-btn-default"><span>Adjust automatically / 自动调整</span></button> <br> <button type="button" class="ant-btn ant-btn-default" style="margin-top: 10px;"><span>Ingore / 不处理</span></button></div>`;
66
7-
exports[`renders ./components/tooltip/demo/basic.md correctly 1`] = `undefined`;
7+
exports[`renders ./components/tooltip/demo/basic.md correctly 1`] = `
8+
<span class="">
9+
Tooltip will show when mouse enter.
10+
</span>
11+
`;
812
913
exports[`renders ./components/tooltip/demo/placement.md correctly 1`] = `
1014
<div id="components-a-tooltip-demo-placement">

0 commit comments

Comments
 (0)