diff --git a/components/pagination/pagination-default.component.ts b/components/pagination/pagination-default.component.ts index b15b1fccaf..b92b350ec6 100644 --- a/components/pagination/pagination-default.component.ts +++ b/components/pagination/pagination-default.component.ts @@ -38,40 +38,42 @@ import { PaginationItemRenderContext } from './pagination.types'; changeDetection: ChangeDetectionStrategy.OnPush, template: ` -
  • - -
  • -
  • -
    +
    ` }) 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, diff --git a/components/pagination/pagination-simple.component.ts b/components/pagination/pagination-simple.component.ts index 13c52d4898..0b30eedb72 100644 --- a/components/pagination/pagination-simple.component.ts +++ b/components/pagination/pagination-simple.component.ts @@ -38,29 +38,31 @@ import { PaginationItemRenderContext } from './pagination.types'; changeDetection: ChangeDetectionStrategy.OnPush, template: ` -
  • -
  • - - / - {{ lastIndex }} -
  • -
  • +
    ` }) diff --git a/components/pagination/pagination.spec.ts b/components/pagination/pagination.spec.ts index f604fcfe47..c9f4c23180 100644 --- a/components/pagination/pagination.spec.ts +++ b/components/pagination/pagination.spec.ts @@ -39,19 +39,21 @@ describe('pagination', () => { 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', () => {