diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-08-10 14:01:53 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-08-10 14:01:53 +0300 |
commit | 4ba988a5a0d9762757a5a0a2ffb704faaa30f64c (patch) | |
tree | cc2e93939ff41a720a2eca1992778c111e39fb1a | |
parent | 3c1e9fb02c8fc376c16f9069a58f17227f7f58de (diff) | |
download | vaadin-framework-4ba988a5a0d9762757a5a0a2ffb704faaa30f64c.tar.gz vaadin-framework-4ba988a5a0d9762757a5a0a2ffb704faaa30f64c.zip |
Update test case to cover #9282
3 files changed, 34 insertions, 3 deletions
diff --git a/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html index 6e8a0bf97f..804c3b6cdb 100644 --- a/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html +++ b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html @@ -26,7 +26,16 @@ <td>//div[2]</td> <td>BasicExtensionTestConnector extending RootConnector</td> </tr> - +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestsextensionsBasicExtensionTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//div[1]</td> + <td>BasicExtensionTestConnector removed for RootConnector</td> +</tr> </tbody></table> </body> </html> diff --git a/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java index 02bdadca34..e9505589a5 100644 --- a/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java +++ b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java @@ -7,6 +7,9 @@ package com.vaadin.tests.extensions; import com.vaadin.annotations.Widgetset; import com.vaadin.terminal.WrappedRequest; import com.vaadin.tests.components.AbstractTestRoot; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; @Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet") @@ -17,8 +20,15 @@ public class BasicExtensionTest extends AbstractTestRoot { Label label = new Label(); addComponent(label); - new BasicExtension().extend(this); + final BasicExtension rootExtension = new BasicExtension(); + rootExtension.extend(this); new BasicExtension().extend(label); + addComponent(new Button("Remove root extension", new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + rootExtension.removeFromTarget(); + } + })); } @Override diff --git a/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java b/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java index db3e097a6e..c151e6e90b 100644 --- a/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java +++ b/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java @@ -14,9 +14,16 @@ import com.vaadin.tests.extensions.BasicExtension; @Connect(BasicExtension.class) public class BasicExtensionTestConnector extends AbstractExtensionConnector { + private ServerConnector target; + @Override protected void extend(ServerConnector target) { - String message = Util.getSimpleName(this) + " extending " + this.target = target; + appendMessage(" extending "); + } + + private void appendMessage(String action) { + String message = Util.getSimpleName(this) + action + Util.getSimpleName(target); DivElement element = Document.get().createDivElement(); @@ -24,4 +31,9 @@ public class BasicExtensionTestConnector extends AbstractExtensionConnector { Document.get().getBody().insertFirst(element); } + + @Override + public void onUnregister() { + appendMessage(" removed for "); + } } |