Skip to content

Commit 396f547

Browse files
committed
test(igxTreeGrid): Adds basic rp test and backbone of other rp tests #6640
1 parent fbcb5e5 commit 396f547

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

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

+34-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
IgxTreeGridStringTreeColumnComponent, IgxTreeGridDateTreeColumnComponent, IgxTreeGridBooleanTreeColumnComponent,
99
IgxTreeGridRowEditingComponent, IgxTreeGridMultiColHeadersComponent,
1010
IgxTreeGridRowEditingTransactionComponent,
11-
IgxTreeGridRowEditingHierarchicalDSTransactionComponent
11+
IgxTreeGridRowEditingHierarchicalDSTransactionComponent,
12+
IgxTreeGridRowPinningComponent
1213
} from '../../test-utils/tree-grid-components.spec';
1314
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
1415
import { TreeGridFunctions } from '../../test-utils/tree-grid-functions.spec';
@@ -38,6 +39,7 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
3839
IgxTreeGridDateTreeColumnComponent,
3940
IgxTreeGridBooleanTreeColumnComponent,
4041
IgxTreeGridRowEditingComponent,
42+
IgxTreeGridRowPinningComponent,
4143
IgxTreeGridMultiColHeadersComponent,
4244
IgxTreeGridRowEditingTransactionComponent,
4345
IgxTreeGridRowEditingHierarchicalDSTransactionComponent
@@ -1374,4 +1376,35 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
13741376
expect(leftMostRightPinnedCellsPart + Number.parseInt(pinnedCellWidth, 10) <= rightMostGridPart).toBeTruthy();
13751377
});
13761378
});
1379+
1380+
describe('Row Pinning', () => {
1381+
it('should pin/unpin a row', () => {
1382+
fix = TestBed.createComponent(IgxTreeGridRowPinningComponent);
1383+
fix.detectChanges();
1384+
1385+
treeGrid = fix.componentInstance.treeGrid as IgxTreeGridComponent;
1386+
treeGrid.pinRow(711);
1387+
treeGrid.cdr.detectChanges();
1388+
1389+
expect(treeGrid.pinnedRecordsCount).toBe(1);
1390+
expect(treeGrid.getRowByKey(711).pinned).toBe(true);
1391+
1392+
treeGrid.unpinRow(711);
1393+
treeGrid.cdr.detectChanges();
1394+
expect(treeGrid.pinnedRecordsCount).toBe(0);
1395+
expect(treeGrid.getRowByKey(711).pinned).toBe(false);
1396+
1397+
treeGrid.getRowByKey(711).pin();
1398+
treeGrid.cdr.detectChanges();
1399+
expect(treeGrid.pinnedRecordsCount).toBe(1);
1400+
1401+
treeGrid.getRowByKey(711).unpin();
1402+
treeGrid.cdr.detectChanges();
1403+
expect(treeGrid.pinnedRecordsCount).toBe(0);
1404+
});
1405+
it('should pin/unpin a row at the bottom', () => {});
1406+
it('should calculate row indices correctly after row pinning', () => {});
1407+
it('should disable pinned row instance in the body', () => {});
1408+
it('should add pinned badge in the pinned row instance in the body', () => {});
1409+
});
13771410
});

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

+15
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,21 @@ export class IgxTreeGridRowEditingHierarchicalDSTransactionComponent {
471471
public paging = false;
472472
}
473473

474+
@Component({
475+
template: `<igx-tree-grid #treeGrid [data]="data" primaryKey="ID" childDataKey="Employees"
476+
[rowEditable]="true" width="900px" height="600px">
477+
<igx-column [field]="'ID'" dataType="number"></igx-column>
478+
<igx-column [field]="'Name'" dataType="string"></igx-column>
479+
<igx-column [field]="'HireDate'" dataType="date"></igx-column>
480+
<igx-column [field]="'Age'" dataType="number"></igx-column>
481+
<igx-column [field]="'OnPTO'" dataType="boolean"></igx-column>
482+
</igx-tree-grid>`
483+
})
484+
export class IgxTreeGridRowPinningComponent {
485+
public data = SampleTestData.employeeAllTypesTreeData();
486+
@ViewChild(IgxTreeGridComponent, { static: true }) public treeGrid: IgxTreeGridComponent;
487+
}
488+
474489
@Component({
475490
template:
476491
`<div [style.width.px]="outerWidth" [style.height.px]="outerHeight">

0 commit comments

Comments
 (0)