Shortcut to the underlying clear
method of the toolkit.
Connect the given source and target via a call on the Toolkit, ie. without using the mouse. If you want
to simulate mouse activity being used to establish an edge, use dragConnection
.
Node/Port/Group id, node/port/group, or DOM element.
Node/Port/Group id, node/port/group, or DOM element.
Optional
data: ObjectDataOptional data for the edge.
an Edge.
Simulates a double tap event on the node/group with the given id - a tap event is a mousedown followed by a mouseup whose page coordinates are identical to the mousedown event's page coordinates.
ID of the node/group to double tap on.
Randomly drag a node/group around. Can be useful to ensure the model is being updated, or you're getting callbacks you expect, etc. We use this internally when we just want a node to move and we don't care where it moves to.
Either a Node/Group, or the ID of a Node/Group, or the DOM element representing some Node/Group
Optional
callbacks: ConnectionDragEventHandlersOptional set of event handlers to invoke during the drag.
void
Drags a connection between two vertices. You can pass in a variety of arguments to this method for both source and target: an Endpoint, a DOM element, a node/group/port ID, or a combination of vertex id + css selector. We use this last variant in JsPlumb's own test suite to ensure that connections can be dragged from specific parts of some element, or that a connection source on an element does not cause the element to be dragged, etc.
Either a DOM element, an Endpoint, the ID of some node/group, or a node/group ID and an associated CSS3 selector identifying a part of the vertex's element that should be the source of the drag.
Either a DOM element, an Endpoint, the ID of some node/group, or a node/group ID and an associated CSS3 selector identifying a part of the vertex's element that should be the target of the drag.
Optional
callbacks: ConnectionDragEventHandlersOptional callbacks to invoke during the connection drag
Optional
locationOnTarget: PointXYOptional spec for exactly where on the target element to drop the connection. Values in this object are expressed as ratios of the width/height of the element. We use this in JsPlumb when we're testing scenarios in which a given vertex has multiple anchor locations assigned to it.
a Connection. You can access the underlying edge via the .edge
property of the connection.
Drag the given DOM element by the given x/y amounts.
DOM element to drag.
Amount to move in X axis
Amount to move in Y axis
Optional
eventHandlers: DragEventHandlersOptional callbacks to invoke at various points in the drag lifecycle.
Optional
metaKeys: Record<string, boolean>Optional map of meta keys to set on the events used to model the drag.
Drag a DOM element over a number of stages, advancing a little each time.
DOM element to drag.
Amount to move in X axis
Amount to move in Y axis
Optional
stages: numberHow many stages to break the drag up into.
Optional
eventHandlers: DragEventHandlersOptional callbacks to invoke at various points in the drag lifecycle. If you provide an afterMove
callback,
it will be invoked after each step of the drag.
Optional
metaKeys: Record<string, boolean>Optional map of meta keys to set on the events used to model the drag.
Drag the given element onto the canvas, optionally at a specific x,y. Use this when you want to test drag/drop from some palette.
Element to drop onto the canvas.
Optional, defaults to 250.
Optional, defaults to 250.
Drag the given Node/Group by the given x/y amounts.
Node/Group id, node, group or DOM element.
Amount to move in X axis
Amount to move in Y axis
Optional
eventHandlers: DragEventHandlersOptional callbacks to invoke at various points in the drag lifecycle.
Optional
metaKeys: Record<string, boolean>Optional map of meta keys to set on the events used to model the drag.
Drag a Node/Group over a number of stages, advancing a little each time.
Node/Group id, node, group or DOM element.
Amount to move in X axis
Amount to move in Y axis
Optional
stages: numberHow many stages to break the drag up into.
Optional
eventHandlers: DragEventHandlersOptional callbacks to invoke at various points in the drag lifecycle. If you provide an afterMove
callback,
it will be invoked after each step of the drag.
Optional
metaKeys: Record<string, boolean>Optional map of meta keys to set on the events used to model the drag.
Drag the given Node/Group to the given [x,y], which are canvas coordinates.
Node id, node, or DOM element.
Location on canvas in X axis to position top left corner of the node.
Location on canvas in Y axis to position top left corner of the node.
Gets a Group from the underlying Toolkit.
Group Id or DOM element representing the Group
Gets a Node from the underlying Toolkit.
Node Id or DOM element representing the node.
Find the corresponding Toolkit object for the given input.
A string representing an ID, a DOM element, a connection, or an existing Toolkit object.
an object containing the given model object, plus its id, and type etc.
Shortcut to the underlying load
method of the toolkit.
Synthesize an event for the given object. This method is used by other parts of the test harness class and is not something a user of the API will necessarily need to make use of.
Node/Port/Group id, node/port/group, or DOM element.
Optional offset from the center of the x axis of the related DOM element to position the event.
Optional offset from the center of the y axis of the related DOM element to position the event.
a SynthesizedEvent
Make an event at the given page location.
Start editing the given Edge. Your surface must be configured for editable edge paths for this method to have any effect.
Edge to edit
Optional
params: anyOptional editor params. The type of this object depends on the type of the edge that is to be edited.
Trigger the event with the given name on the given object. By default the event will occur in the middle of the DOM element representing the object.
Node/Port/Group id, node/port/group, or DOM element.
eg 'click', 'mouseover'
Optional, an event you previously created via #makeEvent. Sometimes you want to control the specific location of the event.
Trigger the provided event on the given DOM element.
Element to trigger the event on
Name of the event to trigger
Optional
data: Record<string, any>Optional data to set on the created event. Any values in this object are copied
into the created event via Object.assign
.
Provides a set of methods you can use in your unit/component tests to simulate a user interacting with a UI rendered by JsPlumb.