@@ -159,10 +159,13 @@ describe('ionicInfiniteScroll directive', function() {
159
159
} ) ;
160
160
161
161
setupNative ( '' , { } , opts ) ;
162
+ var tmp = window . getComputedStyle ;
163
+ window . getComputedStyle = function ( ) { return { } ; } ;
162
164
expect ( ctrl . getNativeMaxScroll ( ) ) . toEqual ( {
163
165
left : opts . scrollingX ? scrollLeftMaxValue * 0.975 : - 1 ,
164
166
top : opts . scrollingY ? scrollTopMaxValue * 0.975 : - 1
165
167
} ) ;
168
+ window . getComputedStyle = tmp ;
166
169
} ) ;
167
170
168
171
it ( 'should use attr.distance as number' , function ( ) {
@@ -173,10 +176,14 @@ describe('ionicInfiniteScroll directive', function() {
173
176
} ) ;
174
177
175
178
setupNative ( 'distance=3' , { } , opts ) ;
179
+
180
+ var tmp = window . getComputedStyle ;
181
+ window . getComputedStyle = function ( ) { return { } ; } ;
176
182
expect ( ctrl . getNativeMaxScroll ( ) ) . toEqual ( {
177
183
left : opts . scrollingX ? scrollLeftMaxValue - 3 : - 1 ,
178
184
top : opts . scrollingY ? scrollTopMaxValue - 3 : - 1
179
185
} ) ;
186
+ window . getComputedStyle = tmp ;
180
187
} ) ;
181
188
182
189
it ( 'should use attr.distance as percent' , function ( ) {
@@ -187,10 +194,14 @@ describe('ionicInfiniteScroll directive', function() {
187
194
} ) ;
188
195
189
196
setupNative ( 'distance=5%' , { } , opts ) ;
197
+
198
+ var tmp = window . getComputedStyle ;
199
+ window . getComputedStyle = function ( ) { return { } ; } ;
190
200
expect ( ctrl . getNativeMaxScroll ( ) ) . toEqual ( {
191
201
left : opts . scrollingX ? scrollLeftMaxValue * 0.95 : - 1 ,
192
202
top : opts . scrollingY ? scrollTopMaxValue * 0.95 : - 1
193
203
} ) ;
204
+ window . getComputedStyle = tmp ;
194
205
} ) ;
195
206
} ) ;
196
207
@@ -232,7 +243,11 @@ describe('ionicInfiniteScroll directive', function() {
232
243
scrollTopValue = scrollTopMaxValue ;
233
244
var el = setupNative ( 'on-infinite="foo=1"' , { } , { scrollingX : true , scrollingY : true } ) ;
234
245
ionic . requestAnimationFrame = function ( cb ) { cb ( ) ; } ;
246
+
247
+ var tmp = window . getComputedStyle ;
248
+ window . getComputedStyle = function ( ) { return { } ; } ;
235
249
ctrl . checkBounds ( ) ;
250
+ window . getComputedStyle = tmp ;
236
251
expect ( el . hasClass ( 'active' ) ) . toBe ( true ) ;
237
252
ionic . requestAnimationFrame = function ( ) { } ;
238
253
expect ( ctrl . isLoading ) . toBe ( true ) ;
@@ -252,7 +267,11 @@ describe('ionicInfiniteScroll directive', function() {
252
267
scrollLeftValue = scrollLeftMaxValue ;
253
268
var el = setupNative ( 'on-infinite="foo=1"' , { } , { scrollingX : true , scrollingY : true } ) ;
254
269
ionic . requestAnimationFrame = function ( cb ) { cb ( ) ; } ;
270
+
271
+ var tmp = window . getComputedStyle ;
272
+ window . getComputedStyle = function ( ) { return { } ; } ;
255
273
ctrl . checkBounds ( ) ;
274
+ window . getComputedStyle = tmp ;
256
275
257
276
expect ( el . hasClass ( 'active' ) ) . toBe ( true ) ;
258
277
ionic . requestAnimationFrame = function ( ) { } ;
0 commit comments