@@ -74,14 +74,17 @@ describe('uiSortable', function() {
7474 inject ( function ( $compile , $rootScope ) {
7575 var elementTop , elementBottom ,
7676 wrapperTop , wrapperBottom ,
77+ wrapperTopScope , wrapperBottomScope ,
7778 itemsTop , itemsBottom ;
78- wrapperTop = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop"><li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li></ul></div>' ) ( $rootScope ) ;
79- wrapperBottom = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom"><li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li></ul></div>' ) ( $rootScope ) ;
79+ wrapperTopScope = $rootScope . $new ( ) ;
80+ wrapperBottomScope = $rootScope . $new ( ) ;
81+ wrapperTop = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop"><li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li></ul></div>' ) ( wrapperTopScope ) ;
82+ wrapperBottom = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom"><li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li></ul></div>' ) ( wrapperBottomScope ) ;
8083
8184 host . append ( wrapperTop ) . append ( wrapperBottom ) . append ( '<div class="clear"></div>' ) ;
8285 $rootScope . $apply ( function ( ) {
83- wrapperTop . scope ( ) . itemsTop = itemsTop = [ 'Top One' , 'Top Two' , 'Top Three' ] ;
84- wrapperBottom . scope ( ) . itemsBottom = itemsBottom = [ 'Bottom One' , 'Bottom Two' , 'Bottom Three' ] ;
86+ wrapperTopScope . itemsTop = itemsTop = [ 'Top One' , 'Top Two' , 'Top Three' ] ;
87+ wrapperBottomScope . itemsBottom = itemsBottom = [ 'Bottom One' , 'Bottom Two' , 'Bottom Three' ] ;
8588 $rootScope . opts = { connectWith : '.cross-sortable' } ;
8689 } ) ;
8790
@@ -468,9 +471,9 @@ describe('uiSortable', function() {
468471 $rootScope . opts = {
469472 connectWith : '.cross-sortable' ,
470473 update : function ( e , ui ) {
471- if ( ui . item . scope ( ) &&
472- ( typeof ui . item . scope ( ) . item === 'string' ) &&
473- ui . item . scope ( ) . item . indexOf ( 'Two' ) >= 0 ) {
474+ if ( ui . item . sortable . model &&
475+ ( typeof ui . item . sortable . model === 'string' ) &&
476+ ui . item . sortable . model . indexOf ( 'Two' ) >= 0 ) {
474477 ui . item . sortable . cancel ( ) ;
475478 }
476479 }
@@ -527,9 +530,9 @@ describe('uiSortable', function() {
527530 $rootScope . opts = {
528531 connectWith : '.cross-sortable' ,
529532 update : function ( e , ui ) {
530- if ( ui . item . scope ( ) &&
531- ( typeof ui . item . scope ( ) . item === 'string' ) &&
532- ui . item . scope ( ) . item . indexOf ( 'Two' ) >= 0 ) {
533+ if ( ui . item . sortable . model &&
534+ ( typeof ui . item . sortable . model === 'string' ) &&
535+ ui . item . sortable . model . indexOf ( 'Two' ) >= 0 ) {
533536 ui . item . sortable . cancel ( ) ;
534537 }
535538 updateCallbackExpectations ( ui . item . sortable ) ;
@@ -666,9 +669,9 @@ describe('uiSortable', function() {
666669 $rootScope . opts = {
667670 connectWith : '.cross-sortable' ,
668671 update : function ( e , ui ) {
669- if ( ui . item . scope ( ) &&
670- ( typeof ui . item . scope ( ) . item === 'string' ) &&
671- ui . item . scope ( ) . item . indexOf ( 'Two' ) >= 0 ) {
672+ if ( ui . item . sortable . model &&
673+ ( typeof ui . item . sortable . model === 'string' ) &&
674+ ui . item . sortable . model . indexOf ( 'Two' ) >= 0 ) {
672675 ui . item . sortable . cancel ( ) ;
673676 }
674677 updateCallbackExpectations ( ui . item . sortable ) ;
@@ -735,21 +738,24 @@ describe('uiSortable', function() {
735738 inject ( function ( $compile , $rootScope ) {
736739 var elementTop , elementBottom ,
737740 wrapperTop , wrapperBottom ,
741+ wrapperTopScope , wrapperBottomScope ,
738742 itemsTop , itemsBottom ,
739743 updateCallbackExpectations ;
740- wrapperTop = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop"><li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li></ul></div>' ) ( $rootScope ) ;
741- wrapperBottom = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom"><li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li></ul></div>' ) ( $rootScope ) ;
744+ wrapperTopScope = $rootScope . $new ( ) ;
745+ wrapperBottomScope = $rootScope . $new ( ) ;
746+ wrapperTop = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop"><li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li></ul></div>' ) ( wrapperTopScope ) ;
747+ wrapperBottom = $compile ( '<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom"><li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li></ul></div>' ) ( wrapperBottomScope ) ;
742748
743749 host . append ( wrapperTop ) . append ( wrapperBottom ) . append ( '<div class="clear"></div>' ) ;
744750 $rootScope . $apply ( function ( ) {
745- wrapperTop . scope ( ) . itemsTop = itemsTop = [ 'Top One' , 'Top Two' , 'Top Three' ] ;
746- wrapperBottom . scope ( ) . itemsBottom = itemsBottom = [ 'Bottom One' , 'Bottom Two' , 'Bottom Three' ] ;
751+ wrapperTopScope . itemsTop = itemsTop = [ 'Top One' , 'Top Two' , 'Top Three' ] ;
752+ wrapperBottomScope . itemsBottom = itemsBottom = [ 'Bottom One' , 'Bottom Two' , 'Bottom Three' ] ;
747753 $rootScope . opts = {
748754 connectWith : '.cross-sortable' ,
749755 update : function ( e , ui ) {
750- if ( ui . item . scope ( ) &&
751- ( typeof ui . item . scope ( ) . item === 'string' ) &&
752- ui . item . scope ( ) . item . indexOf ( 'Two' ) >= 0 ) {
756+ if ( ui . item . sortable . model &&
757+ ( typeof ui . item . sortable . model === 'string' ) &&
758+ ui . item . sortable . model . indexOf ( 'Two' ) >= 0 ) {
753759 ui . item . sortable . cancel ( ) ;
754760 }
755761 updateCallbackExpectations ( ui . item . sortable ) ;
@@ -830,9 +836,9 @@ describe('uiSortable', function() {
830836 } ,
831837 update : function ( e , ui ) {
832838 uiItem . sortable = ui . item . sortable ;
833- if ( ui . item . scope ( ) &&
834- ( typeof ui . item . scope ( ) . item === 'string' ) &&
835- ui . item . scope ( ) . item . indexOf ( 'Two' ) >= 0 ) {
839+ if ( ui . item . sortable . model &&
840+ ( typeof ui . item . sortable . model === 'string' ) &&
841+ ui . item . sortable . model . indexOf ( 'Two' ) >= 0 ) {
836842 ui . item . sortable . cancel ( ) ;
837843 }
838844 }
0 commit comments