Skip to content

Commit b53a710

Browse files
HristoP96HristoP96
authored andcommitted
chore(*): fix hgrid selection failing tests
1 parent 01c79ad commit b53a710

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
4949
rowIsland2 = fix.componentInstance.rowIsland2;
5050
}));
5151

52-
it('should allow only one cell to be selected in the whole hierarchical grid.', () => {
52+
it('should allow only one cell to be selected in the whole hierarchical grid.', (async () => {
5353
hierarchicalGrid.height = '500px';
5454
hierarchicalGrid.reflow();
5555
fix.detectChanges();
@@ -63,6 +63,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
6363

6464
// select parent cell
6565
fCell.nativeElement.focus();
66+
await wait(100);
6667
fix.detectChanges();
6768

6869
expect(fCell.selected).toBeTruthy();
@@ -73,6 +74,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
7374

7475
// select child cell
7576
fChildCell.nativeElement.focus();
77+
await wait(100);
7678
fix.detectChanges();
7779

7880
expect(fChildCell.selected).toBeTruthy();
@@ -82,10 +84,11 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
8284
firstRow = hierarchicalGrid.getRowByIndex(0) as IgxHierarchicalRowComponent;
8385
fCell = firstRow.cells.toArray()[0];
8486
fCell.nativeElement.focus();
87+
await wait(100);
8588
fix.detectChanges();
8689
expect(fChildCell.selected).toBeFalsy();
8790
expect(fCell.selected).toBeTruthy();
88-
});
91+
}));
8992
});
9093

9194
describe('Row Selection', () => {
@@ -97,10 +100,12 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
97100
rowIsland2 = fix.componentInstance.rowIsland2;
98101
}));
99102

100-
it('should have checkboxes on each row', () => {
103+
it('should have checkboxes on each row', ( async() => {
101104
hierarchicalGrid.expandChildren = true;
105+
await wait(100);
102106
fix.detectChanges();
103107
rowIsland1.expandChildren = true;
108+
await wait(100);
104109
fix.detectChanges();
105110

106111
expect(hierarchicalGrid.rowSelection).toEqual(GridSelectionMode.multiple);
@@ -127,7 +132,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
127132
for (const r of childGrid.dataRowList.toArray()) {
128133
GridSelectionFunctions.verifyRowHasCheckbox(r.nativeElement, false, false);
129134
}
130-
});
135+
}));
131136

132137
it('should able to change rowSelection at runtime', () => {
133138
hierarchicalGrid.expandChildren = true;
@@ -556,13 +561,14 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
556561
GridSelectionFunctions.verifyRowsArraySelected(childGrid.dataRowList.toArray());
557562
});
558563

559-
it('should not be able to select deleted row', () => {
564+
it('should not be able to select deleted row', fakeAsync(() => {
560565
// Expand first row
561566
const firstRow = hierarchicalGrid.getRowByIndex(0) as IgxHierarchicalRowComponent;
562567
firstRow.toggle();
563568
fix.detectChanges();
564569

565570
firstRow.onClick(UIInteractions.getMouseEvent('click'));
571+
tick();
566572
fix.detectChanges();
567573

568574
GridSelectionFunctions.verifyRowSelected(firstRow);
@@ -578,6 +584,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
578584

579585
// Click on deleted row
580586
firstRow.onClick(UIInteractions.getMouseEvent('click'));
587+
tick();
581588
fix.detectChanges();
582589

583590
GridSelectionFunctions.verifyRowSelected(firstRow, false);
@@ -606,13 +613,14 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
606613

607614
const childGridFirstRow = childGrid.getRowByIndex(0);
608615
childGridFirstRow.onClick(UIInteractions.getMouseEvent('click', false, false, true));
616+
tick();
609617
fix.detectChanges();
610618

611619
GridSelectionFunctions.verifyRowSelected(firstRow, false);
612620
GridSelectionFunctions.verifyHeaderRowCheckboxState(fix, true);
613621
expect(hierarchicalGrid.selectedRows()).toEqual(['1', '2', '3', '4']);
614622
expect(childGrid.selectedRows()).toEqual(['00']);
615-
});
623+
}));
616624

617625
it('should be able to select added row', () => {
618626
// Set multiple selection to first row island

0 commit comments

Comments
 (0)