1
1
describe ( 'collectionRepeat' , function ( ) {
2
-
3
2
var el ;
4
3
beforeEach ( module ( 'ionic' , function ( $provide ) {
5
4
$provide . decorator ( '$$rAF' , function ( $delegate ) {
@@ -222,6 +221,10 @@ describe('collectionRepeat', function() {
222
221
} ) ) ;
223
222
224
223
it ( 'should refresh layout on scrollCtrl.resize' , inject ( function ( $timeout , $window ) {
224
+ spyOn ( $window , 'getComputedStyle' ) . andReturn ( {
225
+ width : '1px' ,
226
+ height : '50px'
227
+ } ) ;
225
228
var el = setup ( 10 , 'item-height="20px"' , {
226
229
__clientHeight : 50 ,
227
230
__clientWidth : 1
@@ -289,16 +292,20 @@ describe('collectionRepeat', function() {
289
292
} ) ;
290
293
291
294
describe ( 'vertical static list' , function ( ) {
292
- beforeEach ( function ( ) {
295
+ beforeEach ( inject ( function ( $window ) {
296
+ spyOn ( $window , 'getComputedStyle' ) . andReturn ( {
297
+ width : '50px' ,
298
+ height : '50px'
299
+ } ) ;
293
300
setup ( 10 ) ;
294
- } ) ;
301
+ } ) ) ;
295
302
296
303
it ( 'should show initial screen of items' , function ( ) {
297
304
expect ( activeItems ( ) . length ) . toBe ( 5 ) ;
298
305
expect ( activeItemContents ( ) ) . toEqual ( [ '0' , '1' , '2' , '3' , '4' ] ) ;
299
306
} ) ;
300
307
301
- it ( 'should switch out as you scroll' , function ( ) {
308
+ it ( 'should switch out as you scroll' , inject ( function ( $window ) {
302
309
expect ( activeItems ( ) . length ) . toBe ( 5 ) ;
303
310
expect ( activeItemContents ( ) ) . toEqual ( [ '0' , '1' , '2' , '3' , '4' ] ) ;
304
311
expect ( activeItemIds ( ) ) . toEqual ( [ 'item0' , 'item1' , 'item2' , 'item3' , 'item4' ] ) ;
@@ -323,7 +330,7 @@ describe('collectionRepeat', function() {
323
330
expect ( activeItems ( ) . length ) . toBe ( 5 ) ;
324
331
expect ( activeItemContents ( ) ) . toEqual ( [ '5' , '6' , '7' , '8' , '9' ] ) ;
325
332
expect ( activeItemIds ( ) ) . toEqual ( [ 'item0' , 'item1' , 'item2' , 'item3' , 'item4' ] ) ;
326
- } ) ;
333
+ } ) ) ;
327
334
328
335
it ( 'should start with the same items when resizing' , inject ( function ( $window ) {
329
336
scrollTo ( 26 ) ;
@@ -338,8 +345,8 @@ describe('collectionRepeat', function() {
338
345
angular . element ( $window ) . triggerHandler ( 'resize' ) ;
339
346
340
347
expect ( activeItems ( ) . length ) . toBe ( 2 ) ;
341
- expect ( activeItemContents ( ) ) . toEqual ( [ '2 ' , '3 ' ] ) ;
342
- expect ( activeItemIds ( ) ) . toEqual ( [ 'item2 ' , 'item3 ' ] ) ;
348
+ expect ( activeItemContents ( ) ) . toEqual ( [ '8 ' , '9 ' ] ) ;
349
+ expect ( activeItemIds ( ) ) . toEqual ( [ 'item1 ' , 'item0 ' ] ) ;
343
350
} ) ) ;
344
351
345
352
} ) ;
0 commit comments