diff options
author | Adam Wagner <wbadam@users.noreply.github.com> | 2017-09-25 14:07:12 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-09-25 14:07:12 +0300 |
commit | 49fcca9fe06af69e5928b2076397a84049cd3838 (patch) | |
tree | 326feb2ed4bb475f160b3b18020d97781946ca30 /uitest | |
parent | f5d8dd7bf4a58af048f0ee13061b1bde5a95facb (diff) | |
download | vaadin-framework-49fcca9fe06af69e5928b2076397a84049cd3838.tar.gz vaadin-framework-49fcca9fe06af69e5928b2076397a84049cd3838.zip |
Fix TreeGrid double click event in hierarchy column (#10070)
Fixes #9868
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClick.java | 32 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClickTest.java | 36 |
2 files changed, 68 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClick.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClick.java new file mode 100644 index 0000000000..d3f7f815f9 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClick.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.components.treegrid; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.data.bean.HierarchicalTestBean; +import com.vaadin.ui.Notification; +import com.vaadin.ui.TreeGrid; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class TreeGridDoubleClick extends AbstractTestUI { + @Override + protected void setup(VaadinRequest request) { + TreeGrid<HierarchicalTestBean> grid = new TreeGrid<>(); + grid.addColumn(HierarchicalTestBean::toString).setCaption("String") + .setId("string"); + grid.addColumn(HierarchicalTestBean::getDepth).setCaption("Depth") + .setId("depth"); + grid.addColumn(HierarchicalTestBean::getIndex) + .setCaption("Index on this depth").setId("index"); + grid.setHierarchyColumn("string"); + grid.setDataProvider(new LazyHierarchicalDataProvider(3, 3)); + + grid.addItemClickListener(event -> { + if (event.getMouseEventDetails().isDoubleClick()) { + Notification.show("Double click"); + } + }); + + addComponent(grid); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClickTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClickTest.java new file mode 100644 index 0000000000..ba472f0dd3 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClickTest.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.components.treegrid; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.ElementQuery; +import com.vaadin.testbench.elements.NotificationElement; +import com.vaadin.testbench.elements.TreeGridElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +import static org.junit.Assert.assertTrue; + +public class TreeGridDoubleClickTest extends SingleBrowserTest { + + @Test + public void double_click_on_hierarchy_renderer() { + openTestURL(); + + TreeGridElement grid = $(TreeGridElement.class).first(); + WebElement hierarchyCell = grid + .findElement(By.className("v-treegrid-node")); + new Actions(getDriver()).doubleClick(hierarchyCell).perform(); + + assertTrue("Double click is not handled", + isDoubleClickNotificationPresent()); + } + + private boolean isDoubleClickNotificationPresent() { + ElementQuery<NotificationElement> notification = $( + NotificationElement.class); + return notification.exists() && "Double click" + .equals(notification.first().getCaption()); + } +} |