refactor: split modules.test.js into 12 per-module test files
Replaces the monolithic modules.test.js (983 lines) with focused
per-module test files sharing a common test-setup.js. Each file is
under 225 lines. All existing test assertions preserved.
New files: test-setup.js, anchor.test.js, schema.test.js, cache.test.js,
cards-nav.test.js, markdown.test.js, vault-batch.test.js, i18n.test.js,
scroll.test.js, settings.test.js, providers.test.js, streaming.test.js,
cli.test.js
Change-Id: I37a3342a1588807277e679e6535cde361e650565
2026-04-27 07:21:03 +00:00
|
|
|
const { assert, t } = require('./test-setup');
|
|
|
|
|
|
|
|
|
|
assert.strictEqual(t.visibleTopProbeY({ top: 0, height: 0 }), 0, 'zero rect');
|
|
|
|
|
assert.strictEqual(t.visibleTopProbeY(null), 0, 'null rect');
|
|
|
|
|
assert.strictEqual(t.visibleTopProbeY({ top: 50, height: 500 }), 100, 'standard rect: min(80, 500*0.1)=50, 50+50=100');
|
|
|
|
|
assert.strictEqual(t.visibleTopProbeY({ top: 100, height: 300 }), 130, 'small rect offset 10%');
|
|
|
|
|
assert.strictEqual(t.visibleTopProbeY({ top: 100, height: 1200 }), 180, 'large rect capped at 80');
|
|
|
|
|
|
|
|
|
|
const frames = [];
|
2026-04-27 11:53:35 +00:00
|
|
|
const throttled = t.createRafThrottledHandler(
|
|
|
|
|
() => {},
|
|
|
|
|
(cb) => {
|
|
|
|
|
frames.push(cb);
|
|
|
|
|
return frames.length;
|
|
|
|
|
},
|
|
|
|
|
);
|
refactor: split modules.test.js into 12 per-module test files
Replaces the monolithic modules.test.js (983 lines) with focused
per-module test files sharing a common test-setup.js. Each file is
under 225 lines. All existing test assertions preserved.
New files: test-setup.js, anchor.test.js, schema.test.js, cache.test.js,
cards-nav.test.js, markdown.test.js, vault-batch.test.js, i18n.test.js,
scroll.test.js, settings.test.js, providers.test.js, streaming.test.js,
cli.test.js
Change-Id: I37a3342a1588807277e679e6535cde361e650565
2026-04-27 07:21:03 +00:00
|
|
|
throttled();
|
|
|
|
|
assert.strictEqual(frames.length, 1);
|
|
|
|
|
throttled.cancel();
|
|
|
|
|
throttled();
|
|
|
|
|
assert.strictEqual(frames.length, 2, 'new frame after cancel');
|
|
|
|
|
|
|
|
|
|
console.log('scroll tests passed');
|