MCPcopy Create free account
hub / github.com/angular/components / dragElementViaMouse

Function dragElementViaMouse

src/cdk/drag-drop/directives/test-utils.spec.ts:58–71  ·  view source on GitHub ↗
(
  fixture: ComponentFixture<any>,
  element: Element,
  x: number,
  y: number,
)

Source from the content-addressed store, hash-verified

56 * @param y Position along the y axis to which to drag the element.
57 */
58export function dragElementViaMouse(
59 fixture: ComponentFixture<any>,
60 element: Element,
61 x: number,
62 y: number,
63) {
64 startDraggingViaMouse(fixture, element);
65
66 dispatchMouseEvent(document, 'mousemove', x, y);
67 fixture.detectChanges();
68
69 dispatchMouseEvent(document, 'mouseup', x, y);
70 fixture.detectChanges();
71}
72
73/**
74 * Dispatches the events for starting a drag sequence.

Callers 5

tryDragFunction · 0.90

Calls 2

startDraggingViaMouseFunction · 0.85
dispatchMouseEventFunction · 0.85

Tested by

no test coverage detected