Chore: Mobile: Fixes #14834: Fix JSDOM scrollIntoView error in tests#14870
Open
jellyfrostt wants to merge 3 commits intolaurent22:devfrom
Open
Chore: Mobile: Fixes #14834: Fix JSDOM scrollIntoView error in tests#14870jellyfrostt wants to merge 3 commits intolaurent22:devfrom
jellyfrostt wants to merge 3 commits intolaurent22:devfrom
Conversation
Contributor
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Contributor
📝 WalkthroughWalkthroughThis change refactors scroll-related polyfill logic in the mobile app's extended WebView component. A new utility module is created containing reusable JavaScript snippet strings for polyfilling Changes
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author
|
I have read the CLA Document and I hereby sign the CLA |
personalizedrefrigerator
approved these changes
Mar 23, 2026
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.
AI Assistance Disclosure
This PR was developed with AI assistance (Claude). AI was used for:
All generated code was reviewed, understood, and validated with local test runs.
Problem
After
Note.test.tsxtests complete, a deferredsetTimeoutinafterFullPageRender.tscallselement.scrollIntoView(). JSDOM does not implementElement.prototype.scrollIntoView, so this throws aTypeErrorthat surfaces as a "Cannot log after tests are done" warning. The existing JSDOM mock (ExtendedWebView/index.jest.tsx) already polyfilledwindow.scrollBybut notscrollIntoView.Solution
Extracted the inline
scrollBypolyfill fromindex.jest.tsxinto a shared polyfill string (polyfillScrollFunctions.ts) and added a guarded no-op forElement.prototype.scrollIntoView. The polyfill runs inside the isolated JSDOM context viadom.window.eval(), so it does not affect Jest's global jsdom environment or other test files.This is a low-risk change as it only adds a no-op function to an isolated test mock. No production code is modified.
Test plan
yarn test Note.test- 21/21 passyarn test handleAnchorClick- 5/5 pass (file not modified, unaffected by change)NoteEditor.test.tsx, unrelated to the change in the PR)Additional things to note: we recognized one failing test (NoteEditor.test.tsx) in the full suite and identified that the failing test is a pre-existing flaky test that is unrelated to the changes in this PR. It fails intermittently due to timing issues in the editor component tests and was already failing prior to the changes made in this PR.