use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshActionsWidgetWhenActionColumnsIsEmpty.
@Test
public void testRefreshActionsWidgetWhenActionColumnsIsEmpty() {
final List<ActionCol52> actionColumns = new ArrayList<>();
final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
final Label blankSlate = mock(Label.class);
doReturn(verticalPanel).when(presenter).getActionsWidget();
doReturn(columnManagementView).when(presenter).getActionsPanel();
doReturn(blankSlate).when(presenter).blankSlate();
doReturn(item).when(accordion).getItem(ACTION);
presenter.refreshActionsWidget(actionColumns);
verify(item).setOpen(false);
verify(verticalPanel).add(blankSlate);
verify(verticalPanel, never()).add(columnManagementView);
verify(columnManagementView, never()).renderColumns(any());
}
use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshConditionsWidgetWhenConditionColumnsIsNotEmpty.
@Test
public void testRefreshConditionsWidgetWhenConditionColumnsIsNotEmpty() {
final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
final Label blankSlate = mock(Label.class);
final List<CompositeColumn<? extends BaseColumn>> conditions1 = new ArrayList<CompositeColumn<? extends BaseColumn>>() {
{
add(compositeColumn1);
}
};
final Map<String, List<BaseColumn>> conditions2 = new HashMap<String, List<BaseColumn>>() {
{
put("title", new ArrayList<>());
}
};
doReturn(verticalPanel).when(presenter).getConditionsWidget();
doReturn(columnManagementView).when(presenter).getConditionsPanel();
doReturn(blankSlate).when(presenter).blankSlate();
doReturn(item).when(accordion).getItem(CONDITION);
doReturn(conditions2).when(presenter).groupByTitle(conditions1);
presenter.refreshConditionsWidget(conditions1);
verify(item, never()).setOpen(false);
verify(verticalPanel, never()).add(blankSlate);
verify(verticalPanel).add(columnManagementView);
verify(columnManagementView).renderColumns(conditions2);
}
use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshConditionsWidgetWhenConditionColumnsIsEmpty.
@Test
public void testRefreshConditionsWidgetWhenConditionColumnsIsEmpty() {
final List<CompositeColumn<? extends BaseColumn>> conditions = new ArrayList<>();
final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
final Label blankSlate = mock(Label.class);
doReturn(verticalPanel).when(presenter).getConditionsWidget();
doReturn(columnManagementView).when(presenter).getConditionsPanel();
doReturn(blankSlate).when(presenter).blankSlate();
doReturn(item).when(accordion).getItem(CONDITION);
presenter.refreshConditionsWidget(conditions);
verify(item).setOpen(false);
verify(verticalPanel).add(blankSlate);
verify(verticalPanel, never()).add(columnManagementView);
verify(columnManagementView, never()).renderColumns(any());
}
use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshActionsWidgetWhenActionColumnsIsNotEmpty.
@Test
public void testRefreshActionsWidgetWhenActionColumnsIsNotEmpty() {
final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
final Label blankSlate = mock(Label.class);
final ActionCol52 actionCol52 = mock(ActionCol52.class);
final List<ActionCol52> actionColumns1 = new ArrayList<ActionCol52>() {
{
add(actionCol52);
}
};
final Map<String, List<BaseColumn>> actionColumns2 = new HashMap<String, List<BaseColumn>>() {
{
put("title", new ArrayList<>());
}
};
doReturn(verticalPanel).when(presenter).getActionsWidget();
doReturn(columnManagementView).when(presenter).getActionsPanel();
doReturn(blankSlate).when(presenter).blankSlate();
doReturn(item).when(accordion).getItem(ACTION);
doReturn(actionColumns2).when(presenter).groupByTitle(actionColumns1);
presenter.refreshActionsWidget(actionColumns1);
verify(item, never()).setOpen(false);
verify(verticalPanel, never()).add(blankSlate);
verify(verticalPanel).add(columnManagementView);
verify(columnManagementView).renderColumns(actionColumns2);
}
Aggregations