@@ -51,6 +51,57 @@ describe('requestAnimationFrame', function () {
51
51
} ) ;
52
52
} ) ;
53
53
54
+ describe ( 'mozRequestAnimationFrame' , function ( ) {
55
+ var flag , hasParent , skip = false ;
56
+
57
+ it ( 'should work' , function ( done ) {
58
+
59
+ if ( ! window . mozRequestAnimationFrame ) {
60
+ console . log ( 'WARNING: skipping mozRequestAnimationFrame test (missing this API)' ) ;
61
+ return ;
62
+ }
63
+
64
+ // Some browsers (especially Safari) do not fire mozRequestAnimationFrame
65
+ // if they are offscreen. We can disable this test for those browsers and
66
+ // assume the patch works if setTimeout works, since they are mechanically
67
+ // the same
68
+ runs ( function ( ) {
69
+ flag = false ;
70
+ window . mozRequestAnimationFrame ( function ( ) {
71
+ flag = true ;
72
+ } ) ;
73
+ setTimeout ( function ( ) {
74
+ skip = true ;
75
+ flag = true ;
76
+ console . log ( 'WARNING: skipping mozRequestAnimationFrame test (not firing rAF)' ) ;
77
+ } , 50 ) ;
78
+ } ) ;
79
+
80
+ waitsFor ( function ( ) {
81
+ return flag ;
82
+ } , 'mozRequestAnimationFrame to run' , 100 ) ;
83
+
84
+ runs ( function ( ) {
85
+ flag = false ;
86
+ hasParent = false ;
87
+
88
+ window . mozRequestAnimationFrame ( function ( ) {
89
+ hasParent = ! ! window . zone . parent ;
90
+ flag = true ;
91
+ } ) ;
92
+ } ) ;
93
+
94
+ waitsFor ( function ( ) {
95
+ return flag || skip ;
96
+ } , 'mozRequestAnimationFrame to run' , 100 ) ;
97
+
98
+ runs ( function ( ) {
99
+ expect ( hasParent || skip ) . toBe ( true ) ;
100
+ } ) ;
101
+
102
+ } ) ;
103
+ } ) ;
104
+
54
105
describe ( 'webkitRequestAnimationFrame' , function ( ) {
55
106
var flag , hasParent , skip = false ;
56
107
@@ -100,4 +151,4 @@ describe('webkitRequestAnimationFrame', function () {
100
151
} ) ;
101
152
102
153
} ) ;
103
- } ) ;
154
+ } ) ;
0 commit comments