@@ -14,7 +14,7 @@ import { IGridCellEventArgs } from '../common/events';
1414import { IgxColumnComponent } from '../columns/column.component' ;
1515import { ColumnPinningPosition } from '../common/enums' ;
1616import { IPinningConfig } from '../common/grid.interface' ;
17- import { wait } from '../../test-utils/ui-interactions.spec' ;
17+ import { wait , UIInteractions } from '../../test-utils/ui-interactions.spec' ;
1818import { GridSummaryFunctions } from '../../test-utils/grid-functions.spec' ;
1919
2020describe ( 'IgxGrid - Column Pinning #grid' , ( ) => {
@@ -23,6 +23,7 @@ describe('IgxGrid - Column Pinning #grid', () => {
2323 const FIXED_HEADER_CSS = 'igx-grid__th--pinned' ;
2424 const FIXED_CELL_CSS = 'igx-grid__td--pinned' ;
2525 const FIRST_PINNED_CELL_CSS = 'igx-grid__td--pinned-first' ;
26+ const DEBOUNCETIME = 30 ;
2627
2728 describe ( 'To Start' , ( ) => {
2829 configureTestSuite ( ) ;
@@ -417,6 +418,39 @@ describe('IgxGrid - Column Pinning #grid', () => {
417418 expect ( grid . pinnedColumns . length ) . toEqual ( 1 ) ;
418419 expect ( grid . unpinnedColumns . length ) . toEqual ( 2 ) ;
419420 } ) ) ;
421+
422+ it ( 'should allow navigating to/from pinned area' , ( async ( ) => {
423+ pending ( 'https://github.com/IgniteUI/igniteui-angular/pull/6910' ) ;
424+ const fix = TestBed . createComponent ( DefaultGridComponent ) ;
425+ fix . detectChanges ( ) ;
426+ const grid = fix . componentInstance . instance ;
427+
428+ const cellContactName = grid . getCellByColumn ( 0 , 'ContactName' ) ;
429+ const range = {
430+ rowStart : cellContactName . rowIndex ,
431+ rowEnd : cellContactName . rowIndex ,
432+ columnStart : cellContactName . visibleColumnIndex ,
433+ columnEnd : cellContactName . visibleColumnIndex
434+ } ;
435+ grid . selectRange ( range ) ;
436+ grid . navigation . activeNode = { row : cellContactName . rowIndex , column : cellContactName . visibleColumnIndex } ;
437+ fix . detectChanges ( ) ;
438+
439+ grid . navigation . dispatchEvent ( UIInteractions . getKeyboardEvent ( 'keydown' , 'ArrowRight' ) ) ;
440+ await wait ( DEBOUNCETIME ) ;
441+ fix . detectChanges ( ) ;
442+
443+ const cellID = grid . getCellByColumn ( 0 , 'ID' ) ;
444+ expect ( cellID . active ) . toBe ( true ) ;
445+ expect ( cellContactName . active ) . toBe ( false ) ;
446+
447+ grid . navigation . dispatchEvent ( UIInteractions . getKeyboardEvent ( 'keydown' , 'ArrowLeft' ) ) ;
448+ await wait ( DEBOUNCETIME ) ;
449+ fix . detectChanges ( ) ;
450+
451+ expect ( cellID . active ) . toBe ( false ) ;
452+ expect ( cellContactName . active ) . toBe ( true ) ;
453+ } ) ) ;
420454 } ) ;
421455
422456 describe ( 'To End' , ( ) => {
@@ -639,6 +673,61 @@ describe('IgxGrid - Column Pinning #grid', () => {
639673 expect ( fistPinnedHeaders . classes [ 'igx-grid__mrl-block' ] ) . toBeTruthy ( ) ;
640674 expect ( fistPinnedHeaders . classes [ 'igx-grid__th--pinned-first' ] ) . toBeTruthy ( ) ;
641675 } ) ;
676+
677+ it ( 'should allow navigating to/from pinned area' , ( async ( ) => {
678+ pending ( 'https://github.com/IgniteUI/igniteui-angular/pull/6910' ) ;
679+ const fix = TestBed . createComponent ( GridRightPinningComponent ) ;
680+ fix . detectChanges ( ) ;
681+ const grid = fix . componentInstance . instance as any ;
682+
683+ const cellCompanyName = grid . getCellByColumn ( 0 , 'CompanyName' ) ;
684+ const range = { rowStart : 0 , rowEnd : 0 , columnStart : 9 , columnEnd : 9 } ;
685+ grid . selectRange ( range ) ;
686+ grid . navigation . activeNode = { row : 0 , column : 9 } ;
687+ fix . detectChanges ( ) ;
688+ expect ( cellCompanyName . active ) . toBe ( true ) ;
689+
690+ grid . navigation . dispatchEvent ( UIInteractions . getKeyboardEvent ( 'keydown' , 'ArrowLeft' ) ) ;
691+ await wait ( DEBOUNCETIME ) ;
692+ fix . detectChanges ( ) ;
693+ const cellFax = grid . getCellByColumn ( 0 , 'Fax' ) ;
694+ expect ( cellFax . active ) . toBe ( true ) ;
695+ expect ( cellCompanyName . active ) . toBe ( false ) ;
696+
697+ grid . navigation . dispatchEvent ( UIInteractions . getKeyboardEvent ( 'keydown' , 'ArrowRight' ) ) ;
698+ await wait ( DEBOUNCETIME ) ;
699+ fix . detectChanges ( ) ;
700+ expect ( cellFax . active ) . toBe ( false ) ;
701+ expect ( cellCompanyName . active ) . toBe ( true ) ;
702+ } ) ) ;
703+
704+ it ( 'should allow navigating to/from pinned area using Ctrl+Left/Right' , ( async ( ) => {
705+ pending ( 'https://github.com/IgniteUI/igniteui-angular/pull/6910' ) ;
706+ const fix = TestBed . createComponent ( GridRightPinningComponent ) ;
707+ fix . detectChanges ( ) ;
708+ const grid = fix . componentInstance . instance as any ;
709+
710+ const cellCompanyName = grid . getCellByColumn ( 0 , 'CompanyName' ) ;
711+ const range = { rowStart : 0 , rowEnd : 0 , columnStart : 9 , columnEnd : 9 } ;
712+ grid . selectRange ( range ) ;
713+ grid . navigation . activeNode = { row : 0 , column : 9 } ;
714+ fix . detectChanges ( ) ;
715+ expect ( cellCompanyName . active ) . toBe ( true ) ;
716+
717+ grid . navigation . dispatchEvent ( UIInteractions . getKeyboardEvent ( 'keydown' , 'ArrowLeft' , false , false , true ) ) ;
718+ await wait ( DEBOUNCETIME ) ;
719+ fix . detectChanges ( ) ;
720+ const cellID = grid . getCellByColumn ( 0 , 'ID' ) ;
721+ expect ( cellID . active ) . toBe ( true ) ;
722+ expect ( cellCompanyName . active ) . toBe ( false ) ;
723+
724+ grid . navigation . dispatchEvent ( UIInteractions . getKeyboardEvent ( 'keydown' , 'ArrowRight' , false , false , true ) ) ;
725+ await wait ( DEBOUNCETIME ) ;
726+ fix . detectChanges ( ) ;
727+ const cellContactName = grid . getCellByColumn ( 0 , 'ContactName' ) ;
728+ expect ( cellID . active ) . toBe ( false ) ;
729+ expect ( cellContactName . active ) . toBe ( true ) ;
730+ } ) ) ;
642731 } ) ;
643732} ) ;
644733
0 commit comments