Skip to content

Commit

Permalink
fix: increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
EnigamaE committed Apr 26, 2024
1 parent 9899044 commit c1cfdf7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions components/drawer/__tests__/Drawer.test.tsx
Expand Up @@ -190,6 +190,22 @@ describe('Drawer', () => {
triggerMotion();
expect(wrapper.firstChild).toMatchSnapshot();
});
it('have a custom loading', () => {
const loadingContent = 'Custom Loading...';
const { container: wrapper } = render(
<Drawer
open
loading={{ indicator: <span>{loadingContent}</span>, spinning: true }}
getContainer={false}
>
Here is content of Drawer
</Drawer>,
);

triggerMotion();
const [loadingWrapper] = wrapper.getElementsByClassName('ant-spin-dot');
expect(loadingWrapper).toHaveTextContent(loadingContent);
});
});

it('support closeIcon', () => {
Expand Down
4 changes: 2 additions & 2 deletions components/drawer/index.en-US.md
Expand Up @@ -46,7 +46,7 @@ v5 use `rootClassName` & `rootStyle` to config wrapper style instead of `classNa
:::

| Props | Description | Type | Default | Version |
| --- | --- | --- | --- | --- | --- |
| --- | --- | --- | --- | --- |
| autoFocus | Whether Drawer should get focused after open | boolean | true | 4.17.0 |
| afterOpenChange | Callback after the animation ends when switching drawers | function(open) | - | |
| className | Config Drawer Panel className. Use `rootClassName` if want to config top DOM style | string | - | |
Expand All @@ -69,7 +69,7 @@ v5 use `rootClassName` & `rootStyle` to config wrapper style instead of `classNa
| styles | Semantic structure style | [Record<SemanticDOM, CSSProperties>](#semantic-dom) | - | 5.10.0 |
| size | preset size of drawer, default `378px` and large `736px` | 'default' \| 'large' | 'default' | 4.17.0 |
| title | The title for Drawer | ReactNode | - | |
| loading | Show spinning indicator | boolean \| `Omit<SpinProp, 'fullScreen' | 'tip'>` | false | 5.2.0 |
| loading | Show spinning indicator | boolean \| `Omit<SpinProp, 'fullScreen' \| 'tip'>` | false | 5.17.0 |
| open | Whether the Drawer dialog is visible or not | boolean | false | |
| width | Width of the Drawer dialog | string \| number | 378 | |
| zIndex | The `z-index` of the Drawer | number | 1000 | |
Expand Down
4 changes: 2 additions & 2 deletions components/drawer/index.zh-CN.md
Expand Up @@ -46,7 +46,7 @@ v5 使用 `rootClassName` 与 `rootStyle` 来配置最外层元素样式。原 v
:::

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- | --- |
| --- | --- | --- | --- | --- |
| autoFocus | 抽屉展开后是否将焦点切换至其 DOM 节点 | boolean | true | 4.17.0 |
| afterOpenChange | 切换抽屉时动画结束后的回调 | function(open) | - | |
| className | Drawer 容器外层 className 设置,如果需要设置最外层,请使用 rootClassName | string | - | |
Expand All @@ -68,7 +68,7 @@ v5 使用 `rootClassName` 与 `rootStyle` 来配置最外层元素样式。原 v
| style | 设计 Drawer 容器样式,如果你只需要设置内容部分请使用 `bodyStyle` | CSSProperties | - | |
| styles | 语义化结构 style | [Record<SemanticDOM, CSSProperties>](#semantic-dom) | - | 5.10.0 |
| title | 标题 | ReactNode | - | |
| loading | 显示旋转指示器 | boolean \| `Omit<SpinProp, 'fullScreen' | 'tip'>` | false | 5.2.0 |
| loading | 显示旋转指示器 | boolean \| `Omit<SpinProp, 'fullScreen' \| 'tip'>` | false | 5.17.0 |
| open | Drawer 是否可见 | boolean | - |
| width | 宽度 | string \| number | 378 | |
| zIndex | 设置 Drawer 的 `z-index` | number | 1000 | |
Expand Down

0 comments on commit c1cfdf7

Please sign in to comment.