use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell in project kie-wb-common by kiegroup.
the class ExpressionContainerGridTest method testGetBaseExpressionGrid.
@Test
public void testGetBaseExpressionGrid() {
final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> expectedBaseExpressionGrid = Optional.of(mock(LiteralExpressionGrid.class));
final ExpressionCellValue value = mock(ExpressionCellValue.class);
final GridCell<?> cell = new BaseGridCell<>(value);
final Supplier<GridCell<?>> cellSupplier = () -> cell;
when(value.getValue()).thenReturn(expectedBaseExpressionGrid);
grid.getModel().setCell(0, 0, cellSupplier);
assertEquals(expectedBaseExpressionGrid, grid.getBaseExpressionGrid());
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowHigherThanDefaultWithNullCell.
@Test
@SuppressWarnings("unchecked")
public void testRowHigherThanDefaultWithNullCell() {
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)))).put(1, null).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isGreaterThan(DEFAULT_HEIGHT);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowHigherThanDefaultWithNullCellValue.
@Test
@SuppressWarnings("unchecked")
public void testRowHigherThanDefaultWithNullCellValue() {
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)))).put(1, new BaseGridCell<>(null)).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isGreaterThan(DEFAULT_HEIGHT);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell in project kie-wb-common by kiegroup.
the class NameColumnTest method checkEditLastRow.
@Test
@SuppressWarnings("unchecked")
public void checkEditLastRow() {
doReturn(0).when(context).getRowIndex();
model.appendRow(new BaseGridRow());
final GridCell<String> cell = new BaseGridCell<>(new BaseGridCellValue<>("value"));
column.edit(cell, context, result -> {
/*Nothing*/
});
verify(factory, never()).attachDomElement(any(GridBodyCellRenderContext.class), any(Callback.class), any(Callback.class));
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell 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);
}
Aggregations