#69 : Code cleanup

This commit is contained in:
Vadim
2021-09-13 22:46:32 +03:00
parent 6108dbf910
commit 3715f77af1
3 changed files with 8 additions and 8 deletions

View File

@@ -10,7 +10,7 @@
import { tappable } from '../../actions/tappable'
import {
addResizeEventListener,
removeResizeEventListener
removeResizeEventListener,
} from '../../utils/event'
import {
applyParticleSizes,

View File

@@ -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,

View File

@@ -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,