Search
Testability

User interaction can be tested automatically in several ways outlined below.

  • Create a MouseInputDispatcher instance and call its methods
    JavaScript  Copy Code

    onMouseDown: function (position, button)
    onMouseMove: function (position)
    onMouseUp: function (position, button)

    where position is a Point instance specifying logical coordinates in the diagram (in current measure unit, not scaled by zoom factor). The results of called mouse methods will depend on diagram's current behavior, e.g. you could assert that a sequence of down, move andup events creates a ShapeNode when behavior is set to DrawShapes.
  • Create an instance of controller class and call its start, move and commit methods. This would not depend on the value of diagram's behavior, but could be still affected by other behavioral properties such as allowSelfLoops and allowUnconnectedLinks.
  • Check assertions after replaying a recording on a saved diagram, using record, stopRecording and replay methods.