test(hooks): useExpandableText, useScrollFloatingVisibility, useScrollOnNextQueryChange 테스트#354
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces unit tests for the useExpandableText, useScrollFloatingVisibility, and useScrollOnNextQueryChange hooks, covering functionalities such as overflow detection, scroll-based visibility, and query-triggered scrolling. The review feedback focuses on improving test isolation by ensuring that global objects and properties, specifically ResizeObserver and window.scrollY, are properly restored after being mocked or modified to prevent side effects in other test files.
|
🧷 Preview: https://reboot-n0mzvyzn2-code-base.vercel.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠️ 설명 (Description)
공통 훅 3종에 대한 테스트 코드를 추가했습니다.
useExpandableTextuseScrollFloatingVisibilityuseScrollOnNextQueryChange각 훅의 상태 변화와 부수효과가 의도대로 동작하는지 검증하는
회귀 테스트를 작성했습니다.
📝 변경 사항 요약 (Summary)
useExpandableText테스트 파일 추가useScrollFloatingVisibility테스트 파일 추가useScrollOnNextQueryChange테스트 파일 추가ResizeObserver,scrollIntoView,requestAnimationFrame,이벤트 리스너 cleanup 동작 검증 추가
💁 변경 사항 이유 (Why)
동작을 안정적으로 검증하기 위해서입니다.
부수효과 관련 버그를 사전에 방지하기 위해서입니다.
✅ 테스트 계획 (Test Plan)
hooks/useExpandableText.test.tshooks/useScrollFloatingVisibility.test.tshooks/useScrollOnNextQueryChange.test.ts검증 항목:
useExpandableTextscrollHeight > clientHeight + 1기준 overflow 판별toggleExpanded호출 시isExpanded토글ResizeObserver재계산 수행disconnect호출useScrollFloatingVisibilitydelta에 따른 노출 상태 검증triggerRef,targetRef,resize, cleanup 분기 검증useScrollOnNextQueryChangemarkWillChange없이 query 변경 시 스크롤 미발생 검증markWillChange이후 1회만scrollIntoView호출되는지 검증behavior와block: "start"옵션 전달 검증실행 명령어:
pnpm test -- hooks/useExpandableText.test.ts hooks/useScrollFloatingVisibility.test.ts hooks/useScrollOnNextQueryChange.test.ts🔗 관련 이슈 (Related Issues)
☑️ 체크리스트 (Checklist)
👀 리뷰어를 위한 참고 사항 (Notes for Reviewers)
➕ 추가 정보 (Additional Information)