@@ -59,21 +59,18 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
5959 } ) ;
6060
6161 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 ) ;
6763 await wait ( 100 ) ;
6864 fix . detectChanges ( ) ;
6965
70- gridHeader . triggerEventHandler ( 'focus' , null ) ;
66+ gridHeader . triggerEventHandler ( 'focus' , { } ) ;
7167 await wait ( 200 ) ;
7268 fix . detectChanges ( ) ;
7369
7470 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 ) ;
7774 expect ( grid . headerContainer . getScroll ( ) . scrollLeft ) . toEqual ( 0 ) ;
7875 expect ( grid . verticalScrollContainer . getScroll ( ) . scrollTop ) . toBeGreaterThanOrEqual ( 100 ) ;
7976 } ) ;
@@ -110,7 +107,7 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
110107 GridFunctions . verifyHeaderIsFocused ( header . parent ) ;
111108 } ) ;
112109
113- it ( 'should navigation to first last header' , async ( ) => {
110+ it ( 'should navigate to first/ last header' , async ( ) => {
114111 // Focus grid header
115112 let header = GridFunctions . getColumnHeader ( 'ParentID' , fix ) ;
116113 UIInteractions . simulateClickAndSelectEvent ( header ) ;
@@ -121,35 +118,43 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
121118
122119 // Press end key
123120 UIInteractions . triggerEventHandlerKeyDown ( 'End' , gridHeader ) ;
124- await wait ( DEBOUNCETIME * 2 ) ;
121+ await wait ( 100 ) ;
125122 fix . detectChanges ( ) ;
126123
127124 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 ) ;
129128
130129 // Press Home ket
131130 UIInteractions . triggerEventHandlerKeyDown ( 'home' , gridHeader ) ;
132- await wait ( DEBOUNCETIME * 2 ) ;
131+ await wait ( 100 ) ;
133132 fix . detectChanges ( ) ;
134133
135134 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 ) ;
137138
138139 // Press Ctrl+ Arrow right
139140 UIInteractions . triggerEventHandlerKeyDown ( 'ArrowRight' , gridHeader , false , false , true ) ;
140- await wait ( DEBOUNCETIME * 2 ) ;
141+ await wait ( 100 ) ;
141142 fix . detectChanges ( ) ;
142143
143144 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 ) ;
145148
146149 // Press Ctrl+ Arrow left
147150 UIInteractions . triggerEventHandlerKeyDown ( 'ArrowLeft' , gridHeader , false , false , true ) ;
148151 await wait ( DEBOUNCETIME ) ;
149152 fix . detectChanges ( ) ;
150153
151154 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 ) ;
153158 } ) ;
154159
155160 it ( 'should not change active header on arrow up or down pressed' , ( ) => {
@@ -204,7 +209,9 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
204209 fix . detectChanges ( ) ;
205210
206211 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 ) ;
208215
209216 // Click on the pinned column
210217 header = GridFunctions . getColumnHeader ( 'ParentID' , fix ) ;
0 commit comments