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 {
180
180
this . removeClassFromEl ( this . targetedNode , this . classNames . targeted )
181
181
this . cleanupPlaceholderLists ( ) ;
182
182
this . draggedNode = null
183
+ this . targetedNode = null
183
184
}
184
185
185
186
onDrop ( e ) {
Original file line number Diff line number Diff line change @@ -377,6 +377,28 @@ describe('NestedSort', () => {
377
377
378
378
expect ( ns . draggedNode ) . toBeNull ( )
379
379
} )
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
+ } )
380
402
} )
381
403
382
404
describe ( 'drop event' , ( ) => {
You can’t perform that action at this time.
0 commit comments