mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
test: add test case (#41369)
* test: add test case * update docs * Update components/float-button/index.en-US.md Co-authored-by: MadCcc <1075746765@qq.com> * Update components/float-button/index.zh-CN.md Co-authored-by: MadCcc <1075746765@qq.com> * fix --------- Co-authored-by: MadCcc <1075746765@qq.com>
This commit is contained in:
parent
f6c235462e
commit
1005d5c5a9
@ -70,4 +70,16 @@ describe('FloatButton', () => {
|
||||
const result2 = getOffset(1);
|
||||
expect(result2).not.toBe(0);
|
||||
});
|
||||
|
||||
it('support badge number', () => {
|
||||
const { container } = render(<FloatButton badge={{ count: 10 }} />);
|
||||
const badgeElement = container?.querySelector<HTMLSpanElement>('.ant-float-btn .ant-badge');
|
||||
expect(badgeElement?.querySelector<HTMLElement>('.ant-badge-count')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('support badge dot', () => {
|
||||
const { container } = render(<FloatButton badge={{ dot: true }} />);
|
||||
const badgeElement = container?.querySelector<HTMLSpanElement>('.ant-float-btn .ant-badge');
|
||||
expect(badgeElement?.querySelector<HTMLElement>('.ant-badge-dot')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ FloatButton. Available since `5.0.0`.
|
||||
| onClick | Set the handler to handle `click` event | (event) => void | - | |
|
||||
| href | The target of hyperlink | string | - | |
|
||||
| target | Specifies where to display the linked URL | string | - | |
|
||||
| badge | float-button with round logo number | refer [badge](/components/badge#api) | - | 5.4.0 |
|
||||
| badge | Attach Badge to FloatButton. `status` `size` and other props related are not supported. | [BadgeProps](/components/badge#api) | - | 5.4.0 |
|
||||
|
||||
### FloatButton.Group
|
||||
|
||||
|
@ -47,7 +47,7 @@ demo:
|
||||
| onClick | 点击按钮时的回调 | (event) => void | - | |
|
||||
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
|
||||
| target | 相当于 a 标签的 target 属性,href 存在时生效 | string | - | |
|
||||
| badge | 带圆形徽标数字的悬浮按钮 | 参考[badge](/components/badge-cn#api) | - | 5.4.0 |
|
||||
| badge | 带徽标数字的悬浮按钮(不支持 `status` `size` 以及相关属性) | [BadgeProps](/components/badge-cn#api) | - | 5.4.0 |
|
||||
|
||||
### FloatButton.Group
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user