Created
January 18, 2017 04:25
-
-
Save hartzis/8d5d98ebc8e31acfccbe5988a90f7975 to your computer and use it in GitHub Desktop.
Touch Event React Jest Enzyme Helpers
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
function createClientXY(x, y) { | |
return { clientX: x, clientY: y }; | |
} | |
export function createStartTouchEventObject({ x = 0, y = 0 }) { | |
return { touches: [createClientXY(x, y)] }; | |
} | |
export function createMoveTouchEventObject({ x = 0, y = 0}) { | |
return { changedTouches: [createClientXY(x, y)] }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment