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 1
1
{
2
2
"name" : " angular-ui-sortable" ,
3
- "version" : " 0.12.4 " ,
3
+ "version" : " 0.12.5 " ,
4
4
"description" : " This directive allows you to jQueryUI Sortable." ,
5
5
"author" : " https://github.com/angular-ui/ui-sortable/graphs/contributors" ,
6
6
"license" : " MIT" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " angular-ui-sortable" ,
3
- "version" : " 0.12.4 " ,
3
+ "version" : " 0.12.5 " ,
4
4
"description" : " This directive allows you to jQueryUI Sortable." ,
5
5
"author" : " https://github.com/angular-ui/ui-sortable/graphs/contributors" ,
6
6
"license" : " MIT" ,
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ angular.module('ui.sortable', [])
35
35
36
36
angular . extend ( opts , uiSortableConfig ) ;
37
37
38
+ if ( ! angular . element . fn || ! angular . element . fn . jquery ) {
39
+ $log . error ( 'ui.sortable: jQuery should be included before AngularJS!' ) ;
40
+ return ;
41
+ }
42
+
38
43
if ( ngModel ) {
39
44
40
45
// 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() {
36
36
} ) ;
37
37
} ) ;
38
38
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
+
39
62
it ( 'should refresh sortable properly after an apply' , function ( ) {
40
63
inject ( function ( $compile , $rootScope , $timeout ) {
41
64
var element ;
You can’t perform that action at this time.
0 commit comments