This repository was archived by the owner on Mar 1, 2025. It is now read-only.
File tree 2 files changed +28
-2
lines changed
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ function $$RAFProvider(){ //rAF
6
6
$window . webkitRequestAnimationFrame ;
7
7
8
8
var cancelAnimationFrame = $window . cancelAnimationFrame ||
9
- $window . webkitCancelAnimationFrame ;
9
+ $window . webkitCancelAnimationFrame ||
10
+ $window . webkitCancelRequestAnimationFrame ;
10
11
11
12
var raf = function ( fn ) {
12
13
var id = requestAnimationFrame ( fn ) ;
@@ -19,4 +20,4 @@ function $$RAFProvider(){ //rAF
19
20
20
21
return raf ;
21
22
} ] ;
22
- }
23
+ }
Original file line number Diff line number Diff line change @@ -44,4 +44,29 @@ describe('$$rAF', function() {
44
44
}
45
45
} ) ) ;
46
46
} ) ;
47
+
48
+ describe ( 'mobile' , function ( ) {
49
+ it ( 'should provide a cancellation method for an older version of Android' , function ( ) {
50
+
51
+ //we need to create our own injector to work around the ngMock overrides
52
+ var injector = createInjector ( [ 'ng' , function ( $provide ) {
53
+ $provide . value ( '$window' , {
54
+ webkitRequestAnimationFrame : jasmine . createSpy ( '$window.webkitRequestAnimationFrame' ) ,
55
+ webkitCancelRequestAnimationFrame : jasmine . createSpy ( '$window.webkitCancelRequestAnimationFrame' )
56
+ } ) ;
57
+ } ] ) ;
58
+
59
+ var $$rAF = injector . get ( '$$rAF' ) ;
60
+ var $window = injector . get ( '$window' ) ;
61
+ var cancel = $$rAF ( function ( ) { } ) ;
62
+
63
+ expect ( $$rAF . supported ) . toBe ( true ) ;
64
+
65
+ try {
66
+ cancel ( ) ;
67
+ } catch ( e ) { }
68
+
69
+ expect ( $window . webkitCancelRequestAnimationFrame ) . toHaveBeenCalled ( ) ;
70
+ } ) ;
71
+ } ) ;
47
72
} ) ;
You can’t perform that action at this time.
0 commit comments