File tree 2 files changed +29
-1
lines changed
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ function $$RAFProvider(){ //rAF
8
8
9
9
var cancelAnimationFrame = $window . cancelAnimationFrame ||
10
10
$window . webkitCancelAnimationFrame ||
11
- $window . mozCancelAnimationFrame ;
11
+ $window . mozCancelAnimationFrame ||
12
+ $window . webkitCancelRequestAnimationFrame ;
12
13
13
14
var rafSupported = ! ! requestAnimationFrame ;
14
15
var raf = rafSupported
Original file line number Diff line number Diff line change @@ -76,4 +76,31 @@ describe('$$rAF', function() {
76
76
}
77
77
} ) ) ;
78
78
} ) ;
79
+
80
+ describe ( 'mobile' , function ( ) {
81
+ it ( 'should provide a cancellation method for an older version of Android' , function ( ) {
82
+
83
+ //we need to create our own injector to work around the ngMock overrides
84
+ var injector = createInjector ( [ 'ng' , function ( $provide ) {
85
+ $provide . decorator ( '$window' , function ( $delegate ) {
86
+ $delegate . requestAnimationFrame = noop ;
87
+ $delegate . cancelAnimationFrame = false ;
88
+ $delegate . webkitCancelAnimationFrame = false ;
89
+ $delegate . mozCancelAnimationFrame = false ;
90
+ $delegate . webkitCancelRequestAnimationFrame = jasmine . createSpy ( ) ;
91
+ return $delegate ;
92
+ } ) ;
93
+ } ] ) ;
94
+
95
+ var $$rAF = injector . get ( '$$rAF' ) ;
96
+ var $window = injector . get ( '$window' ) ;
97
+ var cancel = $$rAF ( function ( ) { } ) ;
98
+
99
+ try {
100
+ cancel ( ) ;
101
+ } catch ( e ) { }
102
+
103
+ expect ( $window . webkitCancelRequestAnimationFrame ) . toHaveBeenCalled ( ) ;
104
+ } ) ;
105
+ } ) ;
79
106
} ) ;
You can’t perform that action at this time.
0 commit comments