aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2014-04-05 15:48:22 +0300
committerVaadin Code Review <review@vaadin.com>2014-04-16 12:45:20 +0000
commit9bdf3f128803a0c7312cc95e2292861806f75aa9 (patch)
tree51fcd2d8440238b10fa668574321d7bf57424cbd
parent4709b75bb47d28630dacbb240bb43de16d972371 (diff)
downloadvaadin-framework-9bdf3f128803a0c7312cc95e2292861806f75aa9.tar.gz
vaadin-framework-9bdf3f128803a0c7312cc95e2292861806f75aa9.zip
Use getChildComponents in PopupView instead of getChildren (#13503)
Change-Id: Ifd155376804e2403c55a115186df2b2c1c673334
-rw-r--r--client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtension.java55
-rw-r--r--uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java47
3 files changed, 104 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java b/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java
index 2f53280c99..1902b263d0 100644
--- a/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java
+++ b/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java
@@ -97,11 +97,9 @@ public class PopupViewConnector extends AbstractHasComponentsConnector
public void onConnectorHierarchyChange(
ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) {
// Render the popup if visible and show it.
- if (!getChildren().isEmpty()) {
+ if (!getChildComponents().isEmpty()) {
getWidget().preparePopup(getWidget().popup);
- getWidget().popup
- .setPopupConnector((ComponentConnector) getChildren()
- .get(0));
+ getWidget().popup.setPopupConnector(getChildComponents().get(0));
if (ComponentStateUtil.hasStyles(getState())) {
final StringBuffer styleBuf = new StringBuffer();
final String primaryName = getWidget().popup
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtension.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtension.java
new file mode 100644
index 0000000000..04bbf6df0a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtension.java
@@ -0,0 +1,55 @@
+/*
+ * 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.Responsive;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.PopupView;
+
+/**
+ * Test UI for popup view with extension: extension is a part of getChildren()
+ * collection but is not inside the getChildComponents() collection. Popup view
+ * should use getChildComponents() to avoid exception when extension is returned
+ * by getChildren().
+ *
+ * @since 7.2
+ * @author Vaadin Ltd
+ */
+public class PopupViewWithExtension extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Label label = new Label("label");
+ PopupView view = new PopupView("small", label);
+
+ Responsive.makeResponsive(view);
+
+ addComponent(view);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "PopupView should use getChildComponents() in the connector, not getChildren()";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13503;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java
new file mode 100644
index 0000000000..4d11190ea9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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 org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Popup view with extension should not throw an exception.
+ *
+ * @since 7.2
+ * @author Vaadin Ltd
+ */
+public class PopupViewWithExtensionTest extends MultiBrowserTest {
+
+ @Test
+ public void testPopupView() {
+ setDebug(true);
+ openTestURL();
+
+ WebElement view = driver.findElement(By.className("v-popupview"));
+ view.click();
+
+ Assert.assertFalse(
+ "Popup view with extension should not throw an exception. "
+ + "(Error notification window is shown).",
+ isElementPresent(By.className("v-Notification-error")));
+ }
+
+}