@@ -30,7 +30,7 @@ describe('uiScroll user min/max indicies.', () => {
3030 describe ( 'Setting\n' , ( ) => {
3131 injectDatasource ( 'myInfiniteDatasource' ) ;
3232
33- it ( 'should calculate bottom padding element\'s height after user max index is set' , ( ) =>
33+ it ( 'should set up bottom padding element\'s height after user max index is set' , ( ) =>
3434 runTest ( scrollSettings ,
3535 ( viewport ) => {
3636 expect ( viewport . scrollTop ( ) ) . toBe ( itemHeight * bufferSize ) ;
@@ -44,7 +44,7 @@ describe('uiScroll user min/max indicies.', () => {
4444 )
4545 ) ;
4646
47- it ( 'should calculate top padding element\'s height after user min index is set' , ( ) =>
47+ it ( 'should set up top padding element\'s height after user min index is set' , ( ) =>
4848 runTest ( scrollSettings ,
4949 ( viewport ) => {
5050 expect ( viewport . scrollTop ( ) ) . toBe ( itemHeight * bufferSize ) ;
@@ -85,6 +85,21 @@ describe('uiScroll user min/max indicies.', () => {
8585 ) ;
8686 } ) ;
8787
88+ it ( 'should work when the viewport is big enough to include more than 1 pack of item' , ( ) => {
89+ const viewportHeight = 450 ;
90+ const _topItemsCount = Math . round ( viewportHeight * 0.5 / itemHeight ) ;
91+ const _topPackCount = Math . ceil ( _topItemsCount / bufferSize ) ;
92+ const _minIndex = ( - 1 ) * _topPackCount * bufferSize + 1
93+ datasource . minIndex = _minIndex ;
94+ datasource . maxIndex = userMaxIndex ;
95+ runTest ( Object . assign ( { } , scrollSettings , { viewportHeight } ) ,
96+ ( viewport ) => {
97+ expect ( Helper . getTopPadding ( viewport ) ) . toBe ( 0 ) ;
98+ expect ( viewport . scrollTop ( ) ) . toBe ( _topPackCount * bufferSize * itemHeight ) ;
99+ }
100+ ) ;
101+ } ) ;
102+
88103 } ) ;
89104
90105 describe ( 'Reload\n' , ( ) => {
0 commit comments