@@ -325,19 +325,20 @@ describe('uiScroll Paddings spec.', () => {
325
325
326
326
327
327
describe ( 'Removing items via indexed-based applyUpdates when neither BOF nor EOF are reached\n' , ( ) => {
328
+ const _scrollSettings = Object . assign ( { } , scrollSettings , { startIndex : 12 } ) ;
328
329
329
330
[ true , false ] . forEach ( userIndicies =>
330
- it ( 'should remove first row' + appendTitle ( true , userIndicies ) , ( ) =>
331
- runTest ( Object . assign ( { } , scrollSettings , { startIndex : 12 } ) ,
331
+ it ( 'should remove first buffered row' + appendTitle ( true , userIndicies ) , ( ) =>
332
+ runTest ( _scrollSettings ,
332
333
( viewport , scope ) => {
333
334
userIndicies && setUserIndicies ( ) ;
334
335
335
336
removeItem ( datasource , 2 ) ;
336
337
scope . adapter . applyUpdates ( 2 , [ ] ) ;
337
338
338
- scrollBottom ( viewport ) ;
339
+ scrollBottom ( viewport , MAX ) ;
339
340
expect ( getBottomPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
340
- checkRowBack ( viewport , 1 , '29: item30' ) ;
341
+ checkRowBack ( viewport , 1 , ( itemsCount - 1 ) + ': item' + itemsCount ) ;
341
342
342
343
scrollTop ( viewport ) ;
343
344
expect ( getTopPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
@@ -349,8 +350,8 @@ describe('uiScroll Paddings spec.', () => {
349
350
) ;
350
351
351
352
[ true , false ] . forEach ( userIndicies =>
352
- it ( 'should remove last row' + appendTitle ( true , userIndicies ) , ( ) =>
353
- runTest ( Object . assign ( { } , scrollSettings , { startIndex : 12 } ) ,
353
+ it ( 'should remove last buffered row' + appendTitle ( true , userIndicies ) , ( ) =>
354
+ runTest ( _scrollSettings ,
354
355
( viewport , scope ) => {
355
356
userIndicies && setUserIndicies ( ) ;
356
357
@@ -359,10 +360,54 @@ describe('uiScroll Paddings spec.', () => {
359
360
360
361
scrollBottom ( viewport ) ;
361
362
expect ( getBottomPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
362
- checkRowBack ( viewport , 1 , '29: item30' ) ;
363
+ checkRowBack ( viewport , 1 , ( itemsCount - 1 ) + ': item' + itemsCount ) ;
364
+
365
+ scrollTop ( viewport ) ;
366
+ expect ( getTopPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
367
+ }
368
+ )
369
+ )
370
+ ) ;
371
+
372
+ [ true , false ] . forEach ( userIndicies =>
373
+ it ( 'should remove absolute first row' + appendTitle ( true , userIndicies ) , ( ) =>
374
+ runTest ( _scrollSettings ,
375
+ ( viewport , scope ) => {
376
+ userIndicies && setUserIndicies ( ) ;
377
+
378
+ removeItem ( datasource , 1 ) ;
379
+ scope . adapter . applyUpdates ( 1 , [ ] ) ;
380
+
381
+ scrollBottom ( viewport , MAX ) ;
382
+ expect ( getBottomPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
383
+ checkRowBack ( viewport , 1 , itemsCount + ': item' + itemsCount ) ;
363
384
364
385
scrollTop ( viewport ) ;
365
386
expect ( getTopPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
387
+ checkRow ( viewport , 1 , '2: item2' ) ;
388
+ checkRow ( viewport , 2 , '3: item3' ) ;
389
+ }
390
+ )
391
+ )
392
+ ) ;
393
+
394
+ [ true , false ] . forEach ( userIndicies =>
395
+ it ( 'should remove absolute last row' + appendTitle ( true , userIndicies ) , ( ) =>
396
+ runTest ( _scrollSettings ,
397
+ ( viewport , scope ) => {
398
+ userIndicies && setUserIndicies ( ) ;
399
+
400
+ removeItem ( datasource , itemsCount ) ;
401
+ scope . adapter . applyUpdates ( itemsCount , [ ] ) ;
402
+
403
+ scrollBottom ( viewport , MAX ) ;
404
+ expect ( getBottomPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
405
+ checkRowBack ( viewport , 1 , ( itemsCount - 1 ) + ': item' + ( itemsCount - 1 ) ) ;
406
+
407
+ scrollTop ( viewport ) ;
408
+ expect ( getTopPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
409
+ checkRow ( viewport , 1 , '1: item1' ) ;
410
+ checkRow ( viewport , 2 , '2: item2' ) ;
366
411
}
367
412
)
368
413
)
0 commit comments