You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test-utils.ts 458B

123456789101112131415161718192021222324252627282930
  1. interface PointerOptions {
  2. id?: string
  3. x?: number
  4. y?: number
  5. shiftKey?: boolean
  6. altKey?: boolean
  7. metaKey?: boolean
  8. }
  9. export function point(
  10. options: PointerOptions = {} as PointerOptions
  11. ): PointerEvent {
  12. const {
  13. id = '1',
  14. x = 0,
  15. y = 0,
  16. shiftKey = false,
  17. altKey = false,
  18. metaKey = false,
  19. } = options
  20. return {
  21. shiftKey,
  22. altKey,
  23. metaKey,
  24. pointerId: id,
  25. clientX: x,
  26. clientY: y,
  27. } as any
  28. }