@@ -5,8 +5,9 @@ import { IgxPivotGridComponent, IgxPivotGridModule } from 'igniteui-angular';
5
5
import { configureTestSuite } from '../../test-utils/configure-suite' ;
6
6
import { GridFunctions } from '../../test-utils/grid-functions.spec' ;
7
7
import { IgxPivotGridMultipleRowComponent } from '../../test-utils/pivot-grid-samples.spec' ;
8
- import { UIInteractions } from '../../test-utils/ui-interactions.spec' ;
8
+ import { UIInteractions , wait } from '../../test-utils/ui-interactions.spec' ;
9
9
10
+ const DEBOUNCE_TIME = 250 ;
10
11
const PIVOT_TBODY_CSS_CLASS = '.igx-grid__tbody' ;
11
12
const PIVOT_ROW_DIMENSION_CONTENT = 'igx-pivot-row-dimension-content' ;
12
13
const PIVOT_HEADER_ROW = 'igx-pivot-header-row' ;
@@ -43,7 +44,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
43
44
let activeCells = fixture . debugElement . queryAll ( By . css ( `${ ACTIVE_CELL_CSS_CLASS } ` ) ) ;
44
45
expect ( activeCells . length ) . toBe ( 1 ) ;
45
46
46
- UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowRight' , firstCell . nativeElement ) ;
47
+ UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowRight' , pivotGrid . theadRow . nativeElement ) ;
47
48
fixture . detectChanges ( ) ;
48
49
GridFunctions . verifyHeaderIsFocused ( secondCell . parent ) ;
49
50
activeCells = fixture . debugElement . queryAll ( By . css ( `${ ACTIVE_CELL_CSS_CLASS } ` ) ) ;
@@ -56,7 +57,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
56
57
UIInteractions . simulateClickAndSelectEvent ( firstCell ) ;
57
58
fixture . detectChanges ( ) ;
58
59
59
- UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowLeft' , firstCell . nativeElement ) ;
60
+ UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowLeft' , pivotGrid . theadRow . nativeElement ) ;
60
61
fixture . detectChanges ( ) ;
61
62
62
63
GridFunctions . verifyHeaderIsFocused ( firstCell . parent ) ;
@@ -66,7 +67,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
66
67
UIInteractions . simulateClickAndSelectEvent ( thirdCell ) ;
67
68
fixture . detectChanges ( ) ;
68
69
69
- UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowRight' , firstCell . nativeElement ) ;
70
+ UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowRight' , pivotGrid . theadRow . nativeElement ) ;
70
71
fixture . detectChanges ( ) ;
71
72
72
73
GridFunctions . verifyHeaderIsFocused ( thirdCell . parent ) ;
@@ -93,13 +94,13 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
93
94
expect ( activeCells . length ) . toBe ( 1 ) ;
94
95
} ) ;
95
96
96
- it ( 'should allow navigating from first to last row headers(Ctrl + End )' , ( ) => {
97
- const [ firstCell ] = fixture . debugElement . queryAll (
97
+ it ( 'should allow navigating from first to last row headers(Ctrl + ArrowDown )' , ( ) => {
98
+ const [ _firstCell , _secondCell , thirdCell ] = fixture . debugElement . queryAll (
98
99
By . css ( `${ PIVOT_TBODY_CSS_CLASS } ${ PIVOT_ROW_DIMENSION_CONTENT } ${ HEADER_CELL_CSS_CLASS } ` ) ) ;
99
- UIInteractions . simulateClickAndSelectEvent ( firstCell ) ;
100
+ UIInteractions . simulateClickAndSelectEvent ( thirdCell ) ;
100
101
fixture . detectChanges ( ) ;
101
102
102
- UIInteractions . triggerKeyDownEvtUponElem ( 'End ' , pivotGrid . theadRow . nativeElement , false , false , false , true ) ;
103
+ UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowDown ' , pivotGrid . theadRow . nativeElement , true , false , false , true ) ;
103
104
fixture . detectChanges ( ) ;
104
105
105
106
const allCells = fixture . debugElement . queryAll (
@@ -108,12 +109,6 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
108
109
GridFunctions . verifyHeaderIsFocused ( lastCell . parent ) ;
109
110
const activeCells = fixture . debugElement . queryAll ( By . css ( `${ ACTIVE_CELL_CSS_CLASS } ` ) ) ;
110
111
expect ( activeCells . length ) . toBe ( 1 ) ;
111
-
112
- const scrollTop = pivotGrid . verticalScrollContainer . getScroll ( ) . scrollTop ;
113
- const scrollHeight = pivotGrid . verticalScrollContainer . getScroll ( ) . scrollHeight ;
114
- const tbody = fixture . debugElement . query ( By . css ( `${ PIVOT_TBODY_CSS_CLASS } ` ) ) . nativeElement ;
115
- const scrolledToBottom = Math . round ( scrollTop + tbody . scrollHeight ) === scrollHeight ;
116
- expect ( scrolledToBottom ) . toBeTruthy ( ) ;
117
112
} ) ;
118
113
119
114
it ( 'should allow navigating between column headers' , ( ) => {
@@ -132,7 +127,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
132
127
activeCells = fixture . debugElement . queryAll ( By . css ( `${ ACTIVE_CELL_CSS_CLASS } ` ) ) ;
133
128
expect ( activeCells . length ) . toBe ( 1 ) ;
134
129
} ) ;
135
- it ( 'should allow navigating from first to last column headers' , ( ) => {
130
+ it ( 'should allow navigating from first to last column headers' , async ( ) => {
136
131
const [ firstHeader ] = fixture . debugElement . queryAll (
137
132
By . css ( `${ PIVOT_HEADER_ROW } ${ HEADER_CELL_CSS_CLASS } ` ) ) ;
138
133
UIInteractions . simulateClickAndSelectEvent ( firstHeader ) ;
@@ -143,6 +138,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
143
138
expect ( activeCells . length ) . toBe ( 1 ) ;
144
139
145
140
UIInteractions . triggerKeyDownEvtUponElem ( 'End' , pivotGrid . theadRow . nativeElement ) ;
141
+ await wait ( DEBOUNCE_TIME ) ;
146
142
fixture . detectChanges ( ) ;
147
143
148
144
const allHeaders = fixture . debugElement . queryAll (
0 commit comments