Skip to main content

Home > @jsplumbtoolkit/test-support > jsPlumbToolkitTestHarness

jsPlumbToolkitTestHarness class#

Signature:

export declare class jsPlumbToolkitTestHarness 

Constructors#

ConstructorModifiersDescription
(constructor)(toolkit, surface)Constructs a new instance of the jsPlumbToolkitTestHarness class

Properties#

PropertyModifiersTypeDescription
_edgePathEditorany
consoleOutputstring
containerany
dragGroupTo(obj: any, x: number, y: number) => voidDrag the given Group to the given [x,y], which are canvas coordinates.
edgePathEditorany
eventManagerany
jsplumbBrowserJsPlumbInstance
surfaceSurface
toolkitBrowserUIBase
undoManagerany

Methods#

MethodModifiersDescription
addMiniview(miniviewOptions)Add a miniview to this test harness.
addNode(data)Add a Node to the Toolkit.
attachAnimator()Attaches a SurfaceAnimator to the surface, and returns it.
clear()Shortcut to the underlying clear method of the toolkit.
clickOnCanvas(clickCount, button)Clicks on the canvas.
clickOnEdge(edgeId)Clicks on the given edge
clickOnElementInsideNode(nodeId, selector)Clicks on an element inside the node with the given ID.
clickOnGroup(groupId)Clicks on the group with the given ID.
clickOnNode(nodeId)Clicks on the node with the given ID.
clickOnOverlay(edgeId, overlayId)Clicks on the overlay with the given ID, on the given Edge.
clickOnPort(nodeId, portId)Clicks on the port with the given ID on the node with given node id.
connect(source, target, data)Connect the given source and target via a call on the Toolkit, ie. without using the mouse.
dblClickOnEdge(edgeId)Double clicks on the given edge
dblClickOnElementInsideNode(nodeId, selector)Double clicks on an element inside the node with the given ID.
dblClickOnNode(nodeId)Double clicks on the node with the given ID.
dblTapOnEdge(edgeId)Double taps on the given edge
dblTapOnElementInsideNode(nodeId, selector)Taps on an element inside the node with the given ID.
dblTapOnNode(nodeId)Simulates a double tap event on the node 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.
dragAnElementAround(el)Randomly drag a DOM element around
dragANodeAround(obj)Randomly drag a node 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.
dragConnection(obj1, obj2, callbacks)Connect, using the mouse, obj1 to obj2. This will throw an Error if either or both of the arguments cannot be resolved. Any interceptors you have setup on the underlying Toolkit instance will be invoked - this functions just as if the user had used the mouse to drag a connection from one object to the other.
dragConnectionBetweenElements(el1, el2, callbacks)
dragConnectionBetweenEndpoints(ep1, ep2, callbacks)
dragConnectionBetweenVertexElements(source, target, callbacks)Drags a connection between two vertices, either by supplying the ID of the vertices, or the element representing the vertex and some query selector that identifies a part of the dom element. We use this in the Toolkit'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.
dragElementBy(el, x, y, eventHandlers)Drag the given DOM element by the given x/y amounts.
dragElementToCanvas(el, x, y)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.
dragNodeBy(obj, x, y, eventHandlers)Drag the given Node by the given x/y amounts.
dragNodeIntoGroup(node, group)Drag the given node into the given group.
dragNodeTo(obj, x, y)Drag the given Node to the given [x,y], which are canvas coordinates.
getAllEdges()Gets all edges in the underlying Toolkit.
getDOMPosition(v)Gets the position in the DOM of the element representing the given Node or Group
getEdge(obj)Gets an Edge.
getEdgeCount()Returns the count of Edges in the underlying Toolkit.
getEndpoints(vertexId)Returns the list of Endpoints associated with the given node/group.
getGroup(obj)Gets a Group from the underlying Toolkit.
getNode(obj)Gets a Node from the underlying Toolkit.
getRenderedConnection(obj)For the given argument, find and return the underlying Connection used to render it.
getRenderedElement(obj)For the given argument, find and return the corresponding DOM element.
getRenderedPort(obj)Gets the Endpoint that was rendered for some port.
getToolkitObject(obj)Find the corresponding Toolkit object for the given input.
isAtPosition(v, x, y)Returns whether or not the DOM element representing the given vertex is at the given point p.
load(options)Shortcut to the underlying load method of the toolkit.
makeEvent(obj, dx, dy)Synthesize an event for the given object.
makeEventAt(x, y)Make an event at the given page location.
querySelectorAll(selector)Run a CSS3 query selector on the current container.
render(renderParams, containerParams)
rightClickOnCanvas(clickCount)Right-clicks on the canvas.
rightClickOnNode(nodeId)Right-clicks on the node with the given ID.
startEditing(edge)Start editing the given Edge. You need to have imported jsplumbtoolkit/connector-editors for this to work.
stopEditing()Stop editing an Edge. You need to have imported jsplumbtoolkit/connector-editors for this to work.
tapOnEdge(edgeId)Taps on the given edge
tapOnElementInsideNode(nodeId, selector)Taps on an element inside the node with the given ID.
tapOnNode(nodeId)Simulates a tap event on the node 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.
trigger(obj, eventName, evt)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.
triggerOnElement(el, eventName)Trigger an event on the given DOM element.
updateEdge(edge, data)Updates an Edge.
updateGroup(obj, data)Update a Group in the Toolkit.
updateNode(obj, data)Update a Node in to the Toolkit.
withConsole(fn)