File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ class NestedSort {
180180 this . removeClassFromEl ( this . targetedNode , this . classNames . targeted )
181181 this . cleanupPlaceholderLists ( ) ;
182182 this . draggedNode = null
183+ this . targetedNode = null
183184 }
184185
185186 onDrop ( e ) {
Original file line number Diff line number Diff line change @@ -377,6 +377,28 @@ describe('NestedSort', () => {
377377
378378 expect ( ns . draggedNode ) . toBeNull ( )
379379 } )
380+
381+ it ( 'should set the targetedNode property to null' , ( ) => {
382+ const ns = new NestedSort ( {
383+ data : [
384+ { id : 1 , text : 'One' } ,
385+ { id : 2 , text : 'Two' } ,
386+ ] ,
387+ el : `#${ dynamicListWrapperId } ` ,
388+ } )
389+
390+ ns . draggedNode = document . querySelector ( '[data-id="1"]' )
391+ ns . targetedNode = document . querySelector ( '[data-id="2"]' )
392+ const stopPropagation = jest . fn ( )
393+
394+ ns . draggedNode . dispatchEvent (
395+ createEvent ( 'dragend' , {
396+ stopPropagation,
397+ } )
398+ )
399+
400+ expect ( ns . targetedNode ) . toBeNull ( )
401+ } )
380402 } )
381403
382404 describe ( 'drop event' , ( ) => {
You can’t perform that action at this time.
0 commit comments