@@ -2054,6 +2054,7 @@ public class Escalator extends Widget | |||
defaultRowHeightShouldBeAutodetected = false; | |||
defaultRowHeight = px; | |||
reapplyDefaultRowHeights(); | |||
applyHeightByRows(); | |||
} | |||
@Override |
@@ -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); | |||
} | |||
} |
@@ -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()); | |||
} | |||
} |
@@ -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); | |||