-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve trackmouse to 'follow' mouse outside swipeable #67
Conversation
|
src/__tests__/Swipeable.spec.js
Outdated
)); | ||
|
||
// track eventListener adds to trigger leter |
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.
- fix comment spelling
src/Swipeable.js
Outdated
if (cancelPageSwipe && this.props.preventDefaultTouchmoveEvent) { | ||
e.preventDefault(); | ||
} | ||
if (cancelPageSwipe && preventDefaultTouchmoveEvent) e.preventDefault(); |
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.
- change
cancelPageSwipe
tocancelablePageSwipe
src/__tests__/Swipeable.spec.js
Outdated
// track eventListener adds to trigger leter | ||
// idea from - https://github.com/airbnb/enzyme/issues/426#issuecomment-228601631 | ||
const map = {}; | ||
document.addEventListener = jest.fn((event, cb) => { |
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.
- add to 'setup',
beforeEach
and clean upafterEach
src/__tests__/helpers/events.js
Outdated
@@ -20,5 +19,6 @@ export function createMoveTouchEventObject({ x = 0, y = 0, includeTouches = true | |||
export function createMouseEventObject({ x = 0, y = 0 }) { | |||
return { | |||
...createClientXYObject(x, y), | |||
preventDefault: jest.fn(), |
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.
- maybe make this an arg you can pass in so we can test if
preventDefault
andstopPropagation
were fired? - add test for
preventDefault
getting called
improve trackmouse to 'follow' mouse outside swipeable
<Swipeable />
component whentrackMouse
is true