Skip to content

Commit 7f77a4d

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Comple drag&drop in test to destroy ghost between tests.
1 parent f59af44 commit 7f77a4d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid/row-drag.directive.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,12 @@ describe('Row Drag Tests #grid', () => {
420420
]
421421
});
422422
}));
423-
it('should correctly create custom ghost element', () => {
423+
beforeEach(fakeAsync(() => {
424424
fixture = TestBed.createComponent(IgxGridRowCustomGhostDraggableComponent);
425425
grid = fixture.componentInstance.instance;
426426
fixture.detectChanges();
427+
}));
428+
it('should correctly create custom ghost element', () => {
427429
dropAreaElement = fixture.debugElement.query(By.css(CSS_CLASS_DROPPABLE_AREA)).nativeElement;
428430
rows = grid.rowList.toArray();
429431
dragIndicatorElements = fixture.debugElement.queryAll(By.css(CSS_CLASS_DRAG_INDICATOR));
@@ -449,12 +451,11 @@ describe('Row Drag Tests #grid', () => {
449451

450452
const ghostText = document.getElementsByClassName(CSS_CLASS_GHOST_ROW)[0].textContent;
451453
expect(ghostText).toEqual(' Moving a row! ');
454+
const pointerUpEvent = UIInteractions.createPointerEvent('pointerup', dropPoint);
455+
rowDragDirective.onPointerUp(pointerUpEvent);
452456
});
453457

454458
it('should allow setting custom drag icon and ghost element via Input.', () => {
455-
fixture = TestBed.createComponent(IgxGridRowCustomGhostDraggableComponent);
456-
grid = fixture.componentInstance.instance as IgxGridComponent;
457-
fixture.detectChanges();
458459
dropAreaElement = fixture.debugElement.query(By.css(CSS_CLASS_DROPPABLE_AREA)).nativeElement;
459460
grid.dragIndicatorIconTemplate = fixture.componentInstance.rowDragTemplate;
460461
grid.dragGhostCustomTemplate = fixture.componentInstance.rowDragGhostTemplate;
@@ -483,6 +484,9 @@ describe('Row Drag Tests #grid', () => {
483484
const ghostText = document.getElementsByClassName(CSS_CLASS_GHOST_ROW)[0].textContent;
484485
expect(ghostText.trim()).toEqual('CUSTOM');
485486

487+
const pointerUpEvent = UIInteractions.createPointerEvent('pointerup', dropPoint);
488+
rowDragDirective.onPointerUp(pointerUpEvent);
489+
486490
});
487491
});
488492
});

0 commit comments

Comments
 (0)