@@ -388,6 +388,37 @@ describe('CdkDrag', () => {
388388 expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
389389 } ) ) ;
390390
391+ it ( 'should be able to reset a freely-dragged item to its initial position' , fakeAsync ( ( ) => {
392+ const fixture = createComponent ( StandaloneDraggable ) ;
393+ fixture . detectChanges ( ) ;
394+ const dragElement = fixture . componentInstance . dragElement . nativeElement ;
395+
396+ expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
397+
398+ dragElementViaMouse ( fixture , dragElement , 50 , 100 ) ;
399+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 100px, 0px)' ) ;
400+
401+ fixture . componentInstance . dragInstance . reset ( ) ;
402+
403+ expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
404+ } ) ) ;
405+
406+ it ( 'should start dragging an item from its initial position after a reset' , fakeAsync ( ( ) => {
407+ const fixture = createComponent ( StandaloneDraggable ) ;
408+ fixture . detectChanges ( ) ;
409+ const dragElement = fixture . componentInstance . dragElement . nativeElement ;
410+
411+ expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
412+
413+ dragElementViaMouse ( fixture , dragElement , 50 , 100 ) ;
414+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 100px, 0px)' ) ;
415+
416+ fixture . componentInstance . dragInstance . reset ( ) ;
417+
418+ dragElementViaMouse ( fixture , dragElement , 25 , 50 ) ;
419+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(25px, 50px, 0px)' ) ;
420+ } ) ) ;
421+
391422 } ) ;
392423
393424 describe ( 'draggable with a handle' , ( ) => {
0 commit comments