use of org.uberfire.ext.editor.commons.client.file.popups.DeletePopUpPresenter in project kie-wb-common by kiegroup.
the class FormEditorPresenterAbstractTest method loadContent.
protected void loadContent() {
when(formDefinitionResourceType.getSuffix()).thenReturn("form.frm");
when(formDefinitionResourceType.accept(path)).thenReturn(true);
when(editorFieldLayoutComponents.get()).thenAnswer(invocationOnMock -> mock(EditorFieldLayoutComponent.class));
when(formEditorService.loadContent(any())).then(invocation -> serviceLoad());
editorServiceCallerMock = new CallerMock<>(formEditorService);
editorHelper = spy(new TestFormEditorHelper(fieldManager, editorFieldLayoutComponents));
when(layoutEditorMock.getLayout()).thenReturn(new LayoutTemplate());
when(menuBuilderMock.addSave(any(MenuItem.class))).thenReturn(menuBuilderMock);
when(menuBuilderMock.addCopy(any(ObservablePath.class), any(DefaultFileNameValidator.class))).thenReturn(menuBuilderMock);
when(menuBuilderMock.addRename(any(ObservablePath.class), any(DefaultFileNameValidator.class))).thenReturn(menuBuilderMock);
when(menuBuilderMock.addRename(any(Command.class))).thenReturn(menuBuilderMock);
when(menuBuilderMock.addDelete(any(ObservablePath.class))).thenReturn(menuBuilderMock);
when(menuBuilderMock.addNewTopLevelMenu(any(MenuItem.class))).thenReturn(menuBuilderMock);
when(menuBuilderMock.build()).thenReturn(mock(Menus.class));
when(versionRecordManager.getCurrentPath()).thenReturn(path);
when(translationService.format(anyString(), anyString())).thenReturn("");
showAssetUsagesDisplayer = spy(new ShowAssetUsagesDisplayer(assetUsagesDisplayerView, translationService, new CallerMock<>(assetsUsagService)));
when(assetUsagesDisplayerView.getDefaultMessageContainer()).thenReturn(mock(HTMLElement.class));
when(assetsUsagService.getAssetUsages(anyString(), any(), any())).thenReturn(assetUsages);
deletePopUpPresenter = spy(new DeletePopUpPresenter(deletePopUpView, toggleCommentPresenter));
presenter = new FormEditorPresenter(view, modelChangesDisplayer, formDefinitionResourceType, editorServiceCallerMock, translationService, editorFieldLayoutComponents, showAssetUsagesDisplayer) {
{
kieView = mock(KieEditorWrapperView.class);
versionRecordManager = FormEditorPresenterAbstractTest.this.versionRecordManager;
editorHelper = FormEditorPresenterAbstractTest.this.editorHelper;
busyIndicatorView = mock(BusyIndicatorView.class);
overviewWidget = mock(OverviewWidgetPresenter.class);
layoutEditor = layoutEditorMock;
layoutDragComponentPalette = layoutDragComponentPaletteMock;
layoutFocusEvent = layoutFocusEventMock;
htmlLayoutDragComponent = FormEditorPresenterAbstractTest.this.htmlLayoutDragComponent;
notification = notificationEvent;
fileMenuBuilder = menuBuilderMock;
workbenchContext = FormEditorPresenterAbstractTest.this.workbenchContext;
projectController = FormEditorPresenterAbstractTest.this.projectController;
deletePopUpPresenter = FormEditorPresenterAbstractTest.this.deletePopUpPresenter;
renamePopUpPresenter = FormEditorPresenterAbstractTest.this.renamePopUpPresenter;
alertsButtonMenuItemBuilder = FormEditorPresenterAbstractTest.this.alertsButtonMenuItemBuilder;
formEditorContext = mock(FormEditorContext.class);
}
@Override
public void doLoadContent(FormModelerContent content) {
super.doLoadContent(content);
employeeFields.addAll(editorHelper.getAvailableFields().values());
}
@Override
protected void addSourcePage() {
}
};
presenter.onStartup(path, mock(PlaceRequest.class));
assertTrue("There should exist base field draggables", editorHelper.getBaseFieldsDraggables().size() > 0);
}
Aggregations