aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-07-18 13:11:28 +0300
committerHenri Sara <henri.sara@gmail.com>2017-07-18 13:11:28 +0300
commit5143e779a6febd719389716ccaf7e69741710925 (patch)
treef0dd558042b2f63eff5ea8416f4b2d9fcc15cbbf /uitest
parent347896905321f9b42788039b3112669c7c9a4eba (diff)
downloadvaadin-framework-5143e779a6febd719389716ccaf7e69741710925.tar.gz
vaadin-framework-5143e779a6febd719389716ccaf7e69741710925.zip
Fix Grid header merging on init (#9688)
Fixes #9686
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java10
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java9
2 files changed, 16 insertions, 3 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java
index dce85d3be9..a48c8400c1 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java
@@ -25,7 +25,8 @@ public class GridComponents extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
Grid<String> grid = new Grid<>();
- grid.addColumn(string -> new Label(string), new ComponentRenderer());
+ grid.addColumn(string -> new Label(string), new ComponentRenderer())
+ .setCaption("Label");
grid.addComponentColumn(string -> {
if (textFields.containsKey(string)) {
log("Reusing old text field for: " + string);
@@ -41,7 +42,7 @@ public class GridComponents extends AbstractTestUIWithLog {
textFields.put(string, textField);
});
return textField;
- });
+ }).setId("textField").setCaption("TextField");
grid.addColumn(string -> {
Button button = new Button("Click Me!",
e -> Notification.show(
@@ -49,10 +50,13 @@ public class GridComponents extends AbstractTestUIWithLog {
Type.WARNING_MESSAGE));
button.setId(string.replace(' ', '_').toLowerCase());
return button;
- }, new ComponentRenderer());
+ }, new ComponentRenderer()).setId("button").setCaption("Button");
// make sure the buttons and focus outlines fit completely in a row
grid.setRowHeight(40);
+ grid.getDefaultHeaderRow().join("textField", "button")
+ .setText("Other Components");
+
addComponent(grid);
grid.setSizeFull();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java
index b74386e2d9..af985aad9a 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java
@@ -82,6 +82,15 @@ public class GridComponentsTest extends MultiBrowserTest {
assertRowExists(999, "Row 999");
}
+ @Test
+ public void testHeaders() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+ Assert.assertEquals("Label", grid.getHeaderCell(0, 0).getText());
+ Assert.assertEquals("Other Components",
+ grid.getHeaderCell(0, 1).getText());
+ }
+
private void assertRowExists(int i, String string) {
GridRowElement row = $(GridElement.class).first().getRow(i);
Assert.assertEquals("Label text did not match", string,