summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java16
2 files changed, 18 insertions, 2 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 e1bf0f354a..92ba75869c 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
@@ -26,7 +26,9 @@ public class GridComponents extends AbstractTestUIWithLog {
protected void setup(VaadinRequest request) {
Grid<String> grid = new Grid<>();
grid.addColumn(string -> new Label(string), new ComponentRenderer())
- .setCaption("Label");
+ .setId("label").setCaption("Column 0");
+ grid.getDefaultHeaderRow().getCell("label")
+ .setComponent(new Label("Label"));
grid.addComponentColumn(string -> {
if (textFields.containsKey(string)) {
log("Reusing old text field for: " + string);
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 70966b373e..045d205f87 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
@@ -12,6 +12,7 @@ import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.testbench.elements.GridElement.GridRowElement;
+import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -108,11 +109,24 @@ public class GridComponentsTest extends MultiBrowserTest {
IntStream.range(300, 310).forEach(this::assertNoButton);
}
+ @Test(expected = AssertionError.class)
+ public void testRow31() {
+ openTestURL();
+ // There is a button on row 31. This should fail.
+ assertNoButton(31);
+ }
+
@Test
public void testHeaders() {
openTestURL();
GridElement grid = $(GridElement.class).first();
- Assert.assertEquals("Label", grid.getHeaderCell(0, 0).getText());
+ GridCellElement headerCell = grid.getHeaderCell(0, 0);
+ Assert.assertTrue("First header should contain a Label",
+ headerCell.isElementPresent(LabelElement.class));
+ Assert.assertEquals("Label",
+ headerCell.$(LabelElement.class).first().getText());
+ Assert.assertFalse("Second header should not contain a component",
+ grid.getHeaderCell(0, 1).isElementPresent(LabelElement.class));
Assert.assertEquals("Other Components",
grid.getHeaderCell(0, 1).getText());
}