Set visibility of glass when visibility of PopupPanel is changed.
http://gwt-code-reviews.appspot.com/143809
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7588 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/PopupPanel.java b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
index 4e86561..ed49e9f 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -925,6 +925,7 @@
impl.setVisible(getElement(), visible);
if (glass != null) {
impl.setVisible(glass, visible);
+ glass.getStyle().setProperty("visibility", visible ? "visible" : "hidden");
}
}
diff --git a/user/test/com/google/gwt/user/client/ui/PopupTest.java b/user/test/com/google/gwt/user/client/ui/PopupTest.java
index 8db63fb..cfe61e0 100644
--- a/user/test/com/google/gwt/user/client/ui/PopupTest.java
+++ b/user/test/com/google/gwt/user/client/ui/PopupTest.java
@@ -377,6 +377,26 @@
popup.hide();
}
+ public void testSetVisibleWithGlass() {
+ PopupPanel popup = createPopupPanel();
+ popup.setGlassEnabled(true);
+ popup.show();
+
+ Element glass = popup.getGlassElement();
+ assertTrue(popup.isVisible());
+ assertFalse("hidden".equalsIgnoreCase(glass.getStyle().getVisibility()));
+
+ popup.setVisible(false);
+ assertFalse(popup.isVisible());
+ assertTrue("hidden".equalsIgnoreCase(glass.getStyle().getVisibility()));
+
+ popup.setVisible(true);
+ assertTrue(popup.isVisible());
+ assertFalse("hidden".equalsIgnoreCase(glass.getStyle().getVisibility()));
+
+ popup.hide();
+ }
+
/**
* Test the showing a popup while it is hiding will not result in an illegal
* state.