@@ -4,7 +4,7 @@ import { By } from '@angular/platform-browser';
44import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
55import { IgxGridComponent } from './grid.component' ;
66import { SampleTestData } from '../../test-utils/sample-test-data.spec' ;
7- import { ViewChild , Component } from '@angular/core' ;
7+ import { ViewChild , Component , DebugElement } from '@angular/core' ;
88import { IgxColumnLayoutComponent } from '../columns/column-layout.component' ;
99import { wait , UIInteractions } from '../../test-utils/ui-interactions.spec' ;
1010import { DefaultSortingStrategy , SortingDirection } from '../../data-operations/sorting-strategy' ;
@@ -30,6 +30,7 @@ interface ColGroupsType {
3030describe ( 'IgxGrid - multi-row-layout Integration #grid - ' , ( ) => {
3131 let fixture : ComponentFixture < FixtureType > ;
3232 let grid : IgxGridComponent ;
33+ const COLUMN_HEADER_CLASS = '.igx-grid-th' ;
3334 configureTestSuite ( ( ( ) => {
3435 return TestBed . configureTestingModule ( {
3536 imports : [
@@ -896,6 +897,30 @@ describe('IgxGrid - multi-row-layout Integration #grid - ', () => {
896897 expect ( ( grid . verticalScrollContainer . getScroll ( ) . children [ 0 ] as HTMLElement ) . offsetHeight -
897898 grid . verticalScrollContainer . getScroll ( ) . offsetHeight ) . toBeLessThanOrEqual ( 0 ) ;
898899 } ) ) ;
900+
901+ it ( 'should create only one ghost element when dragging a column' , async ( ) => {
902+ const headers : DebugElement [ ] = fixture . debugElement . queryAll ( By . css ( COLUMN_HEADER_CLASS ) ) ;
903+
904+ const header = headers [ 1 ] . nativeElement ;
905+ UIInteractions . simulatePointerEvent ( 'pointerdown' , header , 50 , 50 ) ;
906+ await wait ( ) ;
907+ fixture . detectChanges ( ) ;
908+
909+ UIInteractions . simulatePointerEvent ( 'pointermove' , header , 56 , 56 ) ;
910+ await wait ( 50 ) ;
911+ fixture . detectChanges ( ) ;
912+
913+ UIInteractions . simulatePointerEvent ( 'pointermove' , header , 230 , 30 ) ;
914+ await wait ( ) ;
915+ fixture . detectChanges ( ) ;
916+
917+ const ghost = fixture . debugElement . queryAll ( By . css ( '.igx-grid__drag-ghost-image' ) ) ;
918+ expect ( ghost . length ) . toEqual ( 1 ) ;
919+
920+ UIInteractions . simulatePointerEvent ( 'pointerup' , header , 230 , 30 ) ;
921+ await wait ( ) ;
922+ fixture . detectChanges ( ) ;
923+ } ) ;
899924 } ) ;
900925
901926 describe ( 'Resizing' , ( ) => {
@@ -1335,6 +1360,19 @@ export class ColumnLayoutGroupingTestComponent extends ColumnLayoutPinningTestCo
13351360 { field : 'Country' , rowStart : 2 , colStart : 2 , groupable : true } ,
13361361 { field : 'Address' , rowStart : 3 , colStart : 1 , colEnd : 3 }
13371362 ] ;
1363+
1364+ public override colGroups : ColGroupsType [ ] = [
1365+ {
1366+ group : 'group1' ,
1367+ pinned : true ,
1368+ columns : this . cols2
1369+ } ,
1370+ {
1371+ group : 'group2' ,
1372+ pinned : false ,
1373+ columns : this . cols1
1374+ }
1375+ ] ;
13381376}
13391377@Component ( {
13401378 template : `
0 commit comments