This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
ScrollLock: Locking fix + resolve console warning #587
Merged
Conversation
This file contains 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
This update fixes the ScrollLock mechanism to work with the newer browser + React handling for `wheel` events. The event listener is now added directly to the DOM node via `addEventListener`, rather than tapping into the `onWheel` callback from React, which is now considered "passive", and no longer provides us with the correct `eventTarget`. `@helpscout/cyan` was added to help make it (much MUCH) easier to write `wheel` event based tests, since these are now fired outside of React.
ItsJonQ
commented
Apr 17, 2019
|
||
describe('Direction: Y', () => { | ||
test('Permits scrolling within extent', () => { | ||
const wrapper = shallow( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of these tests had to be refactored since Enzyme's mount
/shallow
rendering can't correctly simulate an event (wheel
) if bound via addEventListener
.
Deploy preview for hsds-react ready! Built with commit 7ddd13d |
Deploy preview for hsds-react ready! Built with commit 1565343 |
ItsJonQ
commented
Apr 17, 2019
@@ -183,7 +184,7 @@ | |||
"jest-cli": "^23.6.0", | |||
"jest-watch-typeahead": "^0.2.0", | |||
"mkdirp": "0.5.1", | |||
"node-sass": "^4.9.2", | |||
"node-sass": "4.11.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update from npm audit fix
ItsJonQ
commented
Apr 17, 2019
@@ -10,3 +11,5 @@ beforeEach(() => { | |||
afterEach(() => { | |||
window.requestAnimationFrame.mockRestore() | |||
}) | |||
|
|||
setupTests() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integrating with @helpscout/cyan
Pull Request Test Coverage Report for Build 2012
💛 - Coveralls |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
ScrollLock: Locking fix + resolve console warning
This update fixes the ScrollLock mechanism to work with the newer browser +
React handling for
wheel
events.The event listener is now added directly to the DOM node via
addEventListener
,rather than tapping into the
onWheel
callback from React, which is nowconsidered "passive", and no longer provides us with the correct
eventTarget
.@helpscout/cyan
was added to help make it (much MUCH) easier to writewheel
event based tests, since these are now fired outside of React.Fixes: #586