@@ -18,27 +18,29 @@ describe('uiScroll', function() {
1818 var scrollSettings = { datasource : 'myEmptyDatasource' } ;
1919
2020 it ( 'should bind to window scroll and resize events and unbind them after the scope is destroyed' , function ( ) {
21- spyOn ( $ . fn , 'bind ' ) . and . callThrough ( ) ;
22- spyOn ( $ . fn , 'unbind ' ) . and . callThrough ( ) ;
21+ spyOn ( $ . fn , 'on ' ) . and . callThrough ( ) ;
22+ spyOn ( $ . fn , 'off ' ) . and . callThrough ( ) ;
2323 runTest ( scrollSettings ,
2424 function ( viewport ) {
25- expect ( $ . fn . bind . calls . all ( ) . length ) . toBe ( 3 ) ;
26- expect ( $ . fn . bind . calls . all ( ) [ 0 ] . args [ 0 ] ) . toBe ( 'mousewheel' ) ;
27- expect ( $ . fn . bind . calls . all ( ) [ 0 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
28- expect ( $ . fn . bind . calls . all ( ) [ 1 ] . args [ 0 ] ) . toBe ( 'resize' ) ;
29- expect ( $ . fn . bind . calls . all ( ) [ 1 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
30- expect ( $ . fn . bind . calls . all ( ) [ 2 ] . args [ 0 ] ) . toBe ( 'scroll' ) ;
31- expect ( $ . fn . bind . calls . all ( ) [ 2 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
25+ expect ( $ . fn . on . calls . all ( ) . length ) . toBe ( 4 ) ;
26+ expect ( $ . fn . on . calls . all ( ) [ 0 ] . args [ 0 ] ) . toBe ( 'visibilitychange' ) ;
27+ expect ( $ . fn . on . calls . all ( ) [ 1 ] . args [ 0 ] ) . toBe ( 'mousewheel' ) ;
28+ expect ( $ . fn . on . calls . all ( ) [ 1 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
29+ expect ( $ . fn . on . calls . all ( ) [ 2 ] . args [ 0 ] ) . toBe ( 'resize' ) ;
30+ expect ( $ . fn . on . calls . all ( ) [ 2 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
31+ expect ( $ . fn . on . calls . all ( ) [ 3 ] . args [ 0 ] ) . toBe ( 'scroll' ) ;
32+ expect ( $ . fn . on . calls . all ( ) [ 3 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
3233 } , {
3334 cleanupTest : function ( viewport , scope , $timeout ) {
3435 $timeout ( function ( ) {
35- expect ( $ . fn . unbind . calls . all ( ) . length ) . toBe ( 3 ) ;
36- expect ( $ . fn . unbind . calls . all ( ) [ 0 ] . args [ 0 ] ) . toBe ( 'resize' ) ;
37- expect ( $ . fn . unbind . calls . all ( ) [ 0 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
38- expect ( $ . fn . unbind . calls . all ( ) [ 1 ] . args [ 0 ] ) . toBe ( 'scroll' ) ;
39- expect ( $ . fn . unbind . calls . all ( ) [ 1 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
40- expect ( $ . fn . unbind . calls . all ( ) [ 2 ] . args [ 0 ] ) . toBe ( 'mousewheel' ) ;
41- expect ( $ . fn . unbind . calls . all ( ) [ 2 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
36+ expect ( $ . fn . off . calls . all ( ) . length ) . toBe ( 4 ) ;
37+ expect ( $ . fn . off . calls . all ( ) [ 0 ] . args [ 0 ] ) . toBe ( 'visibilitychange' ) ;
38+ expect ( $ . fn . off . calls . all ( ) [ 1 ] . args [ 0 ] ) . toBe ( 'resize' ) ;
39+ expect ( $ . fn . off . calls . all ( ) [ 1 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
40+ expect ( $ . fn . off . calls . all ( ) [ 2 ] . args [ 0 ] ) . toBe ( 'scroll' ) ;
41+ expect ( $ . fn . off . calls . all ( ) [ 2 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
42+ expect ( $ . fn . off . calls . all ( ) [ 3 ] . args [ 0 ] ) . toBe ( 'mousewheel' ) ;
43+ expect ( $ . fn . off . calls . all ( ) [ 3 ] . object [ 0 ] ) . toBe ( viewport [ 0 ] ) ;
4244 } ) ;
4345 }
4446 }
0 commit comments