Skip to content

Commit 1a005d1

Browse files
committed
chore(*): Update tests and small safety check.
1 parent 0123126 commit 1a005d1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,9 +1083,9 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
10831083

10841084
public get allVisibleDimensions() {
10851085
const config = this._pivotConfiguration;
1086+
if (!config) return [];
10861087
const uniqueVisibleRowDims = this.visibleRowDimensions.filter(dim => !config.rows.find(configRow => configRow.memberName === dim.memberName));
10871088
const rows = (config.rows || []).concat(...uniqueVisibleRowDims);
1088-
if (!config) return [];
10891089
return rows.concat((config.columns || [])).concat(config.filters || []).filter(x => x !== null && x !== undefined);
10901090
}
10911091

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
19821982
expect(pivotGrid.rowDimensionWidthToPixels(rowDimension)).toBe(158);
19831983
});
19841984

1985-
it ('should auto-generate pivot config when autoGenerateConfig is set to true.', () => {
1985+
it('should auto-generate pivot config when autoGenerateConfig is set to true.', () => {
19861986
const pivotGrid = fixture.componentInstance.pivotGrid;
19871987
pivotGrid.pivotConfiguration = undefined;
19881988
pivotGrid.data = [];
@@ -2993,7 +2993,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
29932993
expect(pivotGrid.rowList.toArray().length).toBe(1);
29942994
});
29952995

2996-
it("should allow navigation in the row layouts.", () => {
2996+
it("should allow navigation in the row layouts.", fakeAsync(() => {
29972997
fixture.detectChanges();
29982998
const layoutContainer = fixture.debugElement.query(
29992999
By.directive(IgxPivotRowDimensionMrlRowComponent));
@@ -3013,59 +3013,69 @@ describe('IgxPivotGrid #pivotGrid', () => {
30133013
expect(activeCells.length).toBe(1);
30143014

30153015
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', row0Col0.nativeElement);
3016+
tick();
30163017
fixture.detectChanges();
3018+
30173019
GridFunctions.verifyHeaderIsFocused(row0Col1.parent);
30183020
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30193021
expect(activeCells.length).toBe(1);
30203022

30213023
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', row0Col1.nativeElement);
3024+
tick();
30223025
fixture.detectChanges();
30233026
GridFunctions.verifyHeaderIsFocused(row0Col2.parent);
30243027
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30253028
expect(activeCells.length).toBe(1);
30263029

30273030
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', row0Col2.nativeElement);
3031+
tick();
30283032
fixture.detectChanges();
30293033
GridFunctions.verifyHeaderIsFocused(row0Col3.parent);
30303034
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30313035
expect(activeCells.length).toBe(1);
30323036

30333037
UIInteractions.triggerKeyDownEvtUponElem('ArrowDown', row0Col3.nativeElement);
3038+
tick();
30343039
fixture.detectChanges();
30353040
GridFunctions.verifyHeaderIsFocused(row1Col3.parent);
30363041
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30373042
expect(activeCells.length).toBe(1);
30383043

30393044
UIInteractions.triggerKeyDownEvtUponElem('ArrowDown', row1Col3.nativeElement);
3045+
tick();
30403046
fixture.detectChanges();
30413047
GridFunctions.verifyHeaderIsFocused(row2Col3.parent);
30423048
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30433049
expect(activeCells.length).toBe(1);
30443050

30453051
UIInteractions.triggerKeyDownEvtUponElem('ArrowUp', row2Col3.nativeElement);
3052+
tick();
30463053
fixture.detectChanges();
30473054
GridFunctions.verifyHeaderIsFocused(row1Col3.parent);
30483055
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30493056
expect(activeCells.length).toBe(1);
30503057

30513058
UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', row1Col3.nativeElement);
3059+
tick();
30523060
fixture.detectChanges();
30533061
GridFunctions.verifyHeaderIsFocused(row0Col2.parent);
30543062
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30553063
expect(activeCells.length).toBe(1);
30563064

30573065
UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', row0Col2.nativeElement);
3066+
tick();
30583067
fixture.detectChanges();
30593068
GridFunctions.verifyHeaderIsFocused(row0Col1.parent);
30603069
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30613070
expect(activeCells.length).toBe(1);
30623071

30633072
UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', row0Col1.nativeElement);
3073+
tick();
30643074
fixture.detectChanges();
30653075
GridFunctions.verifyHeaderIsFocused(row0Col0.parent);
30663076
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
30673077
expect(activeCells.length).toBe(1);
3068-
});
3078+
}));
30693079

30703080
it("should allow resizing the row dimension.", fakeAsync(() => {
30713081
const dimensionContents = fixture.debugElement.queryAll(By.css('.igx-grid__tbody-pivot-dimension'));

0 commit comments

Comments
 (0)