@@ -355,7 +355,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
355355 } ) ;
356356
357357 test . describe ( title ( 'sheet modal: drag events' ) , ( ) => {
358- test ( 'should emit ionDragStart, ionDragMove, and ionDragEnd events' , async ( { page } ) => {
358+ test . only ( 'should emit ionDragStart, ionDragMove, and ionDragEnd events' , async ( { page } ) => {
359359 await page . goto ( '/src/components/modal/test/sheet' , config ) ;
360360
361361 const ionModalDidPresent = await page . spyOnEvent ( 'ionModalDidPresent' ) ;
@@ -368,17 +368,30 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
368368 const ionDragEnd = await page . spyOnEvent ( 'ionDragEnd' ) ;
369369
370370 const header = page . locator ( '.modal-sheet ion-header' ) ;
371- await dragElementBy ( header , page , 0 , 100 ) ;
371+
372+ // Start the drag to verify it emits the events before the gesture ends
373+ await dragElementBy ( header , page , 0 , 50 , undefined , undefined , false ) ;
372374
373375 await ionDragStart . next ( ) ;
374376 const dragMoveEvent = await ionDragMove . next ( ) ;
375- const dragEndEvent = await ionDragEnd . next ( ) ;
376377
377378 expect ( ionDragStart . length ) . toBe ( 1 ) ;
378379
379380 expect ( ionDragMove . length ) . toBeGreaterThan ( 0 ) ;
380381 expect ( Object . keys ( dragMoveEvent . detail ) . length ) . toBe ( 5 ) ;
381382
383+ expect ( ionDragEnd . length ) . toBe ( 0 ) ;
384+
385+ // Drag the modal item further to verify it does not emit the event
386+ // again for `ionDragStart` or `ionDragMove`, but does emit `ionDragEnd`
387+ // when the gesture is released
388+ await dragElementBy ( header , page , 0 , 100 ) ;
389+
390+ const dragEndEvent = await ionDragEnd . next ( ) ;
391+
392+ expect ( ionDragStart . length ) . toBe ( 1 ) ;
393+ expect ( ionDragMove . length ) . toBeGreaterThan ( 0 ) ;
394+
382395 expect ( ionDragEnd . length ) . toBe ( 1 ) ;
383396 expect ( Object . keys ( dragEndEvent . detail ) . length ) . toBe ( 5 ) ;
384397 } ) ;
0 commit comments