@@ -325,19 +325,20 @@ describe('uiScroll Paddings spec.', () => {
325325
326326
327327 describe ( 'Removing items via indexed-based applyUpdates when neither BOF nor EOF are reached\n' , ( ) => {
328+ const _scrollSettings = Object . assign ( { } , scrollSettings , { startIndex : 12 } ) ;
328329
329330 [ 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 ,
332333 ( viewport , scope ) => {
333334 userIndicies && setUserIndicies ( ) ;
334335
335336 removeItem ( datasource , 2 ) ;
336337 scope . adapter . applyUpdates ( 2 , [ ] ) ;
337338
338- scrollBottom ( viewport ) ;
339+ scrollBottom ( viewport , MAX ) ;
339340 expect ( getBottomPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
340- checkRowBack ( viewport , 1 , '29: item30' ) ;
341+ checkRowBack ( viewport , 1 , ( itemsCount - 1 ) + ': item' + itemsCount ) ;
341342
342343 scrollTop ( viewport ) ;
343344 expect ( getTopPaddingHeight ( viewport ) ) . toBe ( 0 ) ;
@@ -349,8 +350,8 @@ describe('uiScroll Paddings spec.', () => {
349350 ) ;
350351
351352 [ 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 ,
354355 ( viewport , scope ) => {
355356 userIndicies && setUserIndicies ( ) ;
356357
@@ -359,10 +360,54 @@ describe('uiScroll Paddings spec.', () => {
359360
360361 scrollBottom ( viewport ) ;
361362 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 ) ;
363384
364385 scrollTop ( viewport ) ;
365386 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' ) ;
366411 }
367412 )
368413 )
0 commit comments