bug处理

This commit is contained in:
truewhile
2026-09-18 23:35:56 +08:00
parent 0810bfb234
commit 474513f18a
4 changed files with 103 additions and 30 deletions
+12
View File
@@ -1,4 +1,6 @@
import {
isJumpIntentKey,
isScrollIntentKey,
shouldPersistClampedSample,
shouldPersistScrollSample,
shouldRememberScroll,
@@ -11,6 +13,7 @@ function check(name: string, condition: boolean) {
check('home remembers scroll', shouldRememberScroll('/'))
check('library list remembers scroll', shouldRememberScroll('/libraries'))
check('library detail remembers scroll', shouldRememberScroll('/library/lib-1'))
check('library series panel remembers scroll', shouldRememberScroll('/library/lib-1'))
check('media detail remembers scroll', shouldRememberScroll('/media/media-1'))
check('settings does not remember scroll', !shouldRememberScroll('/settings'))
check('player does not remember scroll', !shouldRememberScroll('/play/media-1'))
@@ -87,4 +90,13 @@ check(
!shouldPersistClampedSample({ current: 0, maxScroll: 0, saved: 0 }),
)
check('page down counts as scroll intent', isScrollIntentKey('PageDown'))
check('space counts as scroll intent', isScrollIntentKey(' '))
check('typing does not count as scroll intent', !isScrollIntentKey('a'))
check('shortcut does not count as scroll intent', !isScrollIntentKey('Meta'))
check('page down allows a long jump', isJumpIntentKey('PageDown'))
check('home allows a long jump', isJumpIntentKey('Home'))
check('arrow key keeps smooth-only intent', !isJumpIntentKey('ArrowDown'))
check('space keeps smooth-only intent', !isJumpIntentKey(' '))
console.log('useScrollMemory.test.ts ok')