@@ -59,21 +59,18 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
59
59
} ) ;
60
60
61
61
it ( 'should focus first header when the grid is scrolled' , async ( ) => {
62
- grid . headerContainer . getScroll ( ) . scrollLeft = 1000 ;
63
- await wait ( 100 ) ;
64
- fix . detectChanges ( ) ;
65
-
66
- grid . verticalScrollContainer . getScroll ( ) . scrollTop = 200 ;
62
+ grid . navigateTo ( 7 , 5 ) ;
67
63
await wait ( 100 ) ;
68
64
fix . detectChanges ( ) ;
69
65
70
- gridHeader . triggerEventHandler ( 'focus' , null ) ;
66
+ gridHeader . triggerEventHandler ( 'focus' , { } ) ;
71
67
await wait ( 200 ) ;
72
68
fix . detectChanges ( ) ;
73
69
74
70
const header = GridFunctions . getColumnHeader ( 'ID' , fix ) ;
75
- expect ( header ) . toBeDefined ( ) ;
76
- GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
71
+ expect ( header ) . toBeTruthy ( ) ;
72
+ expect ( grid . navigation . activeNode . column ) . toEqual ( 0 ) ;
73
+ expect ( grid . navigation . activeNode . row ) . toEqual ( - 1 ) ;
77
74
expect ( grid . headerContainer . getScroll ( ) . scrollLeft ) . toEqual ( 0 ) ;
78
75
expect ( grid . verticalScrollContainer . getScroll ( ) . scrollTop ) . toBeGreaterThanOrEqual ( 100 ) ;
79
76
} ) ;
@@ -110,7 +107,7 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
110
107
GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
111
108
} ) ;
112
109
113
- it ( 'should navigation to first last header' , async ( ) => {
110
+ it ( 'should navigate to first/ last header' , async ( ) => {
114
111
// Focus grid header
115
112
let header = GridFunctions . getColumnHeader ( 'ParentID' , fix ) ;
116
113
UIInteractions . simulateClickAndSelectEvent ( header ) ;
@@ -121,35 +118,43 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
121
118
122
119
// Press end key
123
120
UIInteractions . triggerEventHandlerKeyDown ( 'End' , gridHeader ) ;
124
- await wait ( DEBOUNCETIME * 2 ) ;
121
+ await wait ( 100 ) ;
125
122
fix . detectChanges ( ) ;
126
123
127
124
header = GridFunctions . getColumnHeader ( 'OnPTO' , fix ) ;
128
- GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
125
+ expect ( header ) . toBeTruthy ( ) ;
126
+ expect ( grid . navigation . activeNode . column ) . toEqual ( 5 ) ;
127
+ expect ( grid . navigation . activeNode . row ) . toEqual ( - 1 ) ;
129
128
130
129
// Press Home ket
131
130
UIInteractions . triggerEventHandlerKeyDown ( 'home' , gridHeader ) ;
132
- await wait ( DEBOUNCETIME * 2 ) ;
131
+ await wait ( 100 ) ;
133
132
fix . detectChanges ( ) ;
134
133
135
134
header = GridFunctions . getColumnHeader ( 'ID' , fix ) ;
136
- GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
135
+ expect ( header ) . toBeTruthy ( ) ;
136
+ expect ( grid . navigation . activeNode . column ) . toEqual ( 0 ) ;
137
+ expect ( grid . navigation . activeNode . row ) . toEqual ( - 1 ) ;
137
138
138
139
// Press Ctrl+ Arrow right
139
140
UIInteractions . triggerEventHandlerKeyDown ( 'ArrowRight' , gridHeader , false , false , true ) ;
140
- await wait ( DEBOUNCETIME * 2 ) ;
141
+ await wait ( 100 ) ;
141
142
fix . detectChanges ( ) ;
142
143
143
144
header = GridFunctions . getColumnHeader ( 'OnPTO' , fix ) ;
144
- GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
145
+ expect ( header ) . toBeTruthy ( ) ;
146
+ expect ( grid . navigation . activeNode . column ) . toEqual ( 5 ) ;
147
+ expect ( grid . navigation . activeNode . row ) . toEqual ( - 1 ) ;
145
148
146
149
// Press Ctrl+ Arrow left
147
150
UIInteractions . triggerEventHandlerKeyDown ( 'ArrowLeft' , gridHeader , false , false , true ) ;
148
151
await wait ( DEBOUNCETIME ) ;
149
152
fix . detectChanges ( ) ;
150
153
151
154
header = GridFunctions . getColumnHeader ( 'ID' , fix ) ;
152
- GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
155
+ expect ( header ) . toBeTruthy ( ) ;
156
+ expect ( grid . navigation . activeNode . column ) . toEqual ( 0 ) ;
157
+ expect ( grid . navigation . activeNode . row ) . toEqual ( - 1 ) ;
153
158
} ) ;
154
159
155
160
it ( 'should not change active header on arrow up or down pressed' , ( ) => {
@@ -204,7 +209,9 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
204
209
fix . detectChanges ( ) ;
205
210
206
211
header = GridFunctions . getColumnHeader ( 'OnPTO' , fix ) ;
207
- GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
212
+ expect ( header ) . toBeTruthy ( ) ;
213
+ expect ( grid . navigation . activeNode . column ) . toEqual ( 5 ) ;
214
+ expect ( grid . navigation . activeNode . row ) . toEqual ( - 1 ) ;
208
215
209
216
// Click on the pinned column
210
217
header = GridFunctions . getColumnHeader ( 'ParentID' , fix ) ;
0 commit comments