Skip to content

Commit f52bd1b

Browse files
MKirovaMKirova
authored andcommitted
Merge branch 'mkirova/row-pinning-base' of https://github.com/IgniteUI/igniteui-angular.git
2 parents db4cf94 + a216aa8 commit f52bd1b

File tree

3 files changed

+583
-430
lines changed

3 files changed

+583
-430
lines changed

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

Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -989,46 +989,6 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
989989
expect(fix.componentInstance.selectedCell.column.field).toMatch('ContactName');
990990
});
991991

992-
it('should navigate correctly by pressing Ctrl + ArrowUp/ArrowDown key', () => {
993-
fix.componentInstance.colGroups = [{
994-
group: 'group1',
995-
pinned: true,
996-
columns: [
997-
{ field: 'CompanyName', rowStart: 1, colStart: 1, colEnd: 3 },
998-
{ field: 'ContactName', rowStart: 2, colStart: 1 },
999-
{ field: 'ContactTitle', rowStart: 2, colStart: 2 }
1000-
]
1001-
}];
1002-
fix.detectChanges();
1003-
1004-
let firstCell;
1005-
let secondCell;
1006-
let thirdCell;
1007-
[
1008-
firstCell, secondCell,
1009-
thirdCell,
1010-
] = fix.debugElement.queryAll(By.css(CELL_CSS_CLASS));
1011-
1012-
thirdCell.componentInstance.onFocus(null);
1013-
fix.detectChanges();
1014-
1015-
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].ContactTitle);
1016-
expect(fix.componentInstance.selectedCell.column.field).toMatch('ContactTitle');
1017-
1018-
GridFunctions.simulateCellKeydown(thirdCell.componentInstance, 'ArrowDown', false, false, true);
1019-
fix.detectChanges();
1020-
1021-
expect(fix.componentInstance.selectedCell.value)
1022-
.toEqual(fix.componentInstance.data[fix.componentInstance.data.length - 1].ContactTitle);
1023-
expect(fix.componentInstance.selectedCell.column.field).toMatch('ContactTitle');
1024-
1025-
GridFunctions.simulateCellKeydown(fix.componentInstance.selectedCell, 'ArrowUp', false, false, true);
1026-
fix.detectChanges();
1027-
1028-
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].ContactTitle);
1029-
expect(fix.componentInstance.selectedCell.column.field).toMatch('ContactTitle');
1030-
});
1031-
1032992
it('should navigate correctly with column group is hidden.', () => {
1033993
fix.componentInstance.colGroups = [{
1034994
group: 'group1',
@@ -1845,19 +1805,69 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
18451805
fix.detectChanges();
18461806

18471807
GridFunctions.simulateCellKeydown(secondCell.componentInstance, 'ArrowDown');
1848-
await wait();
1808+
await wait(DEBOUNCETIME);
18491809
zone.simulateOnStable();
18501810
fix.detectChanges();
18511811

18521812
GridFunctions.simulateCellKeydown(fix.componentInstance.selectedCell, 'ArrowDown');
1853-
await wait();
1813+
await wait(DEBOUNCETIME);
18541814
zone.simulateOnStable();
18551815
fix.detectChanges();
18561816

18571817
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[rowIndex + 1].City);
18581818
expect(fix.componentInstance.selectedCell.column.field).toMatch('City');
18591819
});
18601820

1821+
it('should navigate correctly by pressing Ctrl + ArrowUp/ArrowDown key', async() => {
1822+
fix.componentInstance.colGroups = [{
1823+
group: 'group1',
1824+
pinned: true,
1825+
columns: [
1826+
{ field: 'CompanyName', rowStart: 1, colStart: 1, colEnd: 3 },
1827+
{ field: 'ContactName', rowStart: 2, colStart: 1 },
1828+
{ field: 'ContactTitle', rowStart: 2, colStart: 2 }
1829+
]
1830+
}];
1831+
fix.detectChanges();
1832+
1833+
let firstCell;
1834+
let secondCell;
1835+
let thirdCell;
1836+
[
1837+
firstCell, secondCell,
1838+
thirdCell,
1839+
] = fix.debugElement.queryAll(By.css(CELL_CSS_CLASS));
1840+
1841+
thirdCell.componentInstance.onFocus(null);
1842+
fix.detectChanges();
1843+
1844+
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].ContactTitle);
1845+
expect(fix.componentInstance.selectedCell.column.field).toMatch('ContactTitle');
1846+
1847+
GridFunctions.simulateCellKeydown(thirdCell.componentInstance, 'ArrowDown', false, false, true);
1848+
await wait(DEBOUNCETIME);
1849+
zone.simulateOnStable();
1850+
fix.detectChanges();
1851+
await wait(DEBOUNCETIME);
1852+
zone.simulateOnStable();
1853+
fix.detectChanges();
1854+
1855+
expect(fix.componentInstance.selectedCell.value)
1856+
.toEqual(fix.componentInstance.data[fix.componentInstance.data.length - 1].ContactTitle);
1857+
expect(fix.componentInstance.selectedCell.column.field).toMatch('ContactTitle');
1858+
1859+
GridFunctions.simulateCellKeydown(fix.componentInstance.selectedCell, 'ArrowUp', false, false, true);
1860+
await wait(DEBOUNCETIME);
1861+
zone.simulateOnStable();
1862+
fix.detectChanges();
1863+
await wait(DEBOUNCETIME);
1864+
zone.simulateOnStable();
1865+
fix.detectChanges();
1866+
1867+
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].ContactTitle);
1868+
expect(fix.componentInstance.selectedCell.column.field).toMatch('ContactTitle');
1869+
});
1870+
18611871
it('should navigate to the last cell from the layout by pressing Home/End or Ctrl + ArrowLeft/ArrowRight key', async() => {
18621872
fix.componentInstance.colGroups = [{
18631873
group: 'group1',
@@ -1895,47 +1905,47 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
18951905
fix.detectChanges();
18961906

18971907
GridFunctions.simulateCellKeydown(firstCell.componentInstance, 'end');
1898-
await wait();
1908+
await wait(DEBOUNCETIME);
18991909
zone.simulateOnStable();
19001910
fix.detectChanges();
19011911

1902-
await wait();
1912+
await wait(DEBOUNCETIME);
19031913
zone.simulateOnStable();
19041914
fix.detectChanges();
19051915

19061916
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].Phone);
19071917
expect(fix.componentInstance.selectedCell.column.field).toMatch('Phone');
19081918

19091919
GridFunctions.simulateCellKeydown(fix.componentInstance.selectedCell, 'home');
1910-
await wait();
1920+
await wait(DEBOUNCETIME);
19111921
zone.simulateOnStable();
19121922
fix.detectChanges();
19131923

1914-
await wait();
1924+
await wait(DEBOUNCETIME);
19151925
zone.simulateOnStable();
19161926
fix.detectChanges();
19171927

19181928
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].CompanyName);
19191929
expect(fix.componentInstance.selectedCell.column.field).toMatch('CompanyName');
19201930

19211931
GridFunctions.simulateCellKeydown(firstCell.componentInstance, 'ArrowRight', false, false, true);
1922-
await wait();
1932+
await wait(DEBOUNCETIME);
19231933
zone.simulateOnStable();
19241934
fix.detectChanges();
19251935

1926-
await wait();
1936+
await wait(DEBOUNCETIME);
19271937
zone.simulateOnStable();
19281938
fix.detectChanges();
19291939

19301940
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].Phone);
19311941
expect(fix.componentInstance.selectedCell.column.field).toMatch('Phone');
19321942

19331943
GridFunctions.simulateCellKeydown(fix.componentInstance.selectedCell, 'ArrowLeft', false, false, true);
1934-
await wait();
1944+
await wait(DEBOUNCETIME);
19351945
zone.simulateOnStable();
19361946
fix.detectChanges();
19371947

1938-
await wait();
1948+
await wait(DEBOUNCETIME);
19391949
zone.simulateOnStable();
19401950
fix.detectChanges();
19411951

@@ -2539,7 +2549,7 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
25392549

25402550
// arrow down
25412551
GridFunctions.simulateCellKeydown(cell, 'ArrowDown');
2542-
await wait();
2552+
await wait(DEBOUNCETIME);
25432553
zone.simulateOnStable();
25442554
fix.detectChanges();
25452555

@@ -2557,7 +2567,7 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
25572567

25582568
// arrow up
25592569
GridFunctions.simulateCellKeydown(cell, 'ArrowUp');
2560-
await wait();
2570+
await wait(DEBOUNCETIME);
25612571
zone.simulateOnStable();
25622572
fix.detectChanges();
25632573

@@ -2575,7 +2585,7 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
25752585

25762586
// arrow right
25772587
GridFunctions.simulateCellKeydown(cell, 'ArrowRight');
2578-
await wait();
2588+
await wait(DEBOUNCETIME);
25792589
zone.simulateOnStable();
25802590
fix.detectChanges();
25812591

@@ -2593,7 +2603,7 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
25932603

25942604
// arrow left
25952605
GridFunctions.simulateCellKeydown(cell, 'ArrowLeft');
2596-
await wait();
2606+
await wait(DEBOUNCETIME);
25972607
zone.simulateOnStable();
25982608
fix.detectChanges();
25992609

0 commit comments

Comments
 (0)