Skip to content

Commit 68b631e

Browse files
committed
test(pivot): fix navigation tests
1 parent f2506cd commit 68b631e

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { IgxPivotGridMultipleRowComponent } from '../../test-utils/pivot-grid-sa
88
import { UIInteractions } from '../../test-utils/ui-interactions.spec';
99

1010
const PIVOT_TBODY_CSS_CLASS = '.igx-grid__tbody';
11+
const PIVOT_ROW_DIMENSION_CONTENT = 'igx-pivot-row-dimension-content';
1112
const PIVOT_HEADER_ROW = 'igx-pivot-header-row';
12-
const COLUMNS_HEADER_CSS_CLASS = '.igx-grid-thead__wrapper';
1313
const HEADER_CELL_CSS_CLASS = '.igx-grid-th';
1414
const ACTIVE_CELL_CSS_CLASS = '.igx-grid-th--active';
1515

@@ -35,7 +35,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
3535

3636
it('should allow navigating between row headers', () => {
3737
const [firstCell, secondCell] = fixture.debugElement.queryAll(
38-
By.css(`${PIVOT_TBODY_CSS_CLASS} ${COLUMNS_HEADER_CSS_CLASS} ${HEADER_CELL_CSS_CLASS}`));
38+
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_ROW_DIMENSION_CONTENT} ${HEADER_CELL_CSS_CLASS}`));
3939
UIInteractions.simulateClickAndSelectEvent(firstCell);
4040
fixture.detectChanges();
4141

@@ -52,7 +52,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
5252

5353
it('should not go outside of the boundaries of the row dimensions content', () => {
5454
const [firstCell, _, thirdCell] = fixture.debugElement.queryAll(
55-
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_HEADER_ROW} ${HEADER_CELL_CSS_CLASS}`));
55+
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_ROW_DIMENSION_CONTENT} ${HEADER_CELL_CSS_CLASS}`));
5656
UIInteractions.simulateClickAndSelectEvent(firstCell);
5757
fixture.detectChanges();
5858

@@ -76,17 +76,17 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
7676

7777
it('should allow navigating from first to last row headers in a row(Home/End)', () => {
7878
const [firstCell, _, thirdCell] = fixture.debugElement.queryAll(
79-
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_HEADER_ROW} ${HEADER_CELL_CSS_CLASS}`));
79+
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_ROW_DIMENSION_CONTENT} ${HEADER_CELL_CSS_CLASS}`));
8080
UIInteractions.simulateClickAndSelectEvent(firstCell);
8181
fixture.detectChanges();
8282

83-
UIInteractions.triggerKeyDownEvtUponElem('End', firstCell.nativeElement);
83+
UIInteractions.triggerKeyDownEvtUponElem('End', pivotGrid.theadRow.nativeElement);
8484
fixture.detectChanges();
8585
GridFunctions.verifyHeaderIsFocused(thirdCell.parent);
8686
let activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
8787
expect(activeCells.length).toBe(1);
8888

89-
UIInteractions.triggerKeyDownEvtUponElem('Home', thirdCell.nativeElement);
89+
UIInteractions.triggerKeyDownEvtUponElem('Home', pivotGrid.theadRow.nativeElement);
9090
fixture.detectChanges();
9191
GridFunctions.verifyHeaderIsFocused(firstCell.parent);
9292
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
@@ -95,17 +95,16 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
9595

9696
it('should allow navigating from first to last row headers(Ctrl + End)', () => {
9797
const [firstCell] = fixture.debugElement.queryAll(
98-
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_HEADER_ROW} ${HEADER_CELL_CSS_CLASS}`));
98+
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_ROW_DIMENSION_CONTENT} ${HEADER_CELL_CSS_CLASS}`));
9999
UIInteractions.simulateClickAndSelectEvent(firstCell);
100100
fixture.detectChanges();
101101

102-
UIInteractions.triggerKeyDownEvtUponElem('End', firstCell.nativeElement, false, false, false, true);
102+
UIInteractions.triggerKeyDownEvtUponElem('End', pivotGrid.theadRow.nativeElement, false, false, false, true);
103103
fixture.detectChanges();
104104

105105
const allCells = fixture.debugElement.queryAll(
106-
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_HEADER_ROW} ${HEADER_CELL_CSS_CLASS}`));
106+
By.css(`${PIVOT_TBODY_CSS_CLASS} ${PIVOT_ROW_DIMENSION_CONTENT} ${HEADER_CELL_CSS_CLASS}`));
107107
const lastCell = allCells[allCells.length - 1];
108-
fixture.detectChanges();
109108
GridFunctions.verifyHeaderIsFocused(lastCell.parent);
110109
const activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
111110
expect(activeCells.length).toBe(1);
@@ -119,7 +118,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
119118

120119
it('should allow navigating between column headers', () => {
121120
const [firstHeader, secondHeader] = fixture.debugElement.queryAll(
122-
By.css(`${COLUMNS_HEADER_CSS_CLASS} ${HEADER_CELL_CSS_CLASS}`));
121+
By.css(`${PIVOT_HEADER_ROW} ${HEADER_CELL_CSS_CLASS}`));
123122
UIInteractions.simulateClickAndSelectEvent(firstHeader);
124123
fixture.detectChanges();
125124

@@ -135,20 +134,20 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
135134
});
136135
it('should allow navigating from first to last column headers', () => {
137136
const [firstHeader] = fixture.debugElement.queryAll(
138-
By.css(`${COLUMNS_HEADER_CSS_CLASS} ${HEADER_CELL_CSS_CLASS}`));
137+
By.css(`${PIVOT_HEADER_ROW} ${HEADER_CELL_CSS_CLASS}`));
139138
UIInteractions.simulateClickAndSelectEvent(firstHeader);
140139
fixture.detectChanges();
141140

142141
GridFunctions.verifyHeaderIsFocused(firstHeader.parent);
143142
let activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
144143
expect(activeCells.length).toBe(1);
145144

146-
UIInteractions.triggerKeyDownEvtUponElem('End', firstHeader.nativeElement);
145+
UIInteractions.triggerKeyDownEvtUponElem('End', pivotGrid.theadRow.nativeElement);
147146
fixture.detectChanges();
148147

149148
const allHeaders = fixture.debugElement.queryAll(
150-
By.css(`${COLUMNS_HEADER_CSS_CLASS} ${HEADER_CELL_CSS_CLASS}`));
151-
const lastHeader = allHeaders[length - 1];
149+
By.css(`${PIVOT_HEADER_ROW} ${HEADER_CELL_CSS_CLASS}`));
150+
const lastHeader = allHeaders[allHeaders.length - 1];
152151
GridFunctions.verifyHeaderIsFocused(lastHeader.parent);
153152
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
154153
expect(activeCells.length).toBe(1);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Row Dimension -->
22
<div #rowDimensionContainer>
3-
<igx-pivot-row-dimension-content class="igx-grid-thead" tabindex="0"
3+
<igx-pivot-row-dimension-content class="igx-grid-thead"
44
[grid]="grid"
55
[hasMRL]="grid.hasColumnLayouts"
66
[density]="grid.displayDensity"

projects/igniteui-angular/src/lib/test-utils/pivot-grid-samples.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class IgxPivotGridTestBaseComponent {
102102

103103
@Component({
104104
template: `
105-
<igx-pivot-grid #grid [data]="data" [pivotConfiguration]="pivotConfigHierarchy">
105+
<igx-pivot-grid #grid [data]="data" [pivotConfiguration]="pivotConfigHierarchy" [defaultExpandState]="true">
106106
</igx-pivot-grid>`
107107
})
108108
export class IgxPivotGridMultipleRowComponent extends IgxPivotGridTestBaseComponent {

src/app/pivot-grid/pivot-grid.sample.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<igx-pivot-grid
1515
#grid1 [data]="origData"
1616
[pivotConfiguration]="pivotConfigHierarchy"
17-
(dimensionsChange)='dimensionChange($event)'>
17+
(dimensionsChange)='dimensionChange($event)'
18+
[defaultExpandState]='true'>
1819
</igx-pivot-grid>
1920

0 commit comments

Comments
 (0)