Skip to content

Commit f45efa7

Browse files
committed
chore: clean code
1 parent 7c36d0d commit f45efa7

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

src/Tooltip.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ const Tooltip = (props: TooltipProps, ref: React.Ref<TooltipRef>) => {
115115
);
116116

117117
const getChildren = () => {
118-
if (!React.isValidElement(children)) {
119-
return <span>{children}</span>;
120-
}
121-
122118
const originalProps = (children as React.ReactElement)?.props || {};
123119

124120
const childProps = {

tests/index.test.tsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -279,35 +279,5 @@ describe('rc-tooltip', () => {
279279
expect(tooltipElement.style.backgroundColor).toBe('blue');
280280
expect(tooltipBodyElement.style.color).toBe('red');
281281
});
282-
283-
it('should wrap invalid children with span', () => {
284-
const { container } = render(
285-
// @ts-expect-error
286-
<Tooltip overlay="tip">
287-
plain text
288-
</Tooltip>,
289-
);
290-
291-
const span = container.querySelector('span');
292-
expect(span).toBeTruthy();
293-
expect(span.textContent).toBe('plain text');
294-
});
295-
296-
it('should handle null and false children', () => {
297-
const { container: container1 } = render(
298-
<Tooltip overlay="tip">
299-
{null}
300-
</Tooltip>,
301-
);
302-
expect(container1.querySelector('span')).toBeTruthy();
303-
304-
const { container: container2 } = render(
305-
<Tooltip overlay="tip">
306-
{/* @ts-expect-error */}
307-
{false}
308-
</Tooltip>,
309-
);
310-
expect(container2.querySelector('span')).toBeTruthy();
311-
});
312282
});
313283

0 commit comments

Comments
 (0)