Skip to content

Commit 36a41df

Browse files
committed
test(tGrid): fix tree grid test related to pagination #9097
1 parent 5cb2647 commit 36a41df

8 files changed

+43
-21
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { IgxTabsComponent, IgxTabsModule } from '../../tabs/tabs/public_api';
2626
import { IgxGridRowComponent } from './grid-row.component';
2727

2828

29-
fdescribe('IgxGrid Component Tests #grid', () => {
29+
describe('IgxGrid Component Tests #grid', () => {
3030
const MIN_COL_WIDTH = '136px';
3131
const COLUMN_HEADER_CLASS = '.igx-grid__th';
3232

@@ -2330,7 +2330,7 @@ fdescribe('IgxGrid Component Tests #grid', () => {
23302330
});
23312331
}));
23322332

2333-
fit('should have access to grid context', () => {
2333+
it('should have access to grid context', () => {
23342334
const fix = TestBed.createComponent(IgxGridWithCustomPaginationTemplateComponent);
23352335
fix.detectChanges();
23362336

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-indentation.spec.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ describe('IgxTreeGrid - Indentation #tGrid', () => {
9393
}));
9494

9595
it('should persist the indentation on all pages when using paging', fakeAsync(() => {
96-
treeGrid.paging = true;
97-
treeGrid.perPage = 4;
96+
fix.componentInstance.paging = true;
97+
fix.detectChanges();
98+
99+
treeGrid.paginator.perPage = 4;
98100
fix.detectChanges();
99101
tick(16);
100102

@@ -251,7 +253,9 @@ describe('IgxTreeGrid - Indentation #tGrid', () => {
251253
}));
252254

253255
it('should persist the indentation on all pages when using paging', fakeAsync(() => {
254-
treeGrid.paging = true;
256+
fix.componentInstance.paging = true;
257+
fix.detectChanges();
258+
255259
treeGrid.perPage = 3;
256260
fix.detectChanges();
257261
tick(16);

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-integration.spec.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,8 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
16231623
treeGrid.pinRow(147);
16241624
fix.detectChanges();
16251625

1626-
treeGrid.paging = true;
1626+
fix.componentInstance.paging = true;
1627+
fix.detectChanges();
16271628
treeGrid.perPage = 5;
16281629
fix.detectChanges();
16291630

@@ -1636,7 +1637,8 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
16361637
});
16371638

16381639
it('should correctly apply paging state for grid and paginator when there are pinned rows.', fakeAsync(() => {
1639-
treeGrid.paging = true;
1640+
fix.componentInstance.paging = true;
1641+
fix.detectChanges();
16401642
treeGrid.perPage = 3;
16411643
treeGrid.height = '700px';
16421644
fix.detectChanges();
@@ -1663,7 +1665,8 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
16631665
}));
16641666

16651667
it('should have the correct records shown for pages with pinned rows', () => {
1666-
treeGrid.paging = true;
1668+
fix.componentInstance.paging = true;
1669+
fix.detectChanges();
16671670
treeGrid.perPage = 6;
16681671
treeGrid.height = '700px';
16691672
fix.detectChanges();

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-search.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,10 @@ describe('IgxTreeGrid - search API #tGrid', () => {
352352
});
353353

354354
it('findNext should navigate search highlights with paging', async () => {
355+
fix.componentInstance.paging = true;
356+
fix.detectChanges();
355357
treeGrid.expansionDepth = Infinity;
356358
treeGrid.perPage = 5;
357-
treeGrid.paging = true;
358359
await wait(50);
359360
fix.detectChanges();
360361

@@ -374,8 +375,9 @@ describe('IgxTreeGrid - search API #tGrid', () => {
374375
});
375376

376377
it('findNext should navigate search highlights with paging and collapsed rows', async () => {
378+
fix.componentInstance.paging = true;
379+
fix.detectChanges();
377380
treeGrid.perPage = 5;
378-
treeGrid.paging = true;
379381
await wait(50);
380382
fix.detectChanges();
381383

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-selection.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
258258
fix.detectChanges();
259259
tick(16);
260260

261-
treeGrid.paging = true;
261+
fix.componentInstance.paging = true;
262+
fix.detectChanges();
262263
treeGrid.perPage = 4;
263264
fix.detectChanges();
264265
tick(16);
@@ -512,7 +513,8 @@ describe('IgxTreeGrid - Selection #tGrid', () => {
512513
TreeGridFunctions.clickRowSelectionCheckbox(fix, 5);
513514
fix.detectChanges();
514515

515-
treeGrid.paging = true;
516+
fix.componentInstance.paging = true;
517+
fix.detectChanges();
516518
treeGrid.perPage = 4;
517519
fix.detectChanges();
518520
tick(16);

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-summaries.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ describe('IgxTreeGrid - Summaries #tGrid', () => {
513513
}));
514514

515515
it('Paging: should render correct summaries when paging is enable and position is bottom', fakeAsync(() => {
516-
treeGrid.paging = true;
516+
fix.componentInstance.paging = true;
517+
fix.detectChanges();
517518
treeGrid.perPage = 4;
518519
fix.detectChanges();
519520
tick(16);
@@ -546,7 +547,8 @@ describe('IgxTreeGrid - Summaries #tGrid', () => {
546547
}));
547548

548549
it('Paging: should render correct summaries when paging is enable and position is top', fakeAsync(() => {
549-
treeGrid.paging = true;
550+
fix.componentInstance.paging = true;
551+
fix.detectChanges();
550552
treeGrid.perPage = 4;
551553
treeGrid.summaryPosition = 'top';
552554
fix.detectChanges();

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
} from '../../test-utils/tree-grid-components.spec';
1515
import { wait } from '../../test-utils/ui-interactions.spec';
1616
import { GridSelectionMode } from '../common/enums';
17-
import { IgxHierarchicalGridTestComponent } from '../grid/row-drag.directive.spec';
1817
import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition';
1918

2019
describe('IgxTreeGrid Component Tests #tGrid', () => {

projects/igniteui-angular/src/lib/test-utils/tree-grid-components.spec.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ export class IgxTreeGridFilteringComponent {
4646
<igx-column [field]="'Name'" dataType="string"></igx-column>
4747
<igx-column [field]="'HireDate'" dataType="date"></igx-column>
4848
<igx-column [field]="'Age'" dataType="number"></igx-column>
49+
<igx-paginator *ngIf="paging"></igx-paginator>
4950
</igx-tree-grid>
5051
`
5152
})
5253
export class IgxTreeGridSimpleComponent {
5354
@ViewChild(IgxTreeGridComponent, { static: true }) public treeGrid: IgxTreeGridComponent;
5455
public data = SampleTestData.employeeSmallTreeData();
5556
public selectedRows = [];
57+
public paging = false;
5658
}
5759

5860
@Component({
@@ -95,22 +97,24 @@ export class IgxTreeGridWithNoScrollsComponent {
9597
<igx-column [field]="'Name'" dataType="string"></igx-column>
9698
<igx-column [field]="'JobTitle'" dataType="string"></igx-column>
9799
<igx-column [field]="'Age'" dataType="number"></igx-column>
100+
<igx-paginator *ngIf="paging"></igx-paginator>
98101
</igx-tree-grid>
99102
`
100103
})
101104
export class IgxTreeGridPrimaryForeignKeyComponent {
102105
@ViewChild(IgxTreeGridComponent, { static: true }) public treeGrid: IgxTreeGridComponent;
103106
public data = SampleTestData.employeePrimaryForeignKeyTreeData();
107+
public paging = false;
104108
}
105109

106110
@Component({
107111
template: `
108-
<igx-tree-grid #treeGrid [data]="data" childDataKey="Employees" expansionDepth="0" width="900px" height="600px"
109-
[paging]="true" [perPage]="10">
112+
<igx-tree-grid #treeGrid [data]="data" childDataKey="Employees" expansionDepth="0" width="900px" height="600px">
110113
<igx-column [field]="'ID'" dataType="number"></igx-column>
111114
<igx-column [field]="'Name'" dataType="string"></igx-column>
112115
<igx-column [field]="'HireDate'" dataType="date"></igx-column>
113116
<igx-column [field]="'Age'" dataType="number"></igx-column>
117+
<igx-paginator [perPage]="10"></igx-paginator>
114118
</igx-tree-grid>
115119
`
116120
})
@@ -121,12 +125,12 @@ export class IgxTreeGridExpandingComponent {
121125

122126
@Component({
123127
template: `
124-
<igx-tree-grid #treeGrid [data]="data" primaryKey="ID" childDataKey="Employees" expansionDepth="2" width="900px" height="500px"
125-
[paging]="true" [perPage]="10">
128+
<igx-tree-grid #treeGrid [data]="data" primaryKey="ID" childDataKey="Employees" expansionDepth="2" width="900px" height="500px" [perPage]="10">
126129
<igx-column [field]="'ID'" dataType="number"></igx-column>
127130
<igx-column [field]="'Name'" dataType="string"></igx-column>
128131
<igx-column [field]="'HireDate'" dataType="date"></igx-column>
129132
<igx-column [field]="'Age'" dataType="number"></igx-column>
133+
<igx-paginator></igx-paginator>
130134
</igx-tree-grid>
131135
`
132136
})
@@ -313,6 +317,7 @@ export class IgxTreeGridSummariesKeyScroliingComponent {
313317
<igx-column [field]="'HireDate'" dataType="date" [hasSummary]="true"></igx-column>
314318
<igx-column [field]="'Age'" dataType="number" [hasSummary]="true"></igx-column>
315319
<igx-column [field]="'OnPTO'" dataType="boolean" [hasSummary]="true"></igx-column>
320+
<igx-paginator *ngIf="paging"></igx-paginator>
316321
</igx-tree-grid>
317322
`
318323
})
@@ -322,6 +327,7 @@ export class IgxTreeGridSummariesKeyComponent {
322327
public calculationMode = 'rootAndChildLevels';
323328
public ageSummary = AgeSummary;
324329
public ageSummaryTest = AgeSummaryTest;
330+
public paging = false;
325331
}
326332

327333
@Component({
@@ -482,11 +488,13 @@ export class IgxTreeGridRowEditingHierarchicalDSTransactionComponent {
482488
<igx-column [field]="'HireDate'" dataType="date"></igx-column>
483489
<igx-column [field]="'Age'" dataType="number"></igx-column>
484490
<igx-column [field]="'OnPTO'" dataType="boolean"></igx-column>
491+
<igx-paginator *ngIf="paging"></igx-paginator>
485492
</igx-tree-grid>`
486493
})
487494
export class IgxTreeGridRowPinningComponent {
488495
@ViewChild(IgxTreeGridComponent, { static: true }) public treeGrid: IgxTreeGridComponent;
489496
public data = SampleTestData.employeeAllTypesTreeData();
497+
public paging = false;
490498
}
491499

492500
@Component({
@@ -548,12 +556,14 @@ export class IgxTreeGridWrappedInContComponent {
548556
<igx-column [field]="'firstName'"></igx-column>
549557
<igx-column [field]="'lastName'"></igx-column>
550558
<igx-column [field]="'Salary'" dataType="number" [hasSummary]="true" ></igx-column>
559+
<igx-paginator *ngIf="paging"></igx-paginator>
551560
</igx-tree-grid>
552561
`
553562
})
554563
export class IgxTreeGridSummariesScrollingComponent {
555564
@ViewChild(IgxTreeGridComponent, { static: true }) public treeGrid: IgxTreeGridComponent;
556565
public data = SampleTestData.employeeScrollingData();
566+
public paging = false;
557567
}
558568

559569
@Component({
@@ -774,13 +784,13 @@ export class IgxTreeGridDefaultLoadingComponent implements OnInit {
774784
@Component({
775785
template: `
776786
<igx-tree-grid #treeGridCustomSelectors
777-
[data]="data" primaryKey="ID" foreignKey="ParentID"
778-
[paging]="true" [perPage]="5" [rowSelection]="'multiple'" width="900px" height="600px">
787+
[data]="data" primaryKey="ID" foreignKey="ParentID" [rowSelection]="'multiple'" width="900px" height="600px">
779788
<igx-column [field]="'ID'" dataType="number"></igx-column>
780789
<igx-column [field]="'Name'" dataType="string"></igx-column>
781790
<igx-column [field]="'Age'" dataType="number"></igx-column>
782791
<igx-column [field]="'OnPTO'" dataType="boolean"></igx-column>
783792
<igx-column [field]="'HireDate'" dataType="date"></igx-column>
793+
<igx-paginator [perPage]="5"></igx-paginator>
784794
<ng-template igxRowSelector let-rowContext>
785795
<span class="rowNumber">{{ rowContext.index }}</span>
786796
<igx-checkbox [checked]="rowContext.selected" (click)="onRowCheckboxClick($event, rowContext)"></igx-checkbox>

0 commit comments

Comments
 (0)