diff options
author | Artur Signell <artur@vaadin.com> | 2015-09-10 11:01:28 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-09-10 11:11:22 +0000 |
commit | 154396df74ba16dd8f50ba479a3e9819da54c072 (patch) | |
tree | ddb2c24fa62da0b874704dfeda9b5c9e34c19361 | |
parent | ae20007e0793825dcf793ee7e7212d6bcfbf25b8 (diff) | |
download | vaadin-framework-154396df74ba16dd8f50ba479a3e9819da54c072.tar.gz vaadin-framework-154396df74ba16dd8f50ba479a3e9819da54c072.zip |
Add body style name when reconnecting (#18838)
Change-Id: I7ff28587780fbd1c68b065b3edc670a879e8551e
3 files changed, 27 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java b/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java index ce65203a69..f32bd5c5ea 100644 --- a/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java +++ b/client/src/com/vaadin/client/communication/DefaultConnectionStateHandler.java @@ -365,6 +365,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { * Called when the reconnect dialog should be hidden. */ protected void hideDialog() { + reconnectDialog.setReconnecting(false); reconnectDialog.hide(); } diff --git a/client/src/com/vaadin/client/communication/DefaultReconnectDialog.java b/client/src/com/vaadin/client/communication/DefaultReconnectDialog.java index 340f32b25e..05b4e109ff 100644 --- a/client/src/com/vaadin/client/communication/DefaultReconnectDialog.java +++ b/client/src/com/vaadin/client/communication/DefaultReconnectDialog.java @@ -18,6 +18,8 @@ package com.vaadin.client.communication; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.core.shared.GWT; +import com.google.gwt.dom.client.BodyElement; +import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Style.Visibility; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -38,6 +40,7 @@ import com.vaadin.client.ui.VOverlay; public class DefaultReconnectDialog extends VOverlay implements ReconnectDialog { private static final String STYLE_RECONNECTING = "active"; + private static final String STYLE_BODY_RECONNECTING = "v-reconnecting"; public Label label; @@ -68,6 +71,12 @@ public class DefaultReconnectDialog extends VOverlay implements ReconnectDialog @Override public void setReconnecting(boolean reconnecting) { setStyleName(STYLE_RECONNECTING, reconnecting); + BodyElement body = Document.get().getBody(); + if (reconnecting) { + body.addClassName(STYLE_BODY_RECONNECTING); + } else { + body.removeClassName(STYLE_BODY_RECONNECTING); + } // Click to refresh after giving up if (!reconnecting) { diff --git a/uitest/src/com/vaadin/tests/application/ReconnectDialogUITest.java b/uitest/src/com/vaadin/tests/application/ReconnectDialogUITest.java index 19d88350b7..b07124c216 100644 --- a/uitest/src/com/vaadin/tests/application/ReconnectDialogUITest.java +++ b/uitest/src/com/vaadin/tests/application/ReconnectDialogUITest.java @@ -31,6 +31,23 @@ import com.vaadin.tests.tb3.MultiBrowserTestWithProxy; public class ReconnectDialogUITest extends MultiBrowserTestWithProxy { @Test + public void reconnectTogglesBodyStyle() throws JSchException { + openTestURL(); + getButton().click(); + disconnectProxy(); + getButton().click(); + waitForReconnectDialogPresent(); + WebElement body = findElement(By.xpath("//body")); + Assert.assertTrue("Body should have a style name when reconnecting", + hasCssClass(body, "v-reconnecting")); + connectProxy(); + waitForReconnectDialogToDisappear(); + Assert.assertFalse( + "Body should no longer have a style name when reconnected", + hasCssClass(body, "v-reconnecting")); + } + + @Test public void reconnectDialogShownAndDisappears() throws JSchException { openTestURL(); getButton().click(); |