summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorAntti Tanhuanpää <antti@vaadin.com>2014-05-06 16:39:15 +0300
committerVaadin Code Review <review@vaadin.com>2014-05-09 09:13:56 +0000
commit1cf11f84320ef650b650eb8f852cee34e9e75c75 (patch)
tree1f5ad5f6ab722b70e400f83bc2a2cb6fcfd29700 /uitest
parent2ecdf7e517dffb17e90432b9d7bd7d42ad826c63 (diff)
downloadvaadin-framework-1cf11f84320ef650b650eb8f852cee34e9e75c75.tar.gz
vaadin-framework-1cf11f84320ef650b650eb8f852cee34e9e75c75.zip
Resize PopupView's overlay on content resize (#13666)
Change-Id: Iad410f26ed7f20bb03f15c46673f6f18081261d9
Diffstat (limited to 'uitest')
-rw-r--r--uitest/ivy.xml2
-rw-r--r--uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpen.java73
-rw-r--r--uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java70
3 files changed, 145 insertions, 0 deletions
diff --git a/uitest/ivy.xml b/uitest/ivy.xml
index f54ea7270e..020543c53f 100644
--- a/uitest/ivy.xml
+++ b/uitest/ivy.xml
@@ -83,6 +83,8 @@
<dependency org="junit" name="junit" rev="4.11"
conf="build,ide -> default" />
+ <dependency org="org.hamcrest" name="hamcrest-all" rev="1.3"
+ conf="build,ide->default" />
<dependency org="com.jcraft" name="jsch" rev="0.1.50"
conf="ide, build->default" />
<dependency org="commons-codec" name="commons-codec"
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpen.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpen.java
new file mode 100644
index 0000000000..379f03ee55
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpen.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.popupview;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.PopupView;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * Resizing PopupView's popup component while it is visible should also resize
+ * the drop shadow of the overlay.
+ *
+ * @author Vaadin Ltd
+ */
+public class PopupViewResizeWhileOpen extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ PopupView pv = new PopupView(new PopupView.Content() {
+ @Override
+ public Component getPopupComponent() {
+ final VerticalLayout popupComponent = new VerticalLayout();
+ popupComponent.setId("content-vl");
+ popupComponent.setWidth("640px");
+ popupComponent.setHeight("480px");
+
+ Button button = new Button("Change height!",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ popupComponent.setHeight("320px");
+ }
+ });
+
+ popupComponent.addComponent(button);
+ return popupComponent;
+ }
+
+ @Override
+ public String getMinimizedValueAsHTML() {
+ return "Click me!";
+ }
+ });
+ pv.setHideOnMouseOut(false);
+ addComponent(pv);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Resize PopupView's content component while visible";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13666;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java
new file mode 100644
index 0000000000..9c6c50e609
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.popupview;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.lessThan;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.PopupViewElement;
+import com.vaadin.testbench.elements.VerticalLayoutElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Resizing PopupView's popup component while it is visible should also resize
+ * the drop shadow of the overlay.
+ *
+ * @author Vaadin Ltd
+ */
+public class PopupViewResizeWhileOpenTest extends MultiBrowserTest {
+
+ @Test
+ public void testCustomPopupSizeAfterResize() {
+ openTestURL();
+
+ // Open PopupView
+ $(PopupViewElement.class).first().click();
+
+ // Shadow element
+ WebElement shadow = findElement(By.className("v-shadow"));
+ WebElement vl = $(VerticalLayoutElement.class).id("content-vl");
+
+ // Sanity check
+ assertShadowSize(vl, shadow);
+
+ // Resize
+ $(ButtonElement.class).first().click();
+ assertShadowSize(vl, shadow);
+ }
+
+ private void assertShadowSize(WebElement layout, WebElement shadow) {
+ Dimension shadowSize = shadow.getSize();
+ Dimension layoutSize = layout.getSize();
+
+ assertThat(shadowSize.height, is(greaterThan(layoutSize.height)));
+ assertThat(shadowSize.height, is(lessThan(layoutSize.height + 10)));
+ assertThat(shadowSize.width, is(greaterThan(layoutSize.width)));
+ assertThat(shadowSize.width, is(lessThan(layoutSize.width + 10)));
+ }
+
+}