|
2 | 2 |
|
3 | 3 | describe('uiSortable', function() {
|
4 | 4 |
|
| 5 | + beforeEach(module(function($compileProvider) { |
| 6 | + if (typeof $compileProvider.debugInfoEnabled === 'function') { |
| 7 | + $compileProvider.debugInfoEnabled(false); |
| 8 | + } |
| 9 | + })); |
| 10 | + |
5 | 11 | // Ensure the sortable angular module is loaded
|
6 | 12 | beforeEach(module('ui.sortable'));
|
7 | 13 | beforeEach(module('ui.sortable.testHelper'));
|
@@ -68,14 +74,17 @@ describe('uiSortable', function() {
|
68 | 74 | inject(function($compile, $rootScope) {
|
69 | 75 | var elementTop, elementBottom,
|
70 | 76 | wrapperTop, wrapperBottom,
|
| 77 | + wrapperTopScope, wrapperBottomScope, |
71 | 78 | itemsTop, itemsBottom;
|
72 |
| - 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); |
73 |
| - 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); |
74 | 83 |
|
75 | 84 | host.append(wrapperTop).append(wrapperBottom).append('<div class="clear"></div>');
|
76 | 85 | $rootScope.$apply(function() {
|
77 |
| - wrapperTop.scope().itemsTop = itemsTop = ['Top One', 'Top Two', 'Top Three']; |
78 |
| - 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']; |
79 | 88 | $rootScope.opts = { connectWith: '.cross-sortable' };
|
80 | 89 | });
|
81 | 90 |
|
@@ -462,9 +471,9 @@ describe('uiSortable', function() {
|
462 | 471 | $rootScope.opts = {
|
463 | 472 | connectWith: '.cross-sortable',
|
464 | 473 | update: function(e, ui) {
|
465 |
| - if (ui.item.scope() && |
466 |
| - (typeof ui.item.scope().item === 'string') && |
467 |
| - 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) { |
468 | 477 | ui.item.sortable.cancel();
|
469 | 478 | }
|
470 | 479 | }
|
@@ -521,9 +530,9 @@ describe('uiSortable', function() {
|
521 | 530 | $rootScope.opts = {
|
522 | 531 | connectWith: '.cross-sortable',
|
523 | 532 | update: function(e, ui) {
|
524 |
| - if (ui.item.scope() && |
525 |
| - (typeof ui.item.scope().item === 'string') && |
526 |
| - 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) { |
527 | 536 | ui.item.sortable.cancel();
|
528 | 537 | }
|
529 | 538 | updateCallbackExpectations(ui.item.sortable);
|
@@ -660,9 +669,9 @@ describe('uiSortable', function() {
|
660 | 669 | $rootScope.opts = {
|
661 | 670 | connectWith: '.cross-sortable',
|
662 | 671 | update: function(e, ui) {
|
663 |
| - if (ui.item.scope() && |
664 |
| - (typeof ui.item.scope().item === 'string') && |
665 |
| - 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) { |
666 | 675 | ui.item.sortable.cancel();
|
667 | 676 | }
|
668 | 677 | updateCallbackExpectations(ui.item.sortable);
|
@@ -729,21 +738,24 @@ describe('uiSortable', function() {
|
729 | 738 | inject(function($compile, $rootScope) {
|
730 | 739 | var elementTop, elementBottom,
|
731 | 740 | wrapperTop, wrapperBottom,
|
| 741 | + wrapperTopScope, wrapperBottomScope, |
732 | 742 | itemsTop, itemsBottom,
|
733 | 743 | updateCallbackExpectations;
|
734 |
| - 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); |
735 |
| - 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); |
736 | 748 |
|
737 | 749 | host.append(wrapperTop).append(wrapperBottom).append('<div class="clear"></div>');
|
738 | 750 | $rootScope.$apply(function() {
|
739 |
| - wrapperTop.scope().itemsTop = itemsTop = ['Top One', 'Top Two', 'Top Three']; |
740 |
| - 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']; |
741 | 753 | $rootScope.opts = {
|
742 | 754 | connectWith: '.cross-sortable',
|
743 | 755 | update: function(e, ui) {
|
744 |
| - if (ui.item.scope() && |
745 |
| - (typeof ui.item.scope().item === 'string') && |
746 |
| - 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) { |
747 | 759 | ui.item.sortable.cancel();
|
748 | 760 | }
|
749 | 761 | updateCallbackExpectations(ui.item.sortable);
|
@@ -824,9 +836,9 @@ describe('uiSortable', function() {
|
824 | 836 | },
|
825 | 837 | update: function(e, ui) {
|
826 | 838 | uiItem.sortable = ui.item.sortable;
|
827 |
| - if (ui.item.scope() && |
828 |
| - (typeof ui.item.scope().item === 'string') && |
829 |
| - 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) { |
830 | 842 | ui.item.sortable.cancel();
|
831 | 843 | }
|
832 | 844 | }
|
|
0 commit comments