#69 : Add unit tests
This commit is contained in:
@@ -157,7 +157,7 @@ export function getPartialPageSize({
|
|||||||
while(true) {
|
while(true) {
|
||||||
const diff = particlesCountWithoutClones - particlesCount - overlap
|
const diff = particlesCountWithoutClones - particlesCount - overlap
|
||||||
if (diff < particlesToShow) {
|
if (diff < particlesToShow) {
|
||||||
return diff
|
return Math.max(diff, 0) // show: 2; scroll: 3, n: 5 => -1
|
||||||
}
|
}
|
||||||
particlesCount += particlesToShow + overlap
|
particlesCount += particlesToShow + overlap
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ describe('getPartialPageSize', () => {
|
|||||||
particlesToShow: 2,
|
particlesToShow: 2,
|
||||||
particlesToScroll: 2,
|
particlesToScroll: 2,
|
||||||
expected: 0,
|
expected: 0,
|
||||||
|
}, {
|
||||||
|
particlesCountWithoutClones: 5,
|
||||||
|
particlesToShow: 2,
|
||||||
|
particlesToScroll: 3,
|
||||||
|
expected: 0,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
testCases.forEach(({
|
testCases.forEach(({
|
||||||
|
|||||||
Reference in New Issue
Block a user