use of org.uberfire.ext.layout.editor.client.api.ComponentRemovedEvent in project kie-wb-common by kiegroup.
the class FormEditorPresenterTest method testRemoveEventWhenMovingFieldOnLayout.
@Test
public void testRemoveEventWhenMovingFieldOnLayout() {
loadContent();
loadAvailableFields();
addAllFields();
FormEditorPresenter presenterSpy = spy(presenter);
FieldDefinition field = editorHelper.getFormDefinition().getFields().get(0);
ComponentRemovedEvent event = new ComponentRemovedEvent(createLayoutComponent(presenter.getFormDefinition(), field), true);
presenterSpy.onRemoveComponent(event);
assertNotNull(editorHelper.getFormDefinition().getFieldById(field.getId()));
verify(presenterSpy, never()).onSyncPalette(anyString());
verify(editorHelper, never()).removeField(anyString(), anyBoolean());
}
use of org.uberfire.ext.layout.editor.client.api.ComponentRemovedEvent in project kie-wb-common by kiegroup.
the class FormEditorPresenterTest method testOnRemoveComponent.
public void testOnRemoveComponent(boolean noContext) {
loadContent();
loadAvailableFields();
addAllFields();
VerificationMode count = times(1);
if (noContext) {
when(editorHelper.getContent()).thenReturn(null);
count = never();
}
FormEditorPresenter presenterSpy = spy(presenter);
String formId = presenterSpy.getFormDefinition().getId();
FieldDefinition field = editorHelper.getFormDefinition().getFields().get(0);
ComponentRemovedEvent event = new ComponentRemovedEvent(createLayoutComponent(presenter.getFormDefinition(), field), false);
presenterSpy.onRemoveComponent(event);
verify(presenterSpy, count).onSyncPalette(formId);
verify(editorHelper, count).removeField(anyString(), anyBoolean());
}
use of org.uberfire.ext.layout.editor.client.api.ComponentRemovedEvent in project kie-wb-common by kiegroup.
the class FormEditorPresenterTest method testOnRemoveComponentWithoutLayoutComponent.
@Test
public void testOnRemoveComponentWithoutLayoutComponent() {
loadContent();
loadAvailableFields();
addAllFields();
FormEditorPresenter presenterSpy = spy(presenter);
ComponentRemovedEvent event = new ComponentRemovedEvent(null);
presenterSpy.onRemoveComponent(event);
verify(presenterSpy, never()).onSyncPalette(anyString());
verify(editorHelper, never()).removeField(anyString(), anyBoolean());
}
Aggregations