From 6818d4b663c3c04263d271ed6e87d2919c5e8b71 Mon Sep 17 00:00:00 2001 From: chenc Date: Tue, 7 Jun 2022 11:33:23 +0800 Subject: [PATCH 1/6] fix(module:pagination): add ul tag --- .../pagination-default.component.ts | 40 ++++++++-------- .../pagination/pagination-simple.component.ts | 48 ++++++++++--------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/components/pagination/pagination-default.component.ts b/components/pagination/pagination-default.component.ts index b15b1fccaf..40e5b7c765 100644 --- a/components/pagination/pagination-default.component.ts +++ b/components/pagination/pagination-default.component.ts @@ -38,25 +38,27 @@ import { PaginationItemRenderContext } from './pagination.types'; changeDetection: ChangeDetectionStrategy.OnPush, template: ` -
  • - -
  • -
  • +
    -
  • -
  • - - / - {{ lastIndex }} -
  • -
  • +
      +
    • +
    • + + / + {{ lastIndex }} +
    • +
    • +
    ` }) From 8f8114a6a01918dfa91afa62884c784f18c037ec Mon Sep 17 00:00:00 2001 From: chenc Date: Tue, 7 Jun 2022 11:56:17 +0800 Subject: [PATCH 2/6] fix(module:pagination): sync dom structure with antd --- .../pagination-default.component.ts | 30 +++++++++---------- .../pagination-options.component.ts | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/components/pagination/pagination-default.component.ts b/components/pagination/pagination-default.component.ts index 40e5b7c765..d9adf17571 100644 --- a/components/pagination/pagination-default.component.ts +++ b/components/pagination/pagination-default.component.ts @@ -58,22 +58,22 @@ import { PaginationItemRenderContext } from './pagination.types'; (diffIndex)="jumpDiff($event)" [direction]="dir" > +
  • -
    ` }) diff --git a/components/pagination/pagination-options.component.ts b/components/pagination/pagination-options.component.ts index 9ca05aef2c..87028bd753 100644 --- a/components/pagination/pagination-options.component.ts +++ b/components/pagination/pagination-options.component.ts @@ -18,7 +18,7 @@ import { toNumber } from 'ng-zorro-antd/core/util'; import { NzPaginationI18nInterface } from 'ng-zorro-antd/i18n'; @Component({ - selector: 'div[nz-pagination-options]', + selector: 'li[nz-pagination-options]', preserveWhitespaces: false, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, From b2ae5a26e740f0d0cd2f083922a7fc45f3260f99 Mon Sep 17 00:00:00 2001 From: chenc Date: Tue, 7 Jun 2022 16:37:51 +0800 Subject: [PATCH 3/6] fix(module:pagination): resolve test case failed --- .../pagination-default.component.ts | 2 +- .../pagination/pagination-simple.component.ts | 2 +- components/pagination/pagination.spec.ts | 21 +++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/components/pagination/pagination-default.component.ts b/components/pagination/pagination-default.component.ts index d9adf17571..b92b350ec6 100644 --- a/components/pagination/pagination-default.component.ts +++ b/components/pagination/pagination-default.component.ts @@ -38,7 +38,7 @@ import { PaginationItemRenderContext } from './pagination.types'; changeDetection: ChangeDetectionStrategy.OnPush, template: ` -
      +
      • -
          +
          • { let testComponent: NzTestPaginationComponent; let pagination: DebugElement; let paginationElement: HTMLElement; + let paginationRootElement: HTMLElement; beforeEach(() => { fixture = TestBed.createComponent(NzTestPaginationComponent); testComponent = fixture.debugElement.componentInstance; pagination = fixture.debugElement.query(By.directive(NzPaginationComponent)); fixture.detectChanges(); - paginationElement = pagination.nativeElement; + paginationRootElement = pagination.nativeElement; + paginationElement = pagination.nativeElement.querySelector('ul')!; }); describe('not simple mode', () => { it('should className correct', () => { fixture.detectChanges(); - expect(paginationElement.classList.contains('ant-pagination')).toBe(true); + expect(paginationRootElement.classList.contains('ant-pagination')).toBe(true); expect(paginationElement.firstElementChild!.classList.contains('ant-pagination-prev')).toBe(true); expect(paginationElement.firstElementChild!.classList.contains('ant-pagination-disabled')).toBe(true); expect(paginationElement.lastElementChild!.classList.contains('ant-pagination-next')).toBe(true); @@ -64,7 +66,7 @@ describe('pagination', () => { it('should small size className correct', () => { testComponent.size = 'small'; fixture.detectChanges(); - expect(paginationElement.classList.contains('mini')).toBe(true); + expect(paginationRootElement.classList.contains('mini')).toBe(true); }); it('should pageIndex change work', () => { @@ -237,7 +239,7 @@ describe('pagination', () => { fixture.detectChanges(); testComponent.disabled = true; fixture.detectChanges(); - expect(paginationElement.classList.contains('ant-pagination-disabled')).toBe(true); + expect(paginationRootElement.classList.contains('ant-pagination-disabled')).toBe(true); }); }); @@ -245,10 +247,11 @@ describe('pagination', () => { beforeEach(() => { testComponent.simple = true; fixture.detectChanges(); - paginationElement = pagination.nativeElement; + paginationRootElement = pagination.nativeElement; + paginationElement = pagination.nativeElement.querySelector('ul')!; }); it('should simple className work', () => { - expect(paginationElement.classList.contains('ant-pagination-simple')).toBe(true); + expect(paginationRootElement.classList.contains('ant-pagination-simple')).toBe(true); expect(paginationElement.firstElementChild!.classList.contains('ant-pagination-prev')).toBe(true); expect(paginationElement.lastElementChild!.classList.contains('ant-pagination-next')).toBe(true); }); @@ -313,7 +316,7 @@ describe('pagination', () => { fixture = TestBed.createComponent(NzTestPaginationRenderComponent); pagination = fixture.debugElement.query(By.directive(NzPaginationComponent)); fixture.detectChanges(); - paginationElement = pagination.nativeElement; + paginationElement = pagination.nativeElement.querySelector('ul')!; }); it('should render correct', () => { fixture.detectChanges(); @@ -334,7 +337,7 @@ describe('pagination', () => { testComponent = fixture.debugElement.componentInstance; pagination = fixture.debugElement.query(By.directive(NzPaginationComponent)); fixture.detectChanges(); - paginationElement = pagination.nativeElement; + paginationElement = pagination.nativeElement.querySelector('ul')!; }); it('should render correct', () => { @@ -389,7 +392,7 @@ describe('pagination', () => { fixture = TestBed.createComponent(NzTestPaginationRtlComponent); pagination = fixture.debugElement.query(By.directive(NzPaginationComponent)); fixture.detectChanges(); - paginationElement = pagination.nativeElement; + paginationElement = pagination.nativeElement.querySelector('ul')!; }); it('should pagination className correct on dir change', () => { From 0ab24b127e4ef6c46387dd8d2b2f42c12523decd Mon Sep 17 00:00:00 2001 From: chenc Date: Tue, 9 Aug 2022 10:19:43 +0800 Subject: [PATCH 4/6] fix(module:pagination): resolve reviewed change requested --- components/pagination/pagination-default.component.ts | 2 +- components/pagination/pagination.component.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/components/pagination/pagination-default.component.ts b/components/pagination/pagination-default.component.ts index b92b350ec6..b5d742e4f5 100644 --- a/components/pagination/pagination-default.component.ts +++ b/components/pagination/pagination-default.component.ts @@ -38,7 +38,7 @@ import { PaginationItemRenderContext } from './pagination.types'; changeDetection: ChangeDetectionStrategy.OnPush, template: ` -
              +
              • `, host: { - class: 'ant-pagination', '[class.ant-pagination-simple]': 'nzSimple', '[class.ant-pagination-disabled]': 'nzDisabled', '[class.mini]': `!nzSimple && size === 'small'`, From 7f077e8fedfd6f2cbe286b2c0448d9df3e1929a7 Mon Sep 17 00:00:00 2001 From: chenc Date: Tue, 9 Aug 2022 10:23:58 +0800 Subject: [PATCH 5/6] fix(module:pagination): pagination-simple add ant-pagination class name --- components/pagination/pagination-simple.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/pagination/pagination-simple.component.ts b/components/pagination/pagination-simple.component.ts index 0b30eedb72..d5249193b1 100644 --- a/components/pagination/pagination-simple.component.ts +++ b/components/pagination/pagination-simple.component.ts @@ -38,7 +38,7 @@ import { PaginationItemRenderContext } from './pagination.types'; changeDetection: ChangeDetectionStrategy.OnPush, template: ` -
                  +
                  • Date: Tue, 23 Aug 2022 14:03:20 +0800 Subject: [PATCH 6/6] fix(module:pagination): rollback pagination class --- components/pagination/pagination-default.component.ts | 2 +- components/pagination/pagination-simple.component.ts | 2 +- components/pagination/pagination.component.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/pagination/pagination-default.component.ts b/components/pagination/pagination-default.component.ts index b5d742e4f5..b92b350ec6 100644 --- a/components/pagination/pagination-default.component.ts +++ b/components/pagination/pagination-default.component.ts @@ -38,7 +38,7 @@ import { PaginationItemRenderContext } from './pagination.types'; changeDetection: ChangeDetectionStrategy.OnPush, template: ` -
                      +
                      • -
                          +
                          • `, host: { + class: 'ant-pagination', '[class.ant-pagination-simple]': 'nzSimple', '[class.ant-pagination-disabled]': 'nzDisabled', '[class.mini]': `!nzSimple && size === 'small'`,