@@ -16,7 +16,7 @@ import { DataType } from '../../data-operations/data-util';
1616import { GridTemplateStrings } from '../../test-utils/template-strings.spec' ;
1717import { SampleTestData } from '../../test-utils/sample-test-data.spec' ;
1818import { BasicGridComponent } from '../../test-utils/grid-base-components.spec' ;
19- import { wait } from '../../test-utils/ui-interactions.spec' ;
19+ import { UIInteractions , wait } from '../../test-utils/ui-interactions.spec' ;
2020import { IgxStringFilteringOperand , IgxNumberFilteringOperand } from '../../data-operations/filtering-condition' ;
2121import { SortingDirection , ISortingExpression } from '../../data-operations/sorting-expression.interface' ;
2222import { configureTestSuite } from '../../test-utils/configure-suite' ;
@@ -657,6 +657,75 @@ describe('IgxGrid Component Tests #grid', () => {
657657 expect ( row . cells . length ) . toEqual ( 4 ) ;
658658 }
659659 } ) ;
660+
661+ it ( 'Should scroll horizontally when press shift + mouse wheel over grid headers' , ( async ( ) => {
662+ const fix = TestBed . createComponent ( IgxGridTestComponent ) ;
663+ for ( let i = 2 ; i < 100 ; i ++ ) {
664+ fix . componentInstance . data . push ( { index : i , value : i , desc : i , detail : i } ) ;
665+ }
666+ fix . componentInstance . columns [ 0 ] . width = '400px' ;
667+ fix . componentInstance . columns [ 1 ] . width = '400px' ;
668+ fix . componentInstance . columns . push (
669+ { field : 'desc' , header : 'desc' , dataType : 'number' , width : '400px' , hasSummary : false } ,
670+ { field : 'detail' , header : 'detail' , dataType : 'number' , width : '400px' , hasSummary : false }
671+ ) ;
672+ fix . detectChanges ( ) ;
673+ const grid = fix . componentInstance . grid ;
674+ const initialScroll = grid . verticalScrollContainer . getScroll ( ) . scrollTop ;
675+ const initialHorScroll = grid . headerContainer . getScroll ( ) . scrollLeft ;
676+
677+ const displayContainer = grid . headerContainer . dc . instance . _viewContainer . element . nativeElement ;
678+ await UIInteractions . simulateWheelEvent ( displayContainer , 0 , - 240 , true ) ;
679+ fix . detectChanges ( ) ;
680+ await wait ( 16 ) ;
681+
682+ expect ( grid . verticalScrollContainer . getScroll ( ) . scrollTop ) . toBe ( initialScroll ) ;
683+ expect ( grid . headerContainer . getScroll ( ) . scrollLeft ) . toBeGreaterThan ( initialHorScroll + 50 ) ;
684+
685+ await UIInteractions . simulateWheelEvent ( displayContainer , 0 , 240 , true ) ;
686+ fix . detectChanges ( ) ;
687+ await wait ( 16 ) ;
688+
689+ expect ( grid . verticalScrollContainer . getScroll ( ) . scrollTop ) . toBe ( initialScroll ) ;
690+ expect ( grid . headerContainer . getScroll ( ) . scrollLeft ) . toEqual ( initialHorScroll ) ;
691+ } ) ) ;
692+
693+
694+ it ( 'Should scroll horizontally when press shift + mouse wheel over grid data row' , ( async ( ) => {
695+ const fix = TestBed . createComponent ( IgxGridTestComponent ) ;
696+ for ( let i = 2 ; i < 100 ; i ++ ) {
697+ fix . componentInstance . data . push ( { index : i , value : i , desc : i , detail : i } ) ;
698+ }
699+ fix . componentInstance . columns [ 0 ] . width = '400px' ;
700+ fix . componentInstance . columns [ 1 ] . width = '400px' ;
701+ fix . componentInstance . columns . push (
702+ { field : 'desc' , header : 'desc' , dataType : 'number' , width : '400px' , hasSummary : false } ,
703+ { field : 'detail' , header : 'detail' , dataType : 'number' , width : '400px' , hasSummary : false }
704+ ) ;
705+ fix . detectChanges ( ) ;
706+ const grid = fix . componentInstance . grid ;
707+ const initialScroll = grid . verticalScrollContainer . getScroll ( ) . scrollTop ;
708+ const initialHorScroll = grid . rowList . first . virtDirRow . getScroll ( ) . scrollLeft ;
709+
710+ const cell = grid . getCellByColumn ( 3 , 'value' ) ;
711+ UIInteractions . simulateClickAndSelectEvent ( cell ) ;
712+ fix . detectChanges ( ) ;
713+
714+ const displayContainer = grid . rowList . first . virtDirRow . dc . instance . _viewContainer . element . nativeElement ;
715+ await UIInteractions . simulateWheelEvent ( displayContainer , 0 , - 240 , true ) ;
716+ fix . detectChanges ( ) ;
717+ await wait ( 16 ) ;
718+
719+ expect ( grid . verticalScrollContainer . getScroll ( ) . scrollTop ) . toBe ( initialScroll ) ;
720+ expect ( grid . headerContainer . getScroll ( ) . scrollLeft ) . toBeGreaterThan ( initialHorScroll + 50 ) ;
721+
722+ await UIInteractions . simulateWheelEvent ( displayContainer , 0 , - 240 , true ) ;
723+ fix . detectChanges ( ) ;
724+ await wait ( 16 ) ;
725+
726+ expect ( grid . verticalScrollContainer . getScroll ( ) . scrollTop ) . toBe ( initialScroll ) ;
727+ expect ( grid . headerContainer . getScroll ( ) . scrollLeft ) . toBeGreaterThanOrEqual ( 2 * ( initialHorScroll + 50 ) ) ;
728+ } ) ) ;
660729 } ) ;
661730
662731 describe ( 'IgxGrid - default rendering for rows and columns' , ( ) => {
0 commit comments