use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn 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.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class FunctionGridTest method testInitialSetupFromDefinition.
@Test
public void testInitialSetupFromDefinition() {
setupGrid(0);
final GridData uiModel = grid.getModel();
assertTrue(uiModel instanceof DMNGridData);
assertEquals(1, uiModel.getColumnCount());
assertTrue(uiModel.getColumns().get(0) instanceof ExpressionEditorColumn);
assertEquals(1, uiModel.getRowCount());
assertTrue(uiModel.getCell(0, 0).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv = (ExpressionCellValue) uiModel.getCell(0, 0).getValue();
assertEquals(literalExpressionEditor, dcv.getValue().get());
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class BaseFunctionSupplementaryGridTest method testInitialSetupFromDefinition.
@Test
public void testInitialSetupFromDefinition() {
setupGrid(0);
final GridData uiModel = grid.getModel();
assertTrue(uiModel instanceof FunctionSupplementaryGridData);
assertEquals(3, uiModel.getColumnCount());
assertTrue(uiModel.getColumns().get(0) instanceof RowNumberColumn);
assertTrue(uiModel.getColumns().get(1) instanceof NameColumn);
assertTrue(uiModel.getColumns().get(2) instanceof ExpressionEditorColumn);
assertEquals(2, uiModel.getRowCount());
final String[] expectedNames = getExpectedNames();
for (int i = 0; i < uiModel.getRowCount(); i++) {
assertEquals(i + 1, uiModel.getCell(i, 0).getValue().getValue());
assertEquals(expectedNames[i], uiModel.getCell(i, 1).getValue().getValue());
assertTrue(uiModel.getCell(i, 2).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv = (ExpressionCellValue) uiModel.getCell(i, 2).getValue();
assertEquals(literalExpressionEditor, dcv.getValue().get());
}
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class CommandUtilsTest method testUpdateParentInformation_WithMultipleColumns.
@Test
public void testUpdateParentInformation_WithMultipleColumns() {
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));
}), Pair.newPair(new RowNumberColumn(), (rowIndex) -> new BaseGridCellValue<>(rowIndex + 1)));
assertParentInformationValues(0);
uiModel.moveColumnTo(0, uiModel.getColumns().get(1));
CommandUtils.updateParentInformation(uiModel);
assertParentInformationValues(1);
}
Aggregations