MCPcopy
hub / github.com/Shopify/draggable / waitForDragDelay

Function waitForDragDelay

test/helpers/sensor.ts:8–21  ·  view source on GitHub ↗
({
  dragDelay = DRAG_DELAY,
  restoreDateMock = true,
} = {})

Source from the content-addressed store, hash-verified

6import {triggerEvent} from './event';
7
8export function waitForDragDelay({
9 dragDelay = DRAG_DELAY,
10 restoreDateMock = true,
11} = {}) {
12 const next = Date.now() + dragDelay + 1;
13 const dateMock = jest.spyOn(Date, 'now').mockImplementation(() => {
14 return next;
15 });
16 jest.advanceTimersByTime(dragDelay + 1);
17 if (restoreDateMock) {
18 dateMock.mockRestore();
19 }
20 return dateMock;
21}
22
23export function clickMouse(element: HTMLElement, options = {}) {
24 return triggerEvent(element, 'mousedown', {

Callers 15

dragFunction · 0.90
Droppable.test.jsFile · 0.90
moveFunction · 0.90
dragFlowFunction · 0.90
DragSensor.test.jsFile · 0.90
dragFlowFunction · 0.90
dragFlowFunction · 0.90
dragFlowWithRightClickFunction · 0.90
dragFlowWithCtrlKeyFunction · 0.90

Calls

no outgoing calls

Tested by 7

moveFunction · 0.72
dragFlowFunction · 0.72
dragFlowFunction · 0.72
dragFlowFunction · 0.72
dragFlowWithRightClickFunction · 0.72
dragFlowWithCtrlKeyFunction · 0.72
dragFlowWithMetaKeyFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…