Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions projects/components/src/paginator/paginator.component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,15 @@ describe('Paginator component', () => {
expect(spectator.query(LabelComponent)?.label).toEqual('1-50 of 50');
expect(spectator.component.hasNextPage()).toBe(false);
});

test('should hide the paginator when totalItems is less than the pageSizeOptions options', () => {
const spectator = createHost(`<ht-paginator [totalItems]="totalItems"></ht-paginator>`, {
hostProps: {
totalItems: 20
}
});

const paginator = spectator.query('.paginator')!;
expect(paginator).toBeNull();
});
});
2 changes: 1 addition & 1 deletion projects/components/src/paginator/paginator.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { PaginationProvider } from './paginator-api';
styleUrls: ['./paginator.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="paginator" *ngIf="this.totalItems">
<div class="paginator" *ngIf="this.totalItems && this.totalItems > this.pageSizeOptions[0]">
<ht-label
class="label"
label="{{ this.firstItemNumberForPage() }}-{{ this.lastItemNumberForPage() }} of {{ this.totalItems }}"
Expand Down