diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-12-29 13:11:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-29 13:11:20 +0200 |
commit | 46da9629b108fa7977061ac72b9a7a1d1fe80c3d (patch) | |
tree | c3f38380d9b3cf2fd272ec3a76d1ba47bcacc607 /uitest | |
parent | 0663acc47174bf86c02cdb7291e1c0d7b98551ed (diff) | |
download | vaadin-framework-46da9629b108fa7977061ac72b9a7a1d1fe80c3d.tar.gz vaadin-framework-46da9629b108fa7977061ac72b9a7a1d1fe80c3d.zip |
Implement widget event handling for Columns in Grid (#10412)
Fixes #7833
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java | 4 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java | 14 |
2 files changed, 16 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 22e880573c..df71987955 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,8 +26,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()) - .setId("label").setCaption("Column 0"); + grid.addComponentColumn(Label::new).setId("label") + .setCaption("Column 0").setWidgetEventsAllowed(true); grid.getDefaultHeaderRow().getCell("label") .setComponent(new Label("Label")); grid.addComponentColumn(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 4a303ddfb5..b9cc1fef35 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 @@ -9,6 +9,7 @@ import java.util.stream.IntStream; import java.util.stream.Stream; import org.junit.Test; +import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; @@ -139,6 +140,19 @@ public class GridComponentsTest extends MultiBrowserTest { assertEquals("Other Components", grid.getHeaderCell(0, 1).getText()); } + @Test + public void testSelectRowByClickingLabel() { + openTestURL(); + + GridElement grid = $(GridElement.class).first(); + assertFalse("Row should not be initially selected", + grid.getRow(0).isSelected()); + + grid.getCell(0, 0).$(LabelElement.class).first().click(10, 10, + new Keys[0]); + assertTrue("Row should be selected", grid.getRow(0).isSelected()); + } + private void assertRowExists(int i, String string) { GridRowElement row = $(GridElement.class).first().getRow(i); assertEquals("Label text did not match", string, |