@@ -74,14 +74,17 @@ describe('uiSortable', function() {
74
74
inject ( function ( $compile , $rootScope ) {
75
75
var elementTop , elementBottom ,
76
76
wrapperTop , wrapperBottom ,
77
+ wrapperTopScope , wrapperBottomScope ,
77
78
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 ) ;
80
83
81
84
host . append ( wrapperTop ) . append ( wrapperBottom ) . append ( '<div class="clear"></div>' ) ;
82
85
$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' ] ;
85
88
$rootScope . opts = { connectWith : '.cross-sortable' } ;
86
89
} ) ;
87
90
@@ -468,9 +471,9 @@ describe('uiSortable', function() {
468
471
$rootScope . opts = {
469
472
connectWith : '.cross-sortable' ,
470
473
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 ) {
474
477
ui . item . sortable . cancel ( ) ;
475
478
}
476
479
}
@@ -527,9 +530,9 @@ describe('uiSortable', function() {
527
530
$rootScope . opts = {
528
531
connectWith : '.cross-sortable' ,
529
532
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 ) {
533
536
ui . item . sortable . cancel ( ) ;
534
537
}
535
538
updateCallbackExpectations ( ui . item . sortable ) ;
@@ -666,9 +669,9 @@ describe('uiSortable', function() {
666
669
$rootScope . opts = {
667
670
connectWith : '.cross-sortable' ,
668
671
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 ) {
672
675
ui . item . sortable . cancel ( ) ;
673
676
}
674
677
updateCallbackExpectations ( ui . item . sortable ) ;
@@ -735,21 +738,24 @@ describe('uiSortable', function() {
735
738
inject ( function ( $compile , $rootScope ) {
736
739
var elementTop , elementBottom ,
737
740
wrapperTop , wrapperBottom ,
741
+ wrapperTopScope , wrapperBottomScope ,
738
742
itemsTop , itemsBottom ,
739
743
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 ) ;
742
748
743
749
host . append ( wrapperTop ) . append ( wrapperBottom ) . append ( '<div class="clear"></div>' ) ;
744
750
$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' ] ;
747
753
$rootScope . opts = {
748
754
connectWith : '.cross-sortable' ,
749
755
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 ) {
753
759
ui . item . sortable . cancel ( ) ;
754
760
}
755
761
updateCallbackExpectations ( ui . item . sortable ) ;
@@ -830,9 +836,9 @@ describe('uiSortable', function() {
830
836
} ,
831
837
update : function ( e , ui ) {
832
838
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 ) {
836
842
ui . item . sortable . cancel ( ) ;
837
843
}
838
844
}
0 commit comments