Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web_app/src/hooks/useSwipeNav.test.ts from CommunityOne/open-navigator: direct link, hf CLI and curl.
- Browser
- Download file 648 Bytes
-
https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_app/src/hooks/useSwipeNav.test.ts
- Command line
-
hf download hf://spaces/CommunityOne/open-navigator/web_app/src/hooks/useSwipeNav.test.ts
-
curl -L -o useSwipeNav.test.ts https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_app/src/hooks/useSwipeNav.test.ts
648 Bytes
| import { describe, expect, it } from 'vitest' | |
| import { swipeDirection } from './useSwipeNav' | |
| describe('swipeDirection (#1222)', () => { | |
| it('swipe left = next, swipe right = previous', () => { | |
| expect(swipeDirection(-120, 10, 200)).toBe('next') | |
| expect(swipeDirection(120, -10, 200)).toBe('prev') | |
| }) | |
| it('never takes a vertical scroll or a diagonal for a swipe', () => { | |
| expect(swipeDirection(-20, 300, 200)).toBeNull() | |
| expect(swipeDirection(-90, 80, 200)).toBeNull() | |
| }) | |
| it('ignores short or slow drags', () => { | |
| expect(swipeDirection(-30, 0, 200)).toBeNull() | |
| expect(swipeDirection(-200, 0, 1500)).toBeNull() | |
| }) | |
| }) | |