import { VirtualScrolling } from '../Models/VirtualScrolling' ; import { getVirtualized , isVirtualScrollingEnabled } from './Virtualize' ; describe ( 'Virtualize' , ( ) => { const data = new Array ( 100 ) . fill ( 0 ) . map ( ( _ , index ) => index ) ; describe ( 'getVirtualized' , ( ) => { it ( 'scrollTop 0' , ( ) => { const virtualScrolling = { itemHeight : ( ) => 10 , scrollTop : 0 , tbodyHeight : 40 , } ; const result = getVirtualized ( virtualScrolling , data ) ; expect ( result ) . toMatchSnapshot ( ) ; } ) ; it ( 'scrollTop 100' , ( ) => { const virtualScrolling = { itemHeight : ( ) => 10 , scrollTop : 100 , tbodyHeight : 40 , } ; const result = getVirtualized ( virtualScrolling , data ) ; expect ( result ) . toMatchSnapshot ( ) ; } ) ; it ( 'scrollTop 900' , ( ) => { const virtualScrolling = { itemHeight : ( ) => 10 , scrollTop : 900 , tbodyHeight : 40 , } ; const result = getVirtualized ( virtualScrolling , data ) ; expect ( result ) . toMatchSnapshot ( ) ; } ) ; it ( 'itemHeight 40' , ( ) => { const virtualScrolling = { itemHeight : 40 , scrollTop : 0 , tbodyHeight : 160 , } ; const result = getVirtualized ( virtualScrolling , data ) ; expect ( result ) . toMatchSnapshot ( ) ; } ) ; } ) ; it ( 'isVirtualScrollingEnabled' , ( ) => { expect ( isVirtualScrollingEnabled ( ) ) . toBeFalsy ( ) ; expect ( isVirtualScrollingEnabled ( { } ) ) . toBeTruthy ( ) ; expect ( isVirtualScrollingEnabled ( { enabled : true } ) ) . toBeTruthy ( ) ; expect ( isVirtualScrollingEnabled ( { enabled : false } ) ) . toBeFalsy ( ) ; } ) ; } ) ;