11describe ( 'collectionRepeat' , function ( ) {
2-
32 var el ;
43 beforeEach ( module ( 'ionic' , function ( $provide ) {
54 $provide . decorator ( '$$rAF' , function ( $delegate ) {
@@ -222,6 +221,10 @@ describe('collectionRepeat', function() {
222221 } ) ) ;
223222
224223 it ( 'should refresh layout on scrollCtrl.resize' , inject ( function ( $timeout , $window ) {
224+ spyOn ( $window , 'getComputedStyle' ) . andReturn ( {
225+ width : '1px' ,
226+ height : '50px'
227+ } ) ;
225228 var el = setup ( 10 , 'item-height="20px"' , {
226229 __clientHeight : 50 ,
227230 __clientWidth : 1
@@ -289,16 +292,20 @@ describe('collectionRepeat', function() {
289292 } ) ;
290293
291294 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+ } ) ;
293300 setup ( 10 ) ;
294- } ) ;
301+ } ) ) ;
295302
296303 it ( 'should show initial screen of items' , function ( ) {
297304 expect ( activeItems ( ) . length ) . toBe ( 5 ) ;
298305 expect ( activeItemContents ( ) ) . toEqual ( [ '0' , '1' , '2' , '3' , '4' ] ) ;
299306 } ) ;
300307
301- it ( 'should switch out as you scroll' , function ( ) {
308+ it ( 'should switch out as you scroll' , inject ( function ( $window ) {
302309 expect ( activeItems ( ) . length ) . toBe ( 5 ) ;
303310 expect ( activeItemContents ( ) ) . toEqual ( [ '0' , '1' , '2' , '3' , '4' ] ) ;
304311 expect ( activeItemIds ( ) ) . toEqual ( [ 'item0' , 'item1' , 'item2' , 'item3' , 'item4' ] ) ;
@@ -323,7 +330,7 @@ describe('collectionRepeat', function() {
323330 expect ( activeItems ( ) . length ) . toBe ( 5 ) ;
324331 expect ( activeItemContents ( ) ) . toEqual ( [ '5' , '6' , '7' , '8' , '9' ] ) ;
325332 expect ( activeItemIds ( ) ) . toEqual ( [ 'item0' , 'item1' , 'item2' , 'item3' , 'item4' ] ) ;
326- } ) ;
333+ } ) ) ;
327334
328335 it ( 'should start with the same items when resizing' , inject ( function ( $window ) {
329336 scrollTo ( 26 ) ;
@@ -338,8 +345,8 @@ describe('collectionRepeat', function() {
338345 angular . element ( $window ) . triggerHandler ( 'resize' ) ;
339346
340347 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 ' ] ) ;
343350 } ) ) ;
344351
345352 } ) ;
0 commit comments