@@ -189,6 +189,38 @@ describe('IgxForOf directive -', () => {
189189 expect ( state . startIndex ) . toBe ( 1 ) ;
190190 } ) ;
191191
192+ it ( 'should display the correct chunk items on resizing the container' , ( ) => {
193+ // initially the container's width is narrow enough to be scrollable
194+ fix . componentInstance . width = '200px' ;
195+ fix . componentInstance . cols = [
196+ { field : '1' , width : 100 } ,
197+ { field : '2' , width : 100 } ,
198+ { field : '3' , width : 100 } ,
199+ { field : '4' , width : 100 } ,
200+ { field : '5' , width : 100 }
201+ ] ;
202+ fix . detectChanges ( ) ;
203+
204+ expect ( displayContainer ) . not . toBeNull ( ) ;
205+
206+ // scroll the container so that at least the first col is out of view
207+ fix . componentInstance . scrollLeft ( displayContainer . clientWidth ) ;
208+ fix . detectChanges ( ) ;
209+
210+ fix . componentInstance . childVirtDirs . toArray ( ) . forEach ( element => {
211+ expect ( element . state . startIndex ) . not . toBe ( 0 ) ;
212+ } ) ;
213+
214+ // the container's width is assigned as wide as to display all cols
215+ fix . componentInstance . width = '600px' ;
216+ fix . detectChanges ( ) ;
217+
218+ const secondRecChildren = fix . nativeElement . querySelectorAll ( DISPLAY_CONTAINER ) [ 1 ] . children ;
219+ for ( let i = 0 ; i < secondRecChildren . length ; i ++ ) {
220+ expect ( secondRecChildren [ i ] . textContent )
221+ . toBe ( fix . componentInstance . data [ 1 ] [ i + 1 ] . toString ( ) ) ;
222+ }
223+ } ) ;
192224 } ) ;
193225
194226 describe ( 'vertical virtual component' , ( ) => {
0 commit comments