use of org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasDomainObjectListener in project kie-wb-common by kiegroup.
the class DMNGridLayerControlImplTest method testDoDestroyWithBoundSession.
@Test
public void testDoDestroyWithBoundSession() {
control.bind(session);
control.doInit();
verify(canvasHandler).addRegistrationListener(canvasElementListenerCaptor.capture());
verify(canvasHandler).addDomainObjectListener(domainObjectListenerCaptor.capture());
final CanvasElementListener canvasElementListener = canvasElementListenerCaptor.getValue();
final CanvasDomainObjectListener domainObjectListener = domainObjectListenerCaptor.getValue();
control.doDestroy();
assertNull(control.getGridLayer());
verify(canvasHandler).removeRegistrationListener(eq(canvasElementListener));
verify(canvasHandler).removeDomainObjectListener(eq(domainObjectListener));
}
use of org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasDomainObjectListener in project kie-wb-common by kiegroup.
the class DMNGridLayerControlImplTest method testDoInitWithBoundSession.
@Test
public void testDoInitWithBoundSession() {
control.bind(session);
control.doInit();
assertEquals(gridLayer, control.getGridLayer());
verify(canvasHandler).addRegistrationListener(canvasElementListenerCaptor.capture());
final CanvasElementListener canvasElementListener = canvasElementListenerCaptor.getValue();
canvasElementListener.update(element);
verify(gridLayer).batch();
reset(gridLayer);
verify(canvasHandler).addDomainObjectListener(domainObjectListenerCaptor.capture());
final CanvasDomainObjectListener domainObjectListener = domainObjectListenerCaptor.getValue();
domainObjectListener.update(domainObject);
verify(gridLayer).batch();
}
use of org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasDomainObjectListener in project kie-wb-common by kiegroup.
the class ExpressionEditorControlImplTest method testBindDomainObjectListenerWithNoNodeMatch.
@Test
public void testBindDomainObjectListenerWithNoNodeMatch() {
when(graph.nodes()).thenReturn(Collections.emptyList());
control.bind(session);
verify(canvasHandler).addDomainObjectListener(domainObjectListenerCaptor.capture());
final CanvasDomainObjectListener domainObjectListener = domainObjectListenerCaptor.getValue();
domainObjectListener.update(domainObject);
verify(canvasElementUpdatedEvent, never()).fire(any(CanvasElementUpdatedEvent.class));
}
use of org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasDomainObjectListener in project kie-wb-common by kiegroup.
the class ExpressionEditorControlImplTest method testBindDomainObjectListenerWithNodeMatch.
@Test
public void testBindDomainObjectListenerWithNodeMatch() {
final Definition definition = mock(Definition.class);
when(graph.nodes()).thenReturn(Collections.singletonList(node));
when(node.getContent()).thenReturn(definition);
when(definition.getDefinition()).thenReturn(domainObject);
when(domainObject.getDomainObjectUUID()).thenReturn("uuid");
control.bind(session);
verify(canvasHandler).addDomainObjectListener(domainObjectListenerCaptor.capture());
final CanvasDomainObjectListener domainObjectListener = domainObjectListenerCaptor.getValue();
domainObjectListener.update(domainObject);
verify(canvasElementUpdatedEvent).fire(canvasElementUpdatedEventCaptor.capture());
final CanvasElementUpdatedEvent canvasElementUpdatedEvent = canvasElementUpdatedEventCaptor.getValue();
assertThat(canvasElementUpdatedEvent.getCanvasHandler()).isEqualTo(canvasHandler);
assertThat(canvasElementUpdatedEvent.getElement()).isEqualTo(node);
}
use of org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasDomainObjectListener in project kie-wb-common by kiegroup.
the class ExpressionEditorControlImplTest method testDoDestroy.
@Test
public void testDoDestroy() {
control.bind(session);
verify(canvasHandler).addDomainObjectListener(domainObjectListenerCaptor.capture());
control.doDestroy();
assertNull(control.getExpressionEditor());
final CanvasDomainObjectListener domainObjectListener = domainObjectListenerCaptor.getValue();
verify(canvasHandler).removeDomainObjectListener(domainObjectListener);
}
Aggregations