use of org.kie.workbench.common.stunner.forms.client.event.FormPropertiesOpened in project kie-wb-common by kiegroup.
the class FormPropertiesWidgetTest method testShowDomainObject.
@Test
@SuppressWarnings("unchecked")
public void testShowDomainObject() {
tested.init();
final String fieldName = "fieldName";
final String fieldValue = "fieldValue";
final Command callback = mock(Command.class);
when(formsCanvasSessionHandler.getDiagram()).thenReturn(diagram);
when(domainObject.getDomainObjectUUID()).thenReturn(DOMAIN_OBJECT_UUID);
when(domainObject.getDomainObjectNameTranslationKey()).thenReturn(DOMAIN_OBJECT_TRANSLATION_KEY);
when(formsCanvasSessionHandler.getSession()).thenReturn(session);
verify(formsCanvasSessionHandler).setRenderer(formRendererArgumentCaptor.capture());
final FormsCanvasSessionHandler.FormRenderer formRenderer = formRendererArgumentCaptor.getValue();
formRenderer.render(GRAPH_UUID, domainObject, callback);
verify(formsContainer).render(eq(GRAPH_UUID), eq(DOMAIN_OBJECT_UUID), eq(domainObject), Mockito.<Path>any(), fieldChangeHandlerArgumentCaptor.capture(), eq(RenderMode.EDIT_MODE));
final FieldChangeHandler fieldChangeHandler = fieldChangeHandlerArgumentCaptor.getValue();
fieldChangeHandler.onFieldChange(fieldName, fieldValue);
verify(formsCanvasSessionHandler).executeUpdateDomainObjectProperty(eq(domainObject), eq(fieldName), eq(fieldValue));
verify(propertiesOpenedEvent).fire(formPropertiesOpenedArgumentCaptor.capture());
final FormPropertiesOpened formPropertiesOpened = formPropertiesOpenedArgumentCaptor.getValue();
assertThat(formPropertiesOpened.getUuid()).isEqualTo(DOMAIN_OBJECT_UUID);
assertThat(formPropertiesOpened.getName()).isEqualTo(DOMAIN_OBJECT_TRANSLATION_KEY);
assertThat(formPropertiesOpened.getSession()).isEqualTo(session);
verify(callback).execute();
}
use of org.kie.workbench.common.stunner.forms.client.event.FormPropertiesOpened in project kie-wb-common by kiegroup.
the class FormsFlushManagerTest method testOnFormsOpenedEvent.
@Test
public void testOnFormsOpenedEvent() {
tested.onFormsOpenedEvent(new FormPropertiesOpened(clientSession, ELEMENT_UUID, ""));
assertEquals(ELEMENT_UUID, tested.formElementUUID);
}
use of org.kie.workbench.common.stunner.forms.client.event.FormPropertiesOpened in project kie-wb-common by kiegroup.
the class FormsFlushManagerTest method flush.
@Test
public void flush() {
tested.onFormsOpenedEvent(new FormPropertiesOpened(clientSession, ELEMENT_UUID, ""));
tested.container = null;
tested.flush(clientSession);
tested.container = formsContainer;
tested.flush(clientSession);
verify(formsContainer, times(1)).flush(GRAPH_UUID, ELEMENT_UUID);
}
Aggregations