test(web): свод 2 — окно строк через отступы виртуализатора
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
782a04381b
commit
2421f7ddd5
24
web/src/pages/Svod2Page/svod2Virtualizer.test.js
Normal file
24
web/src/pages/Svod2Page/svod2Virtualizer.test.js
Normal file
@ -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);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user