@@ -301,6 +301,50 @@ describe("draggable.vue when initialized with list", () => {
301
301
} ) ;
302
302
} )
303
303
304
+ describe ( "when calling onMove" , ( ) => {
305
+ let evt ;
306
+ let originalEvt ;
307
+ let move ;
308
+ let doMove ;
309
+
310
+ beforeEach ( ( ) => {
311
+ //item = element.children[2];
312
+ evt = {
313
+ to : element ,
314
+ related : element ,
315
+ willInsertAfter : false
316
+ } ;
317
+ originalEvt = { } ;
318
+ move = getEvent ( "onMove" ) ;
319
+ doMove = ( ) => move ( evt , originalEvt ) ;
320
+ } ) ;
321
+
322
+ it ( "returns true when move props is null" , ( ) => {
323
+ const actual = doMove ( ) ;
324
+ expect ( actual ) . toBe ( true ) ;
325
+ } ) ;
326
+
327
+ describe ( "when move is set" , ( ) => {
328
+ let move ;
329
+ beforeEach ( ( ) => {
330
+ move = jest . fn ( ) ;
331
+ wrapper . setProps ( { move } ) ;
332
+ } )
333
+
334
+ test . each ( [
335
+ true ,
336
+ false
337
+ ] ) (
338
+ "returns move result %o" ,
339
+ ( result ) => {
340
+ move . mockImplementation ( ( ) => result )
341
+ const actual = doMove ( ) ;
342
+ expect ( actual ) . toBe ( result ) ;
343
+ }
344
+ )
345
+ } ) ;
346
+ } ) ;
347
+
304
348
describe ( "when remove is called" , ( ) => {
305
349
beforeEach ( ( ) => {
306
350
element . removeChild ( item ) ;
@@ -430,14 +474,12 @@ describe("draggable.vue when initialized with list", () => {
430
474
] ) (
431
475
"when option %s change for value %o, calls sortable option with %s attribute" ,
432
476
( attribute , value , sortableAttribute ) => {
433
- wrapper . setProps ( { options : { [ attribute ] : value } } ) ;
477
+ wrapper . setProps ( { options : { [ attribute ] : value } } ) ;
434
478
expect ( SortableFake . option ) . toHaveBeenCalledWith ( sortableAttribute , value ) ;
435
479
}
436
480
) ;
437
-
438
481
} )
439
482
440
-
441
483
describe ( "draggable.vue when initialized with value" , ( ) => {
442
484
beforeEach ( ( ) => {
443
485
Sortable . mockClear ( ) ;
0 commit comments