Skip to content

Commit

Permalink
chore: debug
Browse files Browse the repository at this point in the history
  • Loading branch information
miracles1919 committed Jun 20, 2023
1 parent 1212307 commit 8dd5afe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/components/image-viewer/slides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const Slides = forwardRef<SlidesRef, SlidesType>((props, ref) => {
const velocityOffset =
Math.min(state.velocity[0] * 2000, slideWidth) * state.direction[0]
console.log('offsetX', offsetX, velocityOffset, slideWidth)
console.log('velocityOffset', state.velocity[0], state.direction[0])
swipeTo(
bound(
Math.round((offsetX + velocityOffset) / slideWidth),
Expand Down
28 changes: 17 additions & 11 deletions src/components/swiper/tests/swiper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,23 @@ describe('Swiper', () => {
expect(container).toMatchSnapshot()

const el = $$(`.${classPrefix}-track`)[0]
mockDrag(el, [
{ clientX: 300, clientY: 0 },
{
clientX: 200,
clientY: 25,
},
{
clientX: 100,
clientY: 30,
},
])
await act(async () => {
await mockDrag(
el,
[
{ clientX: 300, clientY: 0 },
{
clientX: 200,
clientY: 25,
},
{
clientX: 100,
clientY: 30,
},
],
5
)
})

expect(container).toMatchSnapshot()
})
Expand Down

0 comments on commit 8dd5afe

Please sign in to comment.