diff --git a/components/float-button/FloatButton.tsx b/components/float-button/FloatButton.tsx index 4526ea33a4..df5cff01d7 100644 --- a/components/float-button/FloatButton.tsx +++ b/components/float-button/FloatButton.tsx @@ -53,16 +53,12 @@ const FloatButton: React.ForwardRefRenderFunction< [prefixCls, description, icon, type], ); - const buttonNode = tooltip ? ( + const buttonNode = (
- ) : ( -
- -
); if (process.env.NODE_ENV !== 'production') { diff --git a/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap index bd3606a009..88981f920b 100644 --- a/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/float-button/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -64,6 +64,28 @@ exports[`renders ./components/float-button/demo/basic.tsx extend context correct +
+
+
+
+ +
+ +
+
`; @@ -110,6 +132,28 @@ Array [
+
+
+
+
+ +
+ +
+
,
+
+
+
+
+ +
+ +
+
,
+
+
+
+
+ +
+ +
+
, ] `; @@ -219,6 +307,28 @@ Array [
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
,
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
, ] @@ -415,6 +613,28 @@ exports[`renders ./components/float-button/demo/group-menu.tsx extend context co +
+
+
+
+ +
+ +
+
`; @@ -458,6 +678,28 @@ exports[`renders ./components/float-button/demo/render-panel.tsx extend context +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
@@ -893,6 +1333,28 @@ Array [ +
+
+
+
+ +
+ +
+
, ] `; @@ -1003,6 +1465,28 @@ Array [
+
+
+
+
+ +
+ +
+
,
+
+
+
+
+ +
+ +
+
, ] `; diff --git a/components/float-button/__tests__/index.test.tsx b/components/float-button/__tests__/index.test.tsx index 826a133eea..deb8e1fa09 100644 --- a/components/float-button/__tests__/index.test.tsx +++ b/components/float-button/__tests__/index.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import FloatButton from '..'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; -import { fireEvent, render } from '../../../tests/utils'; +import { fireEvent, render, waitFakeTimer } from '../../../tests/utils'; describe('FloatButton', () => { mountTest(FloatButton); @@ -51,4 +51,15 @@ describe('FloatButton', () => { ); errSpy.mockRestore(); }); + + it('tooltip should support number `0`', async () => { + jest.useFakeTimers(); + const { container } = render(); + fireEvent.mouseEnter(container.querySelector('.ant-float-btn-body')!); + await waitFakeTimer(); + const element = container.querySelector('.ant-tooltip')?.querySelector('.ant-tooltip-inner'); + expect(element?.textContent).toBe('0'); + jest.clearAllTimers(); + jest.useRealTimers(); + }); });