diff options
3 files changed, 22 insertions, 8 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java index 9d5187a227..661289ffb1 100644 --- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java @@ -289,6 +289,12 @@ public class GridConnector extends AbstractListingConnector column.getWidthActual()); }); + // Handling row height changes + getWidget().addRowHeightChangedHandler(event -> { + getLayoutManager().setNeedsMeasureRecursively(GridConnector.this); + getLayoutManager().layoutNow(); + }); + /* Item click events */ getWidget().addBodyClickHandler(itemClickHandler); getWidget().addBodyDoubleClickHandler(itemClickHandler); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java index 34fc2048be..1b3a7a0ab2 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.IntStream; +import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.tests.components.AbstractReindeerTestUI; @@ -12,6 +13,7 @@ import com.vaadin.ui.NativeSelect; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; +@Widgetset("com.vaadin.DefaultWidgetSet") public class GridRowHeightChange extends AbstractReindeerTestUI { private final List<String> themes = Arrays.asList("valo", "reindeer", diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridRowHeightChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridRowHeightChangeTest.java index 18ecba5696..dbc9278229 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridRowHeightChangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridRowHeightChangeTest.java @@ -25,19 +25,25 @@ public class GridRowHeightChangeTest extends MultiBrowserTest { @Test public void changeThemeAndMeasureGridHeight() { + // Initial check + verifyGridSize(); + for (String theme : themes) { // select theme $(NativeSelectElement.class).first().selectByText(theme); - GridElement grid = $(GridElement.class).first(); + verifyGridSize(); + } + } - int gridHeight = grid.getSize().getHeight(); - int tabsheetHeight = findElements( - By.className("v-tabsheet-content")).get(0).getSize() - .getHeight(); + private void verifyGridSize() { + GridElement grid = $(GridElement.class).first(); - assertEquals("Grid's visible height should be equal to Grid height", - gridHeight, tabsheetHeight, 1); - } + int gridHeight = grid.getSize().getHeight(); + int tabsheetHeight = findElements(By.className("v-tabsheet-content")) + .get(0).getSize().getHeight(); + + assertEquals("Grid's visible height should be equal to Grid height", + gridHeight, tabsheetHeight, 1); } } |