@@ -30,7 +30,7 @@ describe('uiScroll user min/max indicies.', () => {
30
30
describe ( 'Setting\n' , ( ) => {
31
31
injectDatasource ( 'myInfiniteDatasource' ) ;
32
32
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' , ( ) =>
34
34
runTest ( scrollSettings ,
35
35
( viewport ) => {
36
36
expect ( viewport . scrollTop ( ) ) . toBe ( itemHeight * bufferSize ) ;
@@ -44,7 +44,7 @@ describe('uiScroll user min/max indicies.', () => {
44
44
)
45
45
) ;
46
46
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' , ( ) =>
48
48
runTest ( scrollSettings ,
49
49
( viewport ) => {
50
50
expect ( viewport . scrollTop ( ) ) . toBe ( itemHeight * bufferSize ) ;
@@ -85,6 +85,21 @@ describe('uiScroll user min/max indicies.', () => {
85
85
) ;
86
86
} ) ;
87
87
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
+
88
103
} ) ;
89
104
90
105
describe ( 'Reload\n' , ( ) => {
0 commit comments