use of org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent in project kie-wb-common by kiegroup.
the class CreateConnectorActionTest method testStartDrag.
@SuppressWarnings("unchecked")
private DragProxyCallback testStartDrag() {
final MouseClickEvent event = mock(MouseClickEvent.class);
when(event.getX()).thenReturn(100d);
when(event.getY()).thenReturn(500d);
when(graphBoundsIndexer.getAt(eq(100d), eq(500d))).thenReturn(targetNode);
ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, NODE_UUID, event);
assertEquals(tested, cascade);
verify(edge, times(1)).setSourceNode(eq(element));
verify(connectorDragProxyFactory, times(1)).proxyFor(eq(canvasHandler));
ArgumentCaptor<DragProxyCallback> proxyArgumentCaptor = ArgumentCaptor.forClass(DragProxyCallback.class);
verify(connectorDragProxyFactory, times(1)).show(any(ConnectorDragProxy.Item.class), eq(100), eq(500), proxyArgumentCaptor.capture());
final DragProxyCallback callback = proxyArgumentCaptor.getValue();
// Verify drag proxy start.
callback.onStart(0, 0);
assertNotNull(tested.getCanvasHighlight());
verify(graphBoundsIndexer, times(1)).setRootUUID(eq(ROOT_UUID));
verify(graphBoundsIndexer, times(1)).build(eq(graph));
verify(edgeBuilderControl, times(1)).enable(eq(canvasHandler));
ArgumentCaptor<RequiresCommandManager.CommandManagerProvider> providerArgumentCaptor = ArgumentCaptor.forClass(RequiresCommandManager.CommandManagerProvider.class);
verify(edgeBuilderControl, times(1)).setCommandManagerProvider(providerArgumentCaptor.capture());
RequiresCommandManager.CommandManagerProvider cmProvider = providerArgumentCaptor.getValue();
assertEquals(sessionCommandManager, cmProvider.getCommandManager());
return callback;
}
use of org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent in project kie-wb-common by kiegroup.
the class DeleteNodeActionTest method testSkipAction.
@Test
@SuppressWarnings("unchecked")
public void testSkipAction() {
this.tested = new DeleteNodeAction(translationService, sessionCommandManager, commandFactory, action -> false);
final MouseClickEvent event = mock(MouseClickEvent.class);
ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, event);
assertEquals(tested, cascade);
verify(sessionCommandManager, never()).execute(eq(canvasHandler), any(CanvasCommand.class));
}
use of org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent in project kie-wb-common by kiegroup.
the class DeleteNodeActionTest method testAction.
@Test
public void testAction() {
final MouseClickEvent event = mock(MouseClickEvent.class);
ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, event);
assertEquals(tested, cascade);
verify(commandFactory, times(1)).deleteNode(eq(element));
verify(sessionCommandManager, times(1)).execute(eq(canvasHandler), eq(deleteNodeCommand));
}
use of org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxActionTest method testAction.
@Test
public void testAction() {
final MouseClickEvent event = mock(MouseClickEvent.class);
final ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, event);
assertEquals(tested, cascade);
final ArgumentCaptor<EditExpressionEvent> eventCaptor = ArgumentCaptor.forClass(EditExpressionEvent.class);
verify(editExpressionEvent, times(1)).fire(eventCaptor.capture());
final EditExpressionEvent editExprEvent = eventCaptor.getValue();
assertEquals(E_UUID, editExprEvent.getNodeUUID());
assertEquals(decision, editExprEvent.getHasExpression());
assertEquals(decision, editExprEvent.getHasName().get());
assertEquals(session, editExprEvent.getSession());
assertFalse(editExprEvent.isOnlyVisualChangeAllowed());
}
use of org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent in project kie-wb-common by kiegroup.
the class DMNDeleteNodeToolboxActionTest method testOnMouseClickWhenNodeDoesNotRequiresDeletionConfirmation.
@Test
public void testOnMouseClickWhenNodeDoesNotRequiresDeletionConfirmation() {
final String nodeUuid = "node uuid";
final Element element = mock(Element.class);
final Node node = mock(Node.class);
final MouseClickEvent event = new MouseClickEvent(0, 0, 0, 0);
when(element.asNode()).thenReturn(node);
when(graphIndex.get(nodeUuid)).thenReturn(element);
when(deleteNodeConfirmation.requiresDeletionConfirmation(Collections.singleton(node))).thenReturn(false);
toolboxAction.onMouseClick(canvasHandler, nodeUuid, event);
verify(deleteNodeConfirmation, never()).confirmDeletion(any(), any(), any());
verify(toolboxAction).superOnMouseClick(canvasHandler, nodeUuid, event);
}
Aggregations