use of org.kie.workbench.common.dmn.client.widgets.grid.BaseGrid in project kie-wb-common by kiegroup.
the class DMNGridPanelContextMenuHandlerTest method onContextMenu_WithGridWidget_WithCellSelectionStrategy_CellAlreadySelected.
@Test
public void onContextMenu_WithGridWidget_WithCellSelectionStrategy_CellAlreadySelected() {
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.selectCell(1, 0, false, false);
final MockCell cell = mock(MockCell.class);
final CellSelectionStrategy selectionStrategy = mock(CellSelectionStrategy.class);
gridWidget.getModel().setCell(1, 0, () -> cell);
when(cell.getEditor()).thenReturn(Optional.of(editor));
when(cell.getSelectionStrategy()).thenReturn(selectionStrategy);
handler.onContextMenu(event);
verify(selectionStrategy, never()).handleSelection(any(GridData.class), anyInt(), anyInt(), anyBoolean(), anyBoolean());
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseGrid 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());
}
Aggregations