Conversation
Copilot created this pull request from a session on behalf of
paul1k
June 29, 2026 12:32
View session
|
@copilot plz increase package version |
Author
Done — bumped version from |
Author
Done — version is now |
|
@copilot plz check test and fix |
- createSlider.jsx: add onTouchStart, onTouchMove, addDocumentTouchEvents; extend removeDocumentEvents to clean up touch listeners; wire onTouchStart to the slider div - Range.jsx, Slider.jsx: forward onFocus/onBlur props to the handle generator so they reach the Handle DOM element - Handle.jsx: explicitly extract onFocus/onBlur from props; apply onFocus directly on the div and merge onBlur with the internal handleBlur so both the internal state update and the prop callback run - tests/common/createSlider.test.js: wrap direct onTouchMove call in act() + wrapper.update() (same pattern as onMouseMove) so React 18 batched state updates are flushed before assertions
Author
Fixed all 6 failing tests in the latest commit. Here's what was done: Touch-event tests (4 fixes) —
Range focus/blur tests (2 fixes)
Test fix —
All 5 suites now pass: 36 passed, 15 skipped, 0 failed. |
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.
Upgrades the custom
@logicsoftware/sliderfork to support React 18 while preserving all custom logic. Targets deprecated lifecycle methods, removed APIs, and test infrastructure incompatibilities. Released as version9.0.0(major version bump reflecting the breaking upgrade).Dependency updates (
package.json)version: bumped to9.0.0peerDependencies: now accepts React^16 || ^17 || ^18devDependencies: React/ReactDOM/react-test-renderer →^18, Jest^20→^27.5.1,enzyme-adapter-react-16→@cfaester/enzyme-adapter-react-18@^0.8.0, addedjest-environment-jsdom(Jest 27 changed default testEnvironment tonode)Lifecycle migration (
src/Slider.jsx,src/Range.jsx)Replaced
componentWillReceivePropswith the React 18-safe pattern:Range.jsxfollows the same pattern withprevState.bounds.findDOMNoderemoval (src/utils.js)Replaced
findDOMNode(handles[key])withhandles[key] && handles[key].handle—Handlealready stores its root DOM node asthis.handlevia a ref callback.Examples (
examples/*.js)All 6 files migrated from
ReactDOM.rendertocreateRoot().render().Test infrastructure
tests/setup.js: New adapter,TextEncoderpolyfill, and a critical patch for Enzyme 3.x + React 18:Enzyme.ReactWrapper.prototype.setStateis wrapped withReactDOM.flushSyncbecause Enzyme 3 callsinstance.setState()directly withoutact(), causing React 18's concurrent scheduler to defer updates past test assertions.tests/common/createSlider.test.js: Directwrapper.instance().onMouseMove()calls wrapped inact()— outside React's event system, React 18 batches these state updates.tests/Range.test.js:jest.genMockFn()→jest.fn()(removed in Jest 27);map.mousemove()/map.mouseup()direct listener calls wrapped inact().Pre-existing failures (not introduced here, not fixed)
createSlider.jsxhas noonTouchStart/onTouchUpListenerimplementationRange › focus & blur—onFocus/onBlurprops are never forwarded into the Handle's{...restProps}, so programmatic.focus()does not trigger the callback