diff --git a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html index bf607440..4bedd4b1 100644 --- a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html +++ b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html @@ -89,15 +89,12 @@ [rows]="pageSize" [showCurrentPageReport]="true" currentPageReportTemplate="{{ (totalRecordsOnServer ? currentPageShowingWithTotalOnServerKey : currentPageShowingKey) | translate:params }}" - [rowsPerPageOptions]="[10, 25, 50, rows?.length]" + [rowsPerPageOptions]="[10, 25, 50, { showAll: ('OCX_DATA_TABLE.ALL' | translate)}]" id="dataTable_{{name}}" (selectionChange)="onSelectionChange($event)" [selection]="(selectedRows$ | async) || []" [scrollable]="true" > - - {{ item.value === rows?.length ? ("OCX_DATA_TABLE.ALL" | translate) : item.value }} - diff --git a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.spec.ts b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.spec.ts index 0f6c6a65..4be80c68 100644 --- a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.spec.ts +++ b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.spec.ts @@ -279,7 +279,7 @@ describe('DataTableComponent', () => { const dataTable = await TestbedHarnessEnvironment.harnessForFixture(fixture, DataTableHarness) const paginator = await dataTable.getPaginator() const rowsPerPageOptions = await paginator.getRowsPerPageOptions() - const rowsPerPageOptionsText = await rowsPerPageOptions.selectedDropdownItemText(3) + const rowsPerPageOptionsText = await rowsPerPageOptions.selectedDropdownItemText(0) expect(rowsPerPageOptionsText).toEqual('Alle') }) @@ -289,11 +289,33 @@ describe('DataTableComponent', () => { const dataTable = await TestbedHarnessEnvironment.harnessForFixture(fixture, DataTableHarness) const paginator = await dataTable.getPaginator() const rowsPerPageOptions = await paginator.getRowsPerPageOptions() - const rowsPerPageOptionsText = await rowsPerPageOptions.selectedDropdownItemText(3) + const rowsPerPageOptionsText = await rowsPerPageOptions.selectedDropdownItemText(0) expect(rowsPerPageOptionsText).toEqual('All') }) }) + it('should display 10 rows by default for 1000 rows', async () => { + component.rows = Array.from(Array(1000).keys()).map((number) => { + return { + id: number, + name: number, + } + }) + component.columns = [ + { + columnType: ColumnType.NUMBER, + id: 'name', + nameKey: 'COLUMN_HEADER_NAME.NAME', + }, + ] + component.paginator = true + fixture.detectChanges() + + const dataTable = await TestbedHarnessEnvironment.harnessForFixture(fixture, DataTableHarness) + const rows = await dataTable.getRows() + expect(rows.length).toBe(10) + }) + describe('Table row selection', () => { it('should initially show a table without selection checkboxes', async () => { expect(dataTable).toBeTruthy()