@@ -16,6 +16,7 @@ describe('draggable directive', () => {
16
16
[ghostDragEnabled]="ghostDragEnabled"
17
17
[validateDrag]="validateDrag"
18
18
[dragCursor]="dragCursor"
19
+ (dragPointerDown)="dragPointerDown($event)"
19
20
(dragStart)="dragStart($event)"
20
21
(dragging)="dragging($event)"
21
22
(dragEnd)="dragEnd($event)">
@@ -24,9 +25,10 @@ describe('draggable directive', () => {
24
25
} )
25
26
class TestComponent {
26
27
@ViewChild ( DraggableDirective ) draggable : DraggableDirective ;
27
- dragStart : sinon . SinonSpy = sinon . spy ( ) ;
28
- dragging : sinon . SinonSpy = sinon . spy ( ) ;
29
- dragEnd : sinon . SinonSpy = sinon . spy ( ) ;
28
+ dragPointerDown = sinon . spy ( ) ;
29
+ dragStart = sinon . spy ( ) ;
30
+ dragging = sinon . spy ( ) ;
31
+ dragEnd = sinon . spy ( ) ;
30
32
dragAxis : any = { x : true , y : true } ;
31
33
dragSnapGrid : any = { } ;
32
34
ghostDragEnabled : boolean = true ;
@@ -58,6 +60,10 @@ describe('draggable directive', () => {
58
60
const draggableElement : HTMLElement =
59
61
fixture . componentInstance . draggable . element . nativeElement ;
60
62
triggerDomEvent ( 'mousedown' , draggableElement , { clientX : 5 , clientY : 10 } ) ;
63
+ expect ( fixture . componentInstance . dragPointerDown ) . to . have . been . calledWith ( {
64
+ x : 0 ,
65
+ y : 0
66
+ } ) ;
61
67
triggerDomEvent ( 'mousemove' , draggableElement , { clientX : 7 , clientY : 10 } ) ;
62
68
expect ( fixture . componentInstance . dragStart ) . to . have . been . calledWith ( {
63
69
x : 0 ,
@@ -537,6 +543,7 @@ describe('draggable directive', () => {
537
543
const draggableElement : HTMLElement =
538
544
fixture . componentInstance . draggable . element . nativeElement ;
539
545
triggerDomEvent ( 'mousedown' , draggableElement , { clientX : 5 , clientY : 10 } ) ;
546
+ expect ( fixture . componentInstance . dragPointerDown ) . to . have . been . calledOnce ;
540
547
expect ( fixture . componentInstance . dragStart ) . not . to . have . been . called ;
541
548
expect ( fixture . componentInstance . dragging ) . not . to . have . been . called ;
542
549
triggerDomEvent ( 'mouseup' , draggableElement , { clientX : 5 , clientY : 10 } ) ;
@@ -551,6 +558,7 @@ describe('draggable directive', () => {
551
558
triggerDomEvent ( 'mousemove' , draggableElement , { clientX : 7 , clientY : 10 } ) ;
552
559
triggerDomEvent ( 'mouseup' , draggableElement , { clientX : 7 , clientY : 8 } ) ;
553
560
sinon . assert . callOrder (
561
+ fixture . componentInstance . dragPointerDown ,
554
562
fixture . componentInstance . dragStart ,
555
563
fixture . componentInstance . dragging ,
556
564
fixture . componentInstance . dragEnd
0 commit comments