Skip to content

Commit

Permalink
fix(module:drawer): fix the HTML structure of the drawer header (#4311)
Browse files Browse the repository at this point in the history
* fix(module:drawer): fix the HTML structure of the drawer header

close #4304

* fix(module:drawer): fix the template conditions

* test(module:drawer): fix test

* fix(module:drawer): fix the template conditions
  • Loading branch information
hsuanxyz authored and vthinkxie committed Oct 23, 2019
1 parent 4c10e5b commit 5cdd5db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions components/drawer/nz-drawer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
<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">
<div *ngIf="nzTitle || nzClosable"
[class.ant-drawer-header]="!!nzTitle"
[class.ant-drawer-header-no-title]="!!nzTitle">
<div *ngIf="nzTitle" class="ant-drawer-title">
<ng-container *nzStringTemplateOutlet="nzTitle"><div [innerHTML]="nzTitle"></div></ng-container>
</div>
<button *ngIf="nzClosable" (click)="closeClick()" aria-label="Close" class="ant-drawer-close">
<i nz-icon nzType="close"></i>
</button>
</div>
<button *ngIf="nzClosable" (click)="closeClick()" aria-label="Close" class="ant-drawer-close">
<span class="ant-drawer-close-x"><i nz-icon nzType="close"></i></span>
</button>
<div class="ant-drawer-body" [ngStyle]="nzBodyStyle">
<ng-template cdkPortalOutlet></ng-template>
<ng-container *ngIf="isTemplateRef(nzContent)">
Expand Down
2 changes: 1 addition & 1 deletion components/drawer/nz-drawer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe('NzDrawerComponent', () => {
component.open();
fixture.detectChanges();
expect(overlayContainerElement.querySelector('.ant-drawer')!.classList.contains('ant-drawer-open')).toBe(true);
expect(overlayContainerElement.querySelector('.ant-drawer .ant-drawer-header')).toBe(null);
expect(overlayContainerElement.querySelector('.ant-drawer .ant-drawer-title')).toBe(null);
});

it('should support string title', () => {
Expand Down

0 comments on commit 5cdd5db

Please sign in to comment.