diff options
author | Artur <artur@vaadin.com> | 2017-01-10 15:22:31 +0200 |
---|---|---|
committer | Aleksi Hietanen <aleksi@vaadin.com> | 2017-01-10 15:22:31 +0200 |
commit | 6431d2e97ab8b4b7c2807d03aa16f6e70188c739 (patch) | |
tree | f0620a1480834379a3c03341a3174ff51d51a47c /uitest | |
parent | ef729f355b559edf38b3ba7c0a78c17c61602703 (diff) | |
download | vaadin-framework-6431d2e97ab8b4b7c2807d03aa16f6e70188c739.tar.gz vaadin-framework-6431d2e97ab8b4b7c2807d03aa16f6e70188c739.zip |
Fix exception when Grid is inside a PopupView (#8157)
Fixes #7695
Diffstat (limited to 'uitest')
2 files changed, 70 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridInPopupView.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridInPopupView.java new file mode 100644 index 0000000000..ad76fb2ee5 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridInPopupView.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.event.SelectionEvent; +import com.vaadin.event.SelectionEvent.SelectionListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.tests.util.Person; +import com.vaadin.tests.util.PersonContainer; +import com.vaadin.ui.Component; +import com.vaadin.ui.Grid; +import com.vaadin.ui.PopupView; +import com.vaadin.ui.PopupView.Content; +import com.vaadin.ui.VerticalLayout; + +public class GridInPopupView extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + final Grid grid = new Grid(PersonContainer.createWithTestData(100)); + grid.addSelectionListener(new SelectionListener() { + @Override + public void select(SelectionEvent event) { + String sel = ""; + for (Object o : event.getSelected()) { + sel += ((Person) o).getFirstName(); + } + log("Selection: " + sel); + } + }); + PopupView pv = new PopupView(new Content() { + @Override + public Component getPopupComponent() { + return new VerticalLayout(grid); + } + + @Override + public String getMinimizedValueAsHTML() { + return "foo"; + } + }); + pv.setHideOnMouseOut(false); + addComponent(pv); + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridInPopupViewTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridInPopupViewTest.java new file mode 100644 index 0000000000..6a04119c44 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridInPopupViewTest.java @@ -0,0 +1,25 @@ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.GridElement; +import com.vaadin.testbench.elements.PopupViewElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class GridInPopupViewTest extends SingleBrowserTest { + + @Test + public void popupViewClosedProperly() { + openTestURL(); + PopupViewElement pv = $(PopupViewElement.class).first(); + pv.click(); + GridElement grid = $(GridElement.class).first(); + grid.getCell(5, 0).click(); + findElement(By.className("v-ui")).click(); + + Assert.assertTrue($(GridElement.class).all().isEmpty()); + Assert.assertEquals("1. Selection: Alice", getLogRow(0)); + } +} |