@@ -11,7 +11,7 @@ import { MultiColumnHeadersComponent } from '../../test-utils/grid-samples.spec'
1111import { GridFunctions } from '../../test-utils/grid-functions.spec' ;
1212import { IgxCellHeaderTemplateDirective , IgxCellTemplateDirective } from '../columns/templates.directive' ;
1313import { IgxAvatarComponent } from '../../avatar/avatar.component' ;
14- import { IColumnResizeEventArgs , IgxColumnComponent } from '../public_api' ;
14+ import { IColumnResizeEventArgs , IgxColumnComponent , IgxGridToolbarComponent , IgxGridToolbarTitleComponent } from '../public_api' ;
1515import { Size } from "../common/enums" ;
1616import { setElementSize } from '../../test-utils/helper-utils.spec' ;
1717import { IgxColumnResizerDirective } from '../resizing/resizer.directive' ;
@@ -912,6 +912,65 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
912912 expect ( grid . columnList . get ( 3 ) . width ) . toEqual ( '90px' ) ;
913913 } ) ) ;
914914 } ) ;
915+
916+ describe ( 'Resizer tests: ' , ( ) => {
917+ let fixture : ComponentFixture < any > ;
918+ let grid : IgxGridComponent ;
919+
920+ beforeEach ( fakeAsync ( ( ) => {
921+ fixture = TestBed . createComponent ( ResizableColumnsWithToolbarComponent ) ;
922+ fixture . detectChanges ( ) ;
923+ grid = fixture . componentInstance . grid ;
924+ } ) ) ;
925+
926+ it ( 'should align the resizer top with the grid header top' , fakeAsync ( ( ) => {
927+ grid . nativeElement . style . marginTop = '40px' ;
928+ fixture . detectChanges ( ) ;
929+ const headers = GridFunctions . getColumnHeaders ( fixture ) ;
930+ const headerResArea = GridFunctions . getHeaderResizeArea ( headers [ 0 ] ) . nativeElement ;
931+
932+ const headerRectTop = headerResArea . getBoundingClientRect ( ) . top ;
933+
934+ UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , 100 , 15 ) ;
935+ tick ( 200 ) ;
936+ fixture . detectChanges ( ) ;
937+
938+ const resizer = GridFunctions . getResizer ( fixture ) . nativeElement ;
939+ expect ( resizer ) . toBeDefined ( ) ;
940+
941+ const resizerRectTop = resizer . getBoundingClientRect ( ) . top ;
942+ UIInteractions . simulateMouseEvent ( 'mousemove' , resizer , 250 , 15 ) ;
943+ UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , 250 , 15 ) ;
944+ fixture . detectChanges ( ) ;
945+
946+
947+ expect ( Math . abs ( resizerRectTop - headerRectTop ) ) . toBeLessThanOrEqual ( 1 ) ;
948+ } ) ) ;
949+
950+ it ( 'should align the resizer top with the grid header top when grid is scaled' , fakeAsync ( ( ) => {
951+ grid . nativeElement . style . transform = 'scale(0.6)' ;
952+ fixture . detectChanges ( ) ;
953+
954+ const headers = GridFunctions . getColumnHeaders ( fixture ) ;
955+ const headerResArea = GridFunctions . getHeaderResizeArea ( headers [ 1 ] ) . nativeElement ;
956+ const headerRectTop = headerResArea . getBoundingClientRect ( ) . top ;
957+
958+ // Trigger resize to show resizer
959+ UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , 153 , 0 ) ;
960+ tick ( 200 ) ;
961+ fixture . detectChanges ( ) ;
962+
963+ const resizer = GridFunctions . getResizer ( fixture ) . nativeElement ;
964+ expect ( resizer ) . toBeDefined ( ) ;
965+
966+ const resizerRectTop = resizer . getBoundingClientRect ( ) . top ;
967+
968+ UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , 200 , 5 ) ;
969+ fixture . detectChanges ( ) ;
970+
971+ expect ( Math . abs ( resizerRectTop - headerRectTop ) ) . toBeLessThanOrEqual ( 1 ) ;
972+ } ) ) ;
973+ } ) ;
915974} ) ;
916975
917976@Component ( {
@@ -924,6 +983,18 @@ export class ResizableColumnsComponent {
924983 public data = SampleTestData . personIDNameRegionData ( ) ;
925984}
926985
986+ @Component ( {
987+ template : GridTemplateStrings . declareGrid ( `width="500px" height="300px"` , `` ,
988+ '<igx-grid-toolbar><igx-grid-toolbar-title>Grid Toolbar</igx-grid-toolbar-title></igx-grid-toolbar>' +
989+ ColumnDefinitions . resizableThreeOfFour ) ,
990+ imports : [ IgxGridComponent , IgxColumnComponent , IgxGridToolbarComponent , IgxGridToolbarTitleComponent ]
991+ } )
992+ export class ResizableColumnsWithToolbarComponent {
993+ @ViewChild ( IgxGridComponent , { static : true } ) public grid : IgxGridComponent ;
994+
995+ public data = SampleTestData . personIDNameRegionData ( ) ;
996+ }
997+
927998@Component ( {
928999 template : GridTemplateStrings . declareGrid ( `width="618px" height="600px"` , `` , `<igx-column [field]="'Released'" [pinned]="true" width="100px" dataType="boolean" [resizable]="true"></igx-column>
9291000 <igx-column [field]="'ReleaseDate'" [pinned]="true" width="100px" dataType="date" [resizable]="true"
0 commit comments