Skip to content

Commit

Permalink
fix(module:drawer): drawer content cannot scroll (#2120)
Browse files Browse the repository at this point in the history
close: #2119
  • Loading branch information
hsuanxyz authored and vthinkxie committed Sep 17, 2018
1 parent fd34f8b commit e8dad8f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/drawer/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
| `[nzMask]` | Whether to show mask or not. | `boolean` | `true` |
| `[nzMaskClosable]` | Clicking on the mask (area outside the Drawer) to close the Drawer or not. | `boolean` | `true` |
| `[nzMaskStyle]` | Style for Drawer's mask element. | `object` | `{}` |
| `[nzBodyStyle]` | Body style for modal body element. Such as height, padding etc. | `object` | `{}` |
| `[nzBodyStyle]` | Body style for drawer body element. Such as height, padding etc. | `object` | `{}` |
| `[nzTitle]` | The title for Drawer. | `string` `TemplateRef<{}>` | - |
| `[nzVisible]` | Whether the Drawer dialog is visible or not. | `boolean` | `false` |
| `[nzPlacement]` | The placement of the Drawer. | `'top'` `'right'` `'bottom'` `'left'` | `'right'` |
Expand Down
2 changes: 1 addition & 1 deletion components/drawer/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ title: Drawer
| `[nzMaskClosable]` | 点击蒙层是否允许关闭 | `boolean` | `true` |
| `[nzMask]` | 是否展示遮罩 | `boolean` | `true` |
| `[nzMaskStyle]` | 遮罩样式 | `object` | `{}` |
| `[nzBodyStyle]` | Modal body 样式 | `object` | `{}` |
| `[nzBodyStyle]` | Drawer body 样式 | `object` | `{}` |
| `[nzTitle]` | 标题 | `string` `TemplateRef<{}>` | - |
| `[nzVisible]` | Drawer 是否可见 | `boolean` | - |
| `[nzPlacement]` | 抽屉的方向 | `'top'` `'right'` `'bottom'` `'left'` | `'right'` |
Expand Down
4 changes: 3 additions & 1 deletion components/drawer/nz-drawer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
[style.height]="height"
[style.transform]="transform">
<div class="ant-drawer-content">
<div class="ant-drawer-wrapper-body">
<div class="ant-drawer-wrapper-body"
[style.overflow]="isLeftOrRight ? 'auto' : null"
[style.height]="isLeftOrRight ? '100%' : null">
<div *ngIf="nzTitle" class="ant-drawer-header">
<div class="ant-drawer-title">
<ng-container [ngSwitch]="true">
Expand Down
7 changes: 7 additions & 0 deletions components/drawer/nz-drawer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ describe('NzDrawerComponent', () => {
fixture.detectChanges();
});

it('should allow scroll', () => {
component.placement = 'right';
component.open();
fixture.detectChanges();
expect((overlayContainerElement.querySelector('.ant-drawer .ant-drawer-wrapper-body') as HTMLElement).style.overflow).toBe('auto');
expect((overlayContainerElement.querySelector('.ant-drawer .ant-drawer-wrapper-body') as HTMLElement).style.height).toBe('100%');
});
});

@Component({
Expand Down

0 comments on commit e8dad8f

Please sign in to comment.