Skip to content

Commit

Permalink
chore: sync with antd 3.19 (NG-ZORRO#3590)
Browse files Browse the repository at this point in the history
* chore: sync with antd 3.19

* test(module:page-header): fix test
  • Loading branch information
hsuanxyz authored and vthinkxie committed Jun 19, 2019
1 parent c85743d commit 9522658
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
8 changes: 5 additions & 3 deletions components/page-header/nz-page-header.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<ng-content select="nz-breadcrumb[nz-page-header-breadcrumb]"></ng-content>

<div *ngIf="nzBackIcon !== null" (click)="onBack()" class="ant-page-header-back-icon">
<i *ngIf="isStringBackIcon" nz-icon [type]="nzBackIcon ? nzBackIcon : 'arrow-left'" theme="outline"></i>
<ng-container *ngIf="isTemplateRefBackIcon" [ngTemplateOutlet]="nzBackIcon"></ng-container>
<div *ngIf="nzBackIcon !== null" (click)="onBack()" class="ant-page-header-back">
<div role="button" tabindex="0" class="ant-page-header-back-button">
<i *ngIf="isStringBackIcon" nz-icon [type]="nzBackIcon ? nzBackIcon : 'arrow-left'" theme="outline"></i>
<ng-container *ngIf="isTemplateRefBackIcon" [ngTemplateOutlet]="nzBackIcon"></ng-container>
</div>
<nz-divider nzType="vertical"></nz-divider>
</div>

Expand Down
13 changes: 12 additions & 1 deletion components/page-header/nz-page-header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ import { NzPageHeaderFooterDirective } from './nz-page-header-cells';
host: {
class: 'ant-page-header',
'[class.ant-page-header-has-footer]': 'nzPageHeaderFooter'
}
},
styles: [
`
.ant-page-header-back-button {
border: 0px;
background: transparent;
padding: 0px;
line-height: inherit;
display: inline-block;
}
`
]
})
export class NzPageHeaderComponent implements OnInit, OnChanges {
isTemplateRefBackIcon = false;
Expand Down
6 changes: 3 additions & 3 deletions components/page-header/nz-page-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ describe('NzPageHeaderComponent', () => {
const fixture = TestBed.createComponent(NzDemoPageHeaderBasicComponent);
const pageHeader = fixture.debugElement.query(By.directive(NzPageHeaderComponent));
fixture.detectChanges();
expect(pageHeader.nativeElement.querySelector('.ant-page-header-back-icon > i.anticon-arrow-left')).toBeTruthy();
expect(pageHeader.nativeElement.querySelector('.ant-page-header-back i.anticon-arrow-left')).toBeTruthy();
});

it('should does not have an default back icon', () => {
const fixture = TestBed.createComponent(NzDemoPageHeaderContentComponent);
const pageHeader = fixture.debugElement.query(By.directive(NzPageHeaderComponent));
fixture.detectChanges();
expect(pageHeader.nativeElement.querySelector('.ant-page-header-back-icon')).toBeFalsy();
expect(pageHeader.nativeElement.querySelector('.ant-page-header-back')).toBeFalsy();
});

it('should nzBack work', () => {
Expand All @@ -82,7 +82,7 @@ describe('NzPageHeaderComponent', () => {
spyOn(context, 'onBack');
fixture.detectChanges();
expect(context.onBack).not.toHaveBeenCalled();
const back = pageHeader.nativeElement.querySelector('.ant-page-header-back-icon');
const back = pageHeader.nativeElement.querySelector('.ant-page-header-back');
(back as HTMLElement).click();
fixture.detectChanges();
expect(context.onBack).toHaveBeenCalled();
Expand Down

0 comments on commit 9522658

Please sign in to comment.