@@ -446,6 +446,36 @@ describe('uiSortable', function() {
446
446
} ) ;
447
447
} ) ;
448
448
449
+ it ( 'should work when "helper: clone" and "appendTo" options are used together' , function ( ) {
450
+ inject ( function ( $compile , $rootScope ) {
451
+ var element ;
452
+ element = $compile ( '<ul ui-sortable="opts" ng-model="items"><li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li></ul>' ) ( $rootScope ) ;
453
+ $rootScope . $apply ( function ( ) {
454
+ $rootScope . opts = {
455
+ helper : 'clone' ,
456
+ appendTo : document . body
457
+ } ;
458
+ $rootScope . items = [ 'One' , 'Two' , 'Three' ] ;
459
+ } ) ;
460
+
461
+ host . append ( element ) ;
462
+
463
+ var li = element . find ( ':eq(1)' ) ;
464
+ var dy = ( 1 + EXTRA_DY_PERCENTAGE ) * li . outerHeight ( ) ;
465
+ li . simulate ( 'drag' , { dy : dy } ) ;
466
+ expect ( $rootScope . items ) . toEqual ( [ 'One' , 'Three' , 'Two' ] ) ;
467
+ expect ( $rootScope . items ) . toEqual ( listContent ( element ) ) ;
468
+
469
+ li = element . find ( ':eq(2)' ) ;
470
+ dy = - ( 1 + EXTRA_DY_PERCENTAGE ) * li . outerHeight ( ) ;
471
+ li . simulate ( 'drag' , { dy : dy } ) ;
472
+ expect ( $rootScope . items ) . toEqual ( [ 'One' , 'Two' , 'Three' ] ) ;
473
+ expect ( $rootScope . items ) . toEqual ( listContent ( element ) ) ;
474
+
475
+ $ ( element ) . remove ( ) ;
476
+ } ) ;
477
+ } ) ;
478
+
449
479
it ( 'should work when "helper: clone" and "placeholder" options are used together.' , function ( ) {
450
480
inject ( function ( $compile , $rootScope ) {
451
481
var element ;
0 commit comments