Skip to content

Instantly share code, notes, and snippets.

@hartzis
Created January 18, 2017 04:25
Show Gist options
  • Save hartzis/8d5d98ebc8e31acfccbe5988a90f7975 to your computer and use it in GitHub Desktop.
Save hartzis/8d5d98ebc8e31acfccbe5988a90f7975 to your computer and use it in GitHub Desktop.
Touch Event React Jest Enzyme Helpers
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