summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasia Smirnova <anasmi@utu.fi>2018-04-09 10:56:46 +0300
committerTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-04-09 10:56:46 +0300
commitfb712d074ce91f743d74623021566c1e999d5b62 (patch)
tree7672bc8bdc17c2e6de027c505a46f906617908c4
parent8d0afd8690239688514db52e16d37ef77fd5ed1a (diff)
downloadvaadin-framework-fb712d074ce91f743d74623021566c1e999d5b62.tar.gz
vaadin-framework-fb712d074ce91f743d74623021566c1e999d5b62.zip
Ensure that popup is closed in Tabsheet (#10738)
-rw-r--r--client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/PopupView.java14
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheet.java34
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java29
4 files changed, 78 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java
index b87afda5fc..eecc6ac57b 100644
--- a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java
@@ -135,7 +135,7 @@ public class PopupViewConnector extends AbstractHasComponentsConnector
} else {
// The popup shouldn't be visible, try to hide it.
- popup.hide();
+ popup.hide(false,false,false);
}
}
diff --git a/server/src/main/java/com/vaadin/ui/PopupView.java b/server/src/main/java/com/vaadin/ui/PopupView.java
index 6b497386f3..dabcab7803 100644
--- a/server/src/main/java/com/vaadin/ui/PopupView.java
+++ b/server/src/main/java/com/vaadin/ui/PopupView.java
@@ -413,4 +413,18 @@ public class PopupView extends AbstractComponent implements HasComponents {
*/
public void popupVisibilityChange(PopupVisibilityEvent event);
}
+
+ @Override
+ public void detach() {
+ setPopupVisible(false);
+ super.detach();
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ if (!visible) {
+ setPopupVisible(false);
+ }
+ super.setVisible(visible);
+ }
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheet.java b/uitest/src/main/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheet.java
new file mode 100644
index 0000000000..ab1ce3bc28
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheet.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.components.popupview;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.*;
+
+public class PopUpViewInTabsheet extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ CssLayout layout = new CssLayout();
+ addComponent(layout);
+
+ VerticalLayout popupContent = new VerticalLayout();
+ popupContent.setId("content");
+ PopupView popup = new PopupView("Pop it up", popupContent);
+ popupContent.addComponent(new Button("Button"));
+
+ popup.setHideOnMouseOut(false);
+ popup.setId("popupId");
+ popup.setHeight("40px");
+
+ TabSheet tabsheet = new TabSheet();
+
+ VerticalLayout tab1 = new VerticalLayout();
+ tab1.addComponent(popup);
+ tabsheet.addTab(tab1, "Mercury").setId("tab0");
+ VerticalLayout tab2 = new VerticalLayout();
+ tab2.addComponent(new TextField("Enter"));
+ tab2.setCaption("Venus");
+ tabsheet.addTab(tab2).setId("tab1");
+ layout.addComponent(tabsheet);
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java
new file mode 100644
index 0000000000..eefd6b2f6c
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java
@@ -0,0 +1,29 @@
+package com.vaadin.tests.components.popupview;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class PopUpViewInTabsheetTest extends MultiBrowserTest {
+
+ @Before
+ public void testPopupView() {
+ openTestURL();
+ }
+
+ @Test
+ public void testPopUpNotVisisble() {
+ WebElement view = findElement(By.className("v-popupview"));
+ view.click();
+ assertTrue(
+ findElement(By.className("v-popupview-popup")).isDisplayed());
+ findElement(By.id("tab1")).click();
+ findElement(By.id("tab0")).click();
+ assertTrue(findElements(By.className("v-popupview-popup")).isEmpty());
+ }
+}