use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class InvocationGridTest method testOnItemSelectedExpressionColumnDefinedExpressionType.
@Test
public void testOnItemSelectedExpressionColumnDefinedExpressionType() {
setupGrid(0);
// Set an editor for expression at (0, 2)
final BaseExpressionGrid editor = mock(BaseExpressionGrid.class);
grid.getModel().setCellValue(0, 2, new ExpressionCellValue(Optional.of(editor)));
final List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 2);
assertThat(items.size()).isEqualTo(6);
assertDefaultListItems(items.subList(0, 4), true);
assertThat(items.get(DIVIDER)).isInstanceOf(HasListSelectorControl.ListSelectorDividerItem.class);
assertListSelectorTextItem(items.get(CLEAR_EXPRESSION_TYPE), DMNEditorConstants.ExpressionEditor_Clear, true);
((HasListSelectorControl.ListSelectorTextItem) items.get(CLEAR_EXPRESSION_TYPE)).getCommand().execute();
verify(cellEditorControls).hide();
verify(sessionCommandManager).execute(eq(canvasHandler), any(ClearExpressionTypeCommand.class));
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class InvocationGridTest method testInitialSetupFromDefinition.
@Test
public void testInitialSetupFromDefinition() {
setupGrid(0);
final GridData uiModel = grid.getModel();
assertTrue(uiModel instanceof InvocationGridData);
assertEquals(3, uiModel.getColumnCount());
assertTrue(uiModel.getColumns().get(0) instanceof RowNumberColumn);
assertTrue(uiModel.getColumns().get(1) instanceof InvocationParameterColumn);
assertTrue(uiModel.getColumns().get(2) instanceof ExpressionEditorColumn);
assertEquals(1, uiModel.getRowCount());
assertEquals(1, uiModel.getCell(0, 0).getValue().getValue());
assertEquals(InvocationDefaultValueUtilities.PREFIX + "1", ((InformationItemCell.HasNameAndDataTypeCell) uiModel.getCell(0, 1).getValue().getValue()).getName().getValue());
assertTrue(uiModel.getCell(0, 2).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv0 = (ExpressionCellValue) uiModel.getCell(0, 2).getValue();
assertEquals(undefinedExpressionEditor, dcv0.getValue().get());
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class InvocationGridTest method testOnItemSelectedExpressionColumnDefinedExpressionTypeWithCellSelectionsCoveringMultipleRows.
@Test
public void testOnItemSelectedExpressionColumnDefinedExpressionTypeWithCellSelectionsCoveringMultipleRows() {
setupGrid(0);
addParameterBinding(0);
grid.getModel().selectCell(0, 0);
grid.getModel().selectCell(1, 0);
// Set an editor for expression at (0, 2)
final BaseExpressionGrid editor = mock(BaseExpressionGrid.class);
grid.getModel().setCellValue(0, 2, new ExpressionCellValue(Optional.of(editor)));
final List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 2);
assertThat(items.size()).isEqualTo(6);
assertDefaultListItems(items.subList(0, 4), false);
assertThat(items.get(DIVIDER)).isInstanceOf(HasListSelectorControl.ListSelectorDividerItem.class);
assertListSelectorTextItem(items.get(CLEAR_EXPRESSION_TYPE), DMNEditorConstants.ExpressionEditor_Clear, false);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class ListGridTest method testInitialSetupFromDefinition.
@Test
public void testInitialSetupFromDefinition() {
setupGrid();
final GridData uiModel = grid.getModel();
assertTrue(uiModel instanceof ListGridData);
assertEquals(2, uiModel.getColumnCount());
assertTrue(uiModel.getColumns().get(ROW_COLUMN_INDEX) instanceof ContextGridRowNumberColumn);
assertTrue(uiModel.getColumns().get(EXPRESSION_COLUMN_INDEX) instanceof ExpressionEditorColumn);
assertEquals(1, uiModel.getRowCount());
assertEquals(1, uiModel.getCell(0, ROW_COLUMN_INDEX).getValue().getValue());
assertTrue(uiModel.getCell(0, EXPRESSION_COLUMN_INDEX).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv0 = (ExpressionCellValue) uiModel.getCell(0, EXPRESSION_COLUMN_INDEX).getValue();
assertEquals(literalExpressionEditor, dcv0.getValue().get());
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class ListGridTest method testOnItemSelectedExpressionColumnUndefinedExpressionType.
@Test
public void testOnItemSelectedExpressionColumnUndefinedExpressionType() {
setupGrid();
// Clear expression at (0, EXPRESSION_COLUMN_INDEX)
grid.getModel().setCellValue(0, EXPRESSION_COLUMN_INDEX, new ExpressionCellValue(Optional.empty()));
assertDefaultListItems(grid.getItems(0, EXPRESSION_COLUMN_INDEX), true);
}
Aggregations