Created
July 20, 2019 20:24
-
-
Save DimitryDushkin/d328ed41da51b3cda727ecd554e37f27 to your computer and use it in GitHub Desktop.
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
import { marbles } from "rxjs-marbles/jest"; | |
import { createDragObservable } from "./use-draggable"; | |
const data = { | |
d: new PointerEvent('mousedown'), | |
m: new PointerEvent('mousedown'), | |
u: new PointerEvent('mousedown'), | |
} | |
describe("useDraggable", () => { | |
it( | |
"emits drag events only after mousedown and end after mouseup", | |
marbles(m => { | |
const down$ = m.hot("-d--------", data); | |
const move$ = m.hot("mmmmm-mmmm", data); | |
const up$ = m.hot("-------u--", data); | |
const expectedDrag$ = m.hot("-eeee-ee--", {e: {x: 0, y: 0}}); | |
const drag$ = createDragObservable(up$, down$, move$); | |
m.expect(drag$).toBeObservable(expectedDrag$); | |
}) | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment