diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-11-01 13:59:55 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-11-01 13:59:55 +0200 |
commit | d432aa8fd8b4a357947bbb988f5bd6bc98e43f77 (patch) | |
tree | 7f0d3fb2e31a3d064625d493c8b6eb5ab0081f3f /uitest | |
parent | 008b582c66166b1a2e7ada4510e3a3d8be433a10 (diff) | |
download | vaadin-framework-d432aa8fd8b4a357947bbb988f5bd6bc98e43f77.tar.gz vaadin-framework-d432aa8fd8b4a357947bbb988f5bd6bc98e43f77.zip |
Properly detach removed connectors (#9815)
Change-Id: I1b9a1a1bfbf384a8e5530ca8fddd1e0758d431f2
Diffstat (limited to 'uitest')
2 files changed, 93 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/HierarchyChangeForRemovedComponentContainers.html b/uitest/src/com/vaadin/tests/components/HierarchyChangeForRemovedComponentContainers.html new file mode 100644 index 0000000000..49b02d3f01 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/HierarchyChangeForRemovedComponentContainers.html @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.HierarchyChangeForRemovedComponentContainers?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsHierarchyChangeForRemovedComponentContainers::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>two-buttons-no-NPE</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/HierarchyChangeForRemovedComponentContainers.java b/uitest/src/com/vaadin/tests/components/HierarchyChangeForRemovedComponentContainers.java new file mode 100644 index 0000000000..db6ff9f537 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/HierarchyChangeForRemovedComponentContainers.java @@ -0,0 +1,61 @@ +package com.vaadin.tests.components; + +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.VerticalLayout; + +public class HierarchyChangeForRemovedComponentContainers extends TestBase { + + + private HorizontalLayout mainContent; + private VerticalLayout lo2; + + @Override + protected void setup() { + + mainContent = new HorizontalLayout(); + mainContent.setSizeFull(); + + lo2 = new VerticalLayout(); + Button button1 = new Button("asdasd1"); + button1.setHeight("90%"); + Button button2 = new Button("asdasd2"); + button2.setHeight("90%"); + lo2.addComponent(button1); + lo2.addComponent(button2); + + compose(); + + addComponent(new Button("Replace layout with button", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + compose2(); + } + })); + } + + private void compose() { + getLayout().removeAllComponents(); + getLayout().addComponent(mainContent); + mainContent.addComponent(lo2); + System.out.println("composed"); + } + + private void compose2() { + getLayout().removeAllComponents(); + getLayout().addComponent(lo2); + } + + @Override + protected String getDescription() { + return "HierarchyChange events should be triggered for removed layouts"; + } + + @Override + protected Integer getTicketNumber() { + return 9815; + } + +} |