Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/__tests__/Card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ describe('Card', () => {
})
})

describe('drag threshold', () => {
it('does not fire onDragStart immediately when pointer-down on card outer area', () => {
const { container, props } = renderCard()
const card = container.firstElementChild as HTMLElement

// Simulate pointerdown on the outer card div (padding area)
card.dispatchEvent(new PointerEvent('pointerdown', { button: 0, clientX: 50, clientY: 50, bubbles: true }))

// onDragStart should NOT be called immediately — it should wait for threshold movement
expect(props.onDragStart).not.toHaveBeenCalled()
})
})

describe('dragging styles', () => {
it('applies dragging styles when isDragging is true', () => {
const { container } = renderCard({ isDragging: true })
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default function Card({
onPointerDown={(e) => {
if (e.button !== 0 || editing) return
e.preventDefault()
fireDragStart(e.clientX, e.clientY)
startPendingDrag(e.clientX, e.clientY)
}}>
{editing ? (
<textarea
Expand Down