From 3715f77af19f5b2dd92b9cc715d4181d439fee85 Mon Sep 17 00:00:00 2001 From: Vadim Date: Mon, 13 Sep 2021 22:46:32 +0300 Subject: [PATCH] #69 : Code cleanup --- src/components/Carousel/Carousel.svelte | 2 +- src/utils/lazy.js | 4 ++-- src/utils/lazy.test.js | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/Carousel/Carousel.svelte b/src/components/Carousel/Carousel.svelte index 2e6e347..eddca6f 100644 --- a/src/components/Carousel/Carousel.svelte +++ b/src/components/Carousel/Carousel.svelte @@ -10,7 +10,7 @@ import { tappable } from '../../actions/tappable' import { addResizeEventListener, - removeResizeEventListener + removeResizeEventListener, } from '../../utils/event' import { applyParticleSizes, diff --git a/src/utils/lazy.js b/src/utils/lazy.js index f5c2696..ad6bbf6 100644 --- a/src/utils/lazy.js +++ b/src/utils/lazy.js @@ -1,6 +1,6 @@ import { getValueInRange } from './math' -export function getIndexesOfPagesWithoutClonesInScroll({ +export function getIndexesOfParticlesWithoutClonesInPage({ pageIndex, particlesToShow, particlesToScroll, @@ -47,7 +47,7 @@ export function getAdjacentIndexes({ pagesCount - 1, // needed to clone last page particles ])].sort((a, b) => a - b) const particleIndexes = pageIndexes.flatMap( - pageIndex => getIndexesOfPagesWithoutClonesInScroll({ + pageIndex => getIndexesOfParticlesWithoutClonesInPage({ pageIndex, particlesToShow, particlesToScroll, diff --git a/src/utils/lazy.test.js b/src/utils/lazy.test.js index 02e9add..0800b57 100644 --- a/src/utils/lazy.test.js +++ b/src/utils/lazy.test.js @@ -1,9 +1,9 @@ import { - getIndexesOfPagesWithoutClonesInScroll, + getIndexesOfParticlesWithoutClonesInPage, getAdjacentIndexes, } from './lazy.js' -describe('getIndexesOfPagesWithoutClonesInScroll', () => { +describe('getIndexesOfParticlesWithoutClonesInPage', () => { it('returns correct range if particlesToShow < particlesToScroll', () => { const testCases = [ { pageIndex: 0, particlesToShow: 3, particlesCount: 9, particlesToScroll: 4, expected: [0, 1, 2, 3] }, @@ -17,7 +17,7 @@ describe('getIndexesOfPagesWithoutClonesInScroll', () => { particlesCount, expected, }) => { - expect(getIndexesOfPagesWithoutClonesInScroll({ + expect(getIndexesOfParticlesWithoutClonesInPage({ pageIndex, particlesToShow, particlesToScroll, @@ -39,7 +39,7 @@ describe('getIndexesOfPagesWithoutClonesInScroll', () => { particlesCount, expected, }) => { - expect(getIndexesOfPagesWithoutClonesInScroll({ + expect(getIndexesOfParticlesWithoutClonesInPage({ pageIndex, particlesToShow, particlesToScroll, @@ -61,7 +61,7 @@ describe('getIndexesOfPagesWithoutClonesInScroll', () => { particlesCount, expected, }) => { - expect(getIndexesOfPagesWithoutClonesInScroll({ + expect(getIndexesOfParticlesWithoutClonesInPage({ pageIndex, particlesToShow, particlesToScroll,