-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: added applyMagnet & reorganized tests files; added config check…
…ing helpers to tests
- Loading branch information
Showing
10 changed files
with
874 additions
and
426 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { DragDataEvent } from "../../../src"; | ||
|
||
export type TestEventType = "MouseEvent" | "TouchEvent"; | ||
|
||
export function getEventX(event: DragDataEvent, eventType: TestEventType) { | ||
return eventType === "MouseEvent" | ||
? (event as MouseEvent).clientX | ||
: (event as TouchEvent).touches[0].clientX; | ||
} | ||
|
||
export function getEventY(event: DragDataEvent, eventType: TestEventType) { | ||
return eventType === "MouseEvent" | ||
? (event as MouseEvent).clientY | ||
: (event as TouchEvent).touches[0].clientY; | ||
} | ||
|
||
export function setEventX( | ||
event: DragDataEvent, | ||
eventType: TestEventType, | ||
x: number, | ||
) { | ||
if (eventType === "MouseEvent") { | ||
((event as MouseEvent).clientX as number) = x; | ||
} else { | ||
((event as TouchEvent).touches[0].clientX as number) = x; | ||
} | ||
} | ||
|
||
export function setEventY( | ||
event: DragDataEvent, | ||
eventType: TestEventType, | ||
y: number, | ||
) { | ||
if (eventType === "MouseEvent") { | ||
((event as MouseEvent).clientY as number) = y; | ||
} else { | ||
((event as TouchEvent).touches[0].clientY as number) = y; | ||
} | ||
} |
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 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
Oops, something went wrong.