Skip to content

Commit 74f3112

Browse files
authored
Merge pull request #7017 from IgniteUI/hPopov/fix-failing-HGrid-test
Fix hgrid selection failing test
2 parents 55d7cbd + 62f740a commit 74f3112

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ 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.', fakeAsync(() => {
5353
hierarchicalGrid.height = '500px';
5454
hierarchicalGrid.reflow();
5555
fix.detectChanges();
5656

5757
let firstRow = hierarchicalGrid.getRowByIndex(0) as IgxHierarchicalRowComponent;
5858
firstRow.toggle();
5959
fix.detectChanges();
60+
tick(100);
6061
expect(firstRow.expanded).toBeTruthy();
6162

6263
let fCell = firstRow.cells.toArray()[0];
@@ -85,7 +86,8 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
8586
fix.detectChanges();
8687
expect(fChildCell.selected).toBeFalsy();
8788
expect(fCell.selected).toBeTruthy();
88-
});
89+
}));
90+
8991
});
9092

9193
describe('Row Selection', () => {
@@ -97,10 +99,12 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
9799
rowIsland2 = fix.componentInstance.rowIsland2;
98100
}));
99101

100-
it('should have checkboxes on each row', () => {
102+
it('should have checkboxes on each row', fakeAsync(() => {
101103
hierarchicalGrid.expandChildren = true;
104+
tick(100);
102105
fix.detectChanges();
103106
rowIsland1.expandChildren = true;
107+
tick(100);
104108
fix.detectChanges();
105109

106110
expect(hierarchicalGrid.rowSelection).toEqual(GridSelectionMode.multiple);
@@ -127,7 +131,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
127131
for (const r of childGrid.dataRowList.toArray()) {
128132
GridSelectionFunctions.verifyRowHasCheckbox(r.nativeElement, false, false);
129133
}
130-
});
134+
}));
131135

132136
it('should able to change rowSelection at runtime', () => {
133137
hierarchicalGrid.expandChildren = true;
@@ -556,13 +560,14 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
556560
GridSelectionFunctions.verifyRowsArraySelected(childGrid.dataRowList.toArray());
557561
});
558562

559-
it('should not be able to select deleted row', () => {
563+
it('should not be able to select deleted row', fakeAsync(() => {
560564
// Expand first row
561565
const firstRow = hierarchicalGrid.getRowByIndex(0) as IgxHierarchicalRowComponent;
562566
firstRow.toggle();
563567
fix.detectChanges();
564568

565569
firstRow.onClick(UIInteractions.getMouseEvent('click'));
570+
tick();
566571
fix.detectChanges();
567572

568573
GridSelectionFunctions.verifyRowSelected(firstRow);
@@ -578,6 +583,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
578583

579584
// Click on deleted row
580585
firstRow.onClick(UIInteractions.getMouseEvent('click'));
586+
tick();
581587
fix.detectChanges();
582588

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

607613
const childGridFirstRow = childGrid.getRowByIndex(0);
608614
childGridFirstRow.onClick(UIInteractions.getMouseEvent('click', false, false, true));
615+
tick();
609616
fix.detectChanges();
610617

611618
GridSelectionFunctions.verifyRowSelected(firstRow, false);
612619
GridSelectionFunctions.verifyHeaderRowCheckboxState(fix, true);
613620
expect(hierarchicalGrid.selectedRows()).toEqual(['1', '2', '3', '4']);
614621
expect(childGrid.selectedRows()).toEqual(['00']);
615-
});
622+
}));
616623

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

0 commit comments

Comments
 (0)