summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/main/java/com/vaadin/client/widgets/Escalator.java1
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java46
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightByRowTest.java37
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java14
4 files changed, 91 insertions, 7 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java
index fc7dc534f3..819e7f8d32 100644
--- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java
@@ -2054,6 +2054,7 @@ public class Escalator extends Widget
defaultRowHeightShouldBeAutodetected = false;
defaultRowHeight = px;
reapplyDefaultRowHeights();
+ applyHeightByRows();
}
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java
new file mode 100644
index 0000000000..5254f9091f
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java
@@ -0,0 +1,46 @@
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.data.provider.DataProvider;
+import com.vaadin.data.provider.ListDataProvider;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.grid.HeightMode;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Grid;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GridHeightByRow extends AbstractTestUIWithLog {
+ @Override
+ protected void setup(VaadinRequest request) {
+ List<String> data = new ArrayList<>();
+ for (int i = 0; i < 10; i++)
+ data.add("Data " + i);
+
+ Grid<String> grid = new Grid<>();
+ grid.addColumn(String::toString).setCaption("Test");
+ ListDataProvider<String> provider = DataProvider.ofCollection(data);
+ grid.setDataProvider(provider);
+
+ grid.setHeightMode(HeightMode.UNDEFINED);
+ grid.setRowHeight(50);
+
+ Button addButton = new Button("Add Data");
+ addButton.addClickListener(event -> {
+ data.add("Data");
+ grid.getDataProvider().refreshAll();
+ });
+
+ Button removeButton = new Button("Remove Data");
+ removeButton.addClickListener(event -> {
+ if (data.isEmpty())
+ return;
+
+ data.remove(0);
+ grid.getDataProvider().refreshAll();
+ });
+
+ addComponents(addButton, removeButton, grid);
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightByRowTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightByRowTest.java
new file mode 100644
index 0000000000..e6da5314cc
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightByRowTest.java
@@ -0,0 +1,37 @@
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+@TestCategory("grid")
+public class GridHeightByRowTest extends MultiBrowserTest {
+ @Test
+ public void testHeightByRow() {
+ openTestURL();
+
+ GridElement grid = $(GridElement.class).first();
+ ButtonElement addButton = $(ButtonElement.class).caption("Add Data")
+ .first();
+ ButtonElement removeButton = $(ButtonElement.class)
+ .caption("Remove Data").first();
+
+ // 10 rows and the header, each has height of 50
+ Assert.assertEquals(550, grid.getSize().getHeight());
+
+ addButton.click();
+
+ Assert.assertEquals(600, grid.getSize().getHeight());
+
+ addButton.click();
+
+ Assert.assertEquals(650, grid.getSize().getHeight());
+
+ removeButton.click();
+
+ Assert.assertEquals(600, grid.getSize().getHeight());
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java
index 3415663ca5..bead1fb71d 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java
@@ -1,17 +1,16 @@
package com.vaadin.tests.components.menubar;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Assume;
-import org.junit.Test;
-import org.openqa.selenium.WebElement;
-
import com.vaadin.server.FontAwesome;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.testbench.parallel.BrowserUtil;
import com.vaadin.tests.tb3.SingleBrowserTest;
+import org.junit.Assume;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class MenuBarIconsTest extends SingleBrowserTest {
@@ -70,6 +69,7 @@ public class MenuBarIconsTest extends SingleBrowserTest {
assertImage(image, moreItem);
moreItem.click();
+ waitForElementPresent(By.className("v-menubar-submenu"));
WebElement filler5 = moreItem.findElement(By.vaadin("#Filler 5"));
assertImage(image, filler5);