use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class ExpressionContainerUIModelMapperTest method assertEditorType.
private void assertEditorType(final Class<?> clazz) {
final GridCell<?> gridCell = uiModel.getCell(0, 0);
assertThat(gridCell).isNotNull();
assertThat(gridCell).isInstanceOf(ContextGridCell.class);
final GridCellValue<?> gridCellValue = gridCell.getValue();
assertThat(gridCellValue).isNotNull();
assertThat(gridCellValue).isInstanceOf(ExpressionCellValue.class);
final ExpressionCellValue ecv = (ExpressionCellValue) gridCellValue;
final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ecv.getValue();
assertThat(editor.isPresent()).isTrue();
assertThat(editor.get()).isInstanceOf(clazz);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectExpressionEditorFirstCell.
@Test
public void testSelectExpressionEditorFirstCell() {
grid.getModel().appendRow(new BaseGridRow());
appendColumns(GridColumn.class);
final ExpressionCellValue cellValue = mock(ExpressionCellValue.class);
final BaseExpressionGrid cellGrid = mock(BaseExpressionGrid.class);
when(cellValue.getValue()).thenReturn(Optional.of(cellGrid));
grid.getModel().setCellValue(0, 0, cellValue);
grid.selectExpressionEditorFirstCell(0, 0);
verify(gridLayer).select(cellGrid);
verify(cellGrid).selectFirstCell();
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class DMNGridPanelContextMenuHandlerTest method onContextMenu_WithGridWidget_WithCellValueOfWrongType.
@Test
public void onContextMenu_WithGridWidget_WithCellValueOfWrongType() {
when(nativeEvent.getClientX()).thenReturn((int) (COLUMN0_WIDTH / 2));
when(nativeEvent.getClientY()).thenReturn((int) (ROW_HEIGHT + ROW_HEIGHT / 2));
final BaseGrid gridWidget = mockGridWidget();
when(gridLayer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));
gridWidget.getModel().setCellValue(1, 0, new ExpressionCellValue(Optional.empty()));
handler.onContextMenu(event);
verify(cellEditorControls, never()).show(any(HasCellEditorControls.Editor.class), anyInt(), anyInt());
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowHigherThanDefault.
@Test
@SuppressWarnings("unchecked")
public void testRowHigherThanDefault() {
when(view.getHeight()).thenReturn(DEFAULT_HEIGHT + 1);
final GridRow row = spy(ExpressionEditorGridRow.class);
final Map<Integer, GridCell<?>> cells = new Maps.Builder<Integer, GridCell<?>>().put(0, new BaseGridCell<>(new ExpressionCellValue(Optional.of(view)))).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isGreaterThan(DEFAULT_HEIGHT);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowLowerThanDefault.
@Test
@SuppressWarnings("unchecked")
public void testRowLowerThanDefault() {
when(view.getHeight()).thenReturn(DEFAULT_HEIGHT - 1);
final GridRow row = spy(ExpressionEditorGridRow.class);
final Map<Integer, GridCell<?>> cells = new Maps.Builder<Integer, GridCell<?>>().put(0, new BaseGridCell<>(new ExpressionCellValue(Optional.of(view)))).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isBetween(0D, DEFAULT_HEIGHT);
}
Aggregations