Skip to content

Commit d39f0ef

Browse files
MKirovaMayaKirova
authored andcommitted
Add wait for selection changed as well and fix a mrl test that also seems to flicker.
1 parent 0cdf5bf commit d39f0ef

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-mrl-keyboard-nav.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { IgxGridModule, IgxGridCellComponent, IGridCellEventArgs } from './publi
66
import { IgxGridComponent } from './grid.component';
77
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
88
import { configureTestSuite } from '../../test-utils/configure-suite';
9-
import { wait, UIInteractions } from '../../test-utils/ui-interactions.spec';
9+
import { wait, UIInteractions, waitForSelectionChange } from '../../test-utils/ui-interactions.spec';
1010
import { setupGridScrollDetection } from '../../test-utils/helper-utils.spec';
1111
import { SortingDirection } from '../../data-operations/sorting-expression.interface';
1212
import { DefaultSortingStrategy } from '../../data-operations/sorting-strategy';
@@ -1894,21 +1894,19 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
18941894
fix.detectChanges();
18951895

18961896
GridFunctions.simulateGridContentKeydown(fix, 'ArrowRight', false, false, true);
1897-
await wait(DEBOUNCETIME * 2);
1897+
await waitForSelectionChange(fix.componentInstance.grid);
18981898
fix.detectChanges();
18991899

19001900
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].Phone);
19011901
expect(fix.componentInstance.selectedCell.column.field).toMatch('Phone');
19021902

19031903
GridFunctions.simulateGridContentKeydown(fix, 'ArrowDown');
1904-
await wait();
19051904
fix.detectChanges();
19061905

19071906
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].Fax);
19081907
expect(fix.componentInstance.selectedCell.column.field).toMatch('Fax');
19091908

19101909
GridFunctions.simulateGridContentKeydown(fix, 'ArrowUp');
1911-
await wait();
19121910
fix.detectChanges();
19131911

19141912
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].Phone);

projects/igniteui-angular/src/lib/test-utils/ui-interactions.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ export function waitForActiveNodeChange (grid) {
1616
});
1717
}
1818

19+
export function waitForSelectionChange (grid) {
20+
// wait for grid scroll operation to complete and state to be updated.
21+
return new Promise((resolve, reject) => {
22+
grid.onSelection.pipe(first()).subscribe(() => {
23+
grid.cdr.detectChanges();
24+
resolve();
25+
});
26+
});
27+
}
28+
1929
declare var Touch: {
2030
prototype: Touch;
2131
new(prop): Touch;

0 commit comments

Comments
 (0)