Repository navigation
chore: modernize bun dev stack - #120
Conversation
| }); | ||
|
|
||
| // expect(bottomRightMock).toHaveBeenCalled(); | ||
| expect(bottomRightMock).toHaveBeenCalled(); |
There was a problem hiding this comment.
🔴 Test assertion will fail: onKeyPress is removed in React 19 but Parallax component still uses it
The PR uncomments the assertion expect(bottomRightMock).toHaveBeenCalled() at line 76, but this assertion will fail. The Parallax component (src/experimentals/Parallax.tsx:56) uses onKeyPress for keyboard event handling, and React 19 (locked at react@19.2.6 in bun.lock) removed onKeyPress support entirely. The test fires fireEvent.keyPress, fireEvent.keyDown, and fireEvent.keyUp, but since the component only binds onKeyPress (not onKeyDown/onKeyUp), none of these events will trigger the mock callback. The assertion was previously commented out (likely because this was already known to be broken), and uncommenting it without migrating the component from onKeyPress to onKeyDown will cause the test suite to fail.
Prompt for agents
The test assertion at src/experimentals/Parallax.test.tsx:76 expects bottomRightMock to have been called, but the Parallax component (src/experimentals/Parallax.tsx) uses onKeyPress which was removed in React 19. The fix requires two coordinated changes:
1. In src/experimentals/Parallax.tsx, replace all onKeyPress handlers with onKeyDown. For example, change onKeyPress={bottomRight && onEnter(bottomRight)} to onKeyDown={bottomRight && onEnter(bottomRight)}. This applies to all four corner elements (lines 35, 42, 49, 56).
2. In src/experimentals/Parallax.test.tsx, the test can then rely on fireEvent.keyDown to trigger the mock. The fireEvent.keyPress call can be removed since it tests a deprecated API.
The same onKeyPress to onKeyDown migration should also be applied to src/components/Pagination.tsx (lines 44, 63, 75) and src/components/ControlledTab.tsx (line 43) which have the same issue.
Was this helpful? React with 👍 or 👎 to provide feedback.
✅ Deploy Preview for spectre-react ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary
bun.lockand updated package scriptsValidation
bun run ci