This repository was archived by the owner on Sep 8, 2020. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 11{
22  "name" : " angular-ui-sortable"  ,
3-   "version" : " 0.12.4 "  ,
3+   "version" : " 0.12.5 "  ,
44  "description" : " This directive allows you to jQueryUI Sortable."  ,
55  "author" : " https://github.com/angular-ui/ui-sortable/graphs/contributors"  ,
66  "license" : " MIT"  ,
Original file line number Diff line number Diff line change 11{
22  "name" : " angular-ui-sortable"  ,
3-   "version" : " 0.12.4 "  ,
3+   "version" : " 0.12.5 "  ,
44  "description" : " This directive allows you to jQueryUI Sortable."  ,
55  "author" : " https://github.com/angular-ui/ui-sortable/graphs/contributors"  ,
66  "license" : " MIT"  ,
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ angular.module('ui.sortable', [])
3535
3636          angular . extend ( opts ,  uiSortableConfig ) ; 
3737
38+           if  ( ! angular . element . fn  ||  ! angular . element . fn . jquery )  { 
39+             $log . error ( 'ui.sortable: jQuery should be included before AngularJS!' ) ; 
40+             return ; 
41+           } 
42+ 
3843          if  ( ngModel )  { 
3944
4045            // When we add or remove elements, we need the sortable to 'refresh' 
Original file line number Diff line number Diff line change @@ -36,6 +36,29 @@ describe('uiSortable', function() {
3636      } ) ; 
3737    } ) ; 
3838
39+     it ( 'should log an error about jQuery dependency' ,  function ( )  { 
40+       inject ( function ( $compile ,  $rootScope ,  $log )  { 
41+         var  oldAngularElementFn  =  angular . element . fn ; 
42+         var  mockJQliteFn  =  $ ( { } ,  angular . element . fn ,  true ) ; 
43+         mockJQliteFn . jquery  =  null ; 
44+         angular . element . fn  =  mockJQliteFn ; 
45+ 
46+         this . after ( function  ( )  { 
47+           angular . element . fn  =  oldAngularElementFn ; 
48+         } ) ; 
49+ 
50+         var  element ; 
51+         element  =  $compile ( '<ul ui-sortable><li ng-repeat="item in items" id="s-{{$index}}">{{ item }}</li></ul>' ) ( $rootScope ) ; 
52+         $rootScope . $apply ( function ( )  { 
53+           $rootScope . items  =  [ 'One' ,  'Two' ,  'Three' ] ; 
54+         } ) ; 
55+ 
56+         expect ( $log . error . logs . length ) . toEqual ( 1 ) ; 
57+         expect ( $log . error . logs [ 0 ] . length ) . toEqual ( 1 ) ; 
58+         expect ( $log . error . logs [ 0 ] [ 0 ] ) . toEqual ( 'ui.sortable: jQuery should be included before AngularJS!' ) ; 
59+       } ) ; 
60+     } ) ; 
61+ 
3962    it ( 'should refresh sortable properly after an apply' ,  function ( )  { 
4063      inject ( function ( $compile ,  $rootScope ,  $timeout )  { 
4164        var  element ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments