@@ -361,6 +361,48 @@ describe('IgxGrid - Cell Editing #grid', () => {
361361 expect ( cell . editMode ) . toBe ( false ) ;
362362 expect ( cell . value ) . toBe ( newValue ) ;
363363 } ) ) ;
364+
365+ it ( 'should preserve the navigation when cancel cellEdit and async set cell.editMode=false' , fakeAsync ( ( ) => {
366+ grid . cellEdit . subscribe ( ( evt : IGridEditEventArgs ) => {
367+ evt . cancel = true ;
368+ const rowIndex = evt . cellID . rowIndex ;
369+ const field = evt . column . field ;
370+ const target = grid . getCellByColumn ( rowIndex , field ) ;
371+ setTimeout ( ( ) => {
372+ target . editMode = false ;
373+ } , 100 ) ;
374+ } ) ;
375+
376+ const cell = grid . gridAPI . get_cell_by_index ( 0 , 'fullName' ) ;
377+
378+ UIInteractions . simulateDoubleClickAndSelectEvent ( cell ) ;
379+ fixture . detectChanges ( ) ;
380+ tick ( 16 ) ;
381+ expect ( cell . editMode ) . toBeTrue ( ) ;
382+
383+ const editInput = fixture . debugElement . query ( By . css ( 'igx-grid-cell input' ) ) ;
384+ if ( editInput ) {
385+ UIInteractions . clickAndSendInputElementValue ( editInput , 'Edited' ) ;
386+ }
387+ fixture . detectChanges ( ) ;
388+
389+ UIInteractions . triggerEventHandlerKeyDown ( 'enter' , gridContent ) ;
390+ fixture . detectChanges ( ) ;
391+
392+ tick ( 100 ) ;
393+ fixture . detectChanges ( ) ;
394+ expect ( cell . editMode ) . toBeFalse ( ) ;
395+
396+ expect ( document . activeElement ) . toBe ( grid . tbody . nativeElement ) ;
397+
398+ UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowRight' , document . activeElement as HTMLElement , true ) ;
399+ fixture . detectChanges ( ) ;
400+
401+ const nextCell = grid . getCellByColumn ( 0 , 'age' ) ;
402+ const active = ( grid as any ) . navigation . activeNode ;
403+ expect ( active . row ) . toBe ( 0 ) ;
404+ expect ( active . column ) . toBe ( nextCell . column . visibleIndex ) ;
405+ } ) ) ;
364406 } ) ;
365407
366408 describe ( 'Scroll, pin and blur' , ( ) => {
0 commit comments