@@ -476,6 +476,36 @@ describe('uiSortable', function() {
476476 } ) ;
477477 } ) ;
478478
479+ it ( 'should work when "helper: clone" and "appendTo [jQuery object]" options are used together' , function ( ) {
480+ inject ( function ( $compile , $rootScope ) {
481+ var element ;
482+ 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 ) ;
483+ $rootScope . $apply ( function ( ) {
484+ $rootScope . opts = {
485+ helper : 'clone' ,
486+ appendTo : angular . element ( document . body )
487+ } ;
488+ $rootScope . items = [ 'One' , 'Two' , 'Three' ] ;
489+ } ) ;
490+
491+ host . append ( element ) ;
492+
493+ var li = element . find ( ':eq(1)' ) ;
494+ var dy = ( 1 + EXTRA_DY_PERCENTAGE ) * li . outerHeight ( ) ;
495+ li . simulate ( 'drag' , { dy : dy } ) ;
496+ expect ( $rootScope . items ) . toEqual ( [ 'One' , 'Three' , 'Two' ] ) ;
497+ expect ( $rootScope . items ) . toEqual ( listContent ( element ) ) ;
498+
499+ li = element . find ( ':eq(2)' ) ;
500+ dy = - ( 1 + EXTRA_DY_PERCENTAGE ) * li . outerHeight ( ) ;
501+ li . simulate ( 'drag' , { dy : dy } ) ;
502+ expect ( $rootScope . items ) . toEqual ( [ 'One' , 'Two' , 'Three' ] ) ;
503+ expect ( $rootScope . items ) . toEqual ( listContent ( element ) ) ;
504+
505+ $ ( element ) . remove ( ) ;
506+ } ) ;
507+ } ) ;
508+
479509 it ( 'should work when "helper: clone" and "placeholder" options are used together.' , function ( ) {
480510 inject ( function ( $compile , $rootScope ) {
481511 var element ;
0 commit comments