diff --git a/lib/core/pagination/pagination.component.spec.ts b/lib/core/pagination/pagination.component.spec.ts index 21b3e32c10..b8a22d5515 100644 --- a/lib/core/pagination/pagination.component.spec.ts +++ b/lib/core/pagination/pagination.component.spec.ts @@ -91,6 +91,11 @@ describe('PaginationComponent', () => { }); })); + it('should have an "empty" class if no items present', () => { + fixture.detectChanges(); + expect(fixture.nativeElement.classList.contains('adf-pagination__empty')).toBeTruthy(); + }); + describe('Single page', () => { beforeEach(() => { component.pagination = new FakePaginationInput(1, 1, 10); diff --git a/lib/core/pagination/pagination.component.ts b/lib/core/pagination/pagination.component.ts index 779c99bf0d..c161002f73 100644 --- a/lib/core/pagination/pagination.component.ts +++ b/lib/core/pagination/pagination.component.ts @@ -24,7 +24,8 @@ import { Output, ViewEncapsulation, ChangeDetectorRef, - OnDestroy + OnDestroy, + HostBinding } from '@angular/core'; import { Pagination } from 'alfresco-js-api'; @@ -134,6 +135,11 @@ export class PaginationComponent implements OnInit, OnDestroy { return this.pagination && this.pagination.count > 0; } + @HostBinding('class.adf-pagination__empty') + get isEmpty(): boolean { + return !this.hasItems; + } + get range(): number[] { const { skipCount, maxItems, totalItems } = this.pagination; const { isLastPage } = this;