use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class LiteralExpressionGridTest method testGetItemsWithParentThatDoesNotSupportCellControls.
@Test
public void testGetItemsWithParentThatDoesNotSupportCellControls() {
setupGrid(0);
final GridData parentGridData = mock(GridData.class);
final BaseExpressionGrid parentGridWidget = mock(BaseExpressionGrid.class);
when(parent.getGridWidget()).thenReturn(parentGridWidget);
when(gridLayer.getGridWidgets()).thenReturn(Collections.singleton(parentGridWidget));
when(parentGridWidget.getModel()).thenReturn(parentGridData);
final List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 0);
assertThat(items).isEmpty();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class CommandUtilsTest method testUpdateParentInformation_WithExpressionColumn.
@Test
public void testUpdateParentInformation_WithExpressionColumn() {
setupUiModel(Pair.newPair(new ExpressionEditorColumn(gridLayer, new BaseHeaderMetaData("column"), gridWidget), (rowIndex) -> {
final BaseExpressionGrid grid = mock(BaseExpressionGrid.class);
final GridCellTuple gct = new GridCellTuple(rowIndex, 0, mock(GridWidget.class));
when(grid.getParentInformation()).thenReturn(gct);
return new ExpressionCellValue(Optional.of(grid));
}));
assertParentInformationValues(0);
uiModel.moveRowTo(0, uiModel.getRow(ROW_COUNT - 1));
CommandUtils.updateParentInformation(uiModel);
assertParentInformationValues(0);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class CommandUtilsTest method assertParentInformationValues.
private void assertParentInformationValues(final int expressionColumnIndex) {
IntStream.range(0, ROW_COUNT).forEach(rowIndex -> {
final ExpressionCellValue ecv = ((ExpressionCellValue) uiModel.getCell(rowIndex, expressionColumnIndex).getValue());
final BaseExpressionGrid grid = ecv.getValue().get();
assertEquals(rowIndex, grid.getParentInformation().getRowIndex());
assertEquals(expressionColumnIndex, grid.getParentInformation().getColumnIndex());
});
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class UndefinedExpressionGridTest method testGetItemsWithParentWithoutCellControls.
@Test
public void testGetItemsWithParentWithoutCellControls() {
setupGrid(0);
final GridData parentGridData = mock(GridData.class);
final BaseExpressionGrid parentGridWidget = mock(BaseExpressionGrid.class);
when(parent.getGridWidget()).thenReturn(parentGridWidget);
when(gridLayer.getGridWidgets()).thenReturn(Collections.singleton(parentGridWidget));
when(parentGridWidget.getModel()).thenReturn(parentGridData);
final List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 0);
assertThat(items).isEmpty();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class UndefinedExpressionGridTest method testGetItemsWithParentThatDoesNotSupportCellControls.
@Test
public void testGetItemsWithParentThatDoesNotSupportCellControls() {
setupGrid(0);
final GridData parentGridData = mock(GridData.class);
final BaseExpressionGrid parentGridWidget = mock(BaseExpressionGrid.class);
when(parent.getGridWidget()).thenReturn(parentGridWidget);
when(gridLayer.getGridWidgets()).thenReturn(Collections.singleton(parentGridWidget));
when(parentGridWidget.getModel()).thenReturn(parentGridData);
final List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 0);
assertThat(items).isEmpty();
}
Aggregations