From 2421f7ddd50ce170a70bc3d3af6772bfab8587a9 Mon Sep 17 00:00:00 2001 From: Andrey Epifancev Date: Wed, 28 Oct 2026 22:17:21 +0400 Subject: [PATCH] =?UTF-8?q?test(web):=20=D1=81=D0=B2=D0=BE=D0=B4=202=20?= =?UTF-8?q?=E2=80=94=20=D0=BE=D0=BA=D0=BD=D0=BE=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BE=D1=82=D1=81?= =?UTF-8?q?=D1=82=D1=83=D0=BF=D1=8B=20=D0=B2=D0=B8=D1=80=D1=82=D1=83=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=B0=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../pages/Svod2Page/svod2Virtualizer.test.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 web/src/pages/Svod2Page/svod2Virtualizer.test.js diff --git a/web/src/pages/Svod2Page/svod2Virtualizer.test.js b/web/src/pages/Svod2Page/svod2Virtualizer.test.js new file mode 100644 index 0000000..83c9691 --- /dev/null +++ b/web/src/pages/Svod2Page/svod2Virtualizer.test.js @@ -0,0 +1,24 @@ +import assert from 'node:assert/strict'; +import test from 'node:test'; +import { Virtualizer } from '@tanstack/virtual-core'; + +test('paddingStart/paddingEnd ставят глобальную строку i на i*rowH, общий размер = total*rowH', () => { + const rowH = 37; + const total = 5563; + const windowStart = 300; + const windowEnd = 1200; + const v = new Virtualizer({ + count: windowEnd - windowStart, + getScrollElement: () => null, + estimateSize: () => rowH, + paddingStart: windowStart * rowH, + paddingEnd: (total - windowEnd) * rowH, + scrollToFn: () => undefined, + observeElementRect: () => undefined, + observeElementOffset: () => undefined, + }); + const m = v.getMeasurements(); + assert.equal(m[0].start, windowStart * rowH); + assert.equal(m.at(-1).end, windowEnd * rowH); + assert.equal(v.getTotalSize(), total * rowH); +});