]> source.dussan.org Git - vaadin-framework.git/commitdiff
Explicit test for attaching extensions (#6690)
authorLeif Åstrand <leif@vaadin.com>
Thu, 5 Jul 2012 11:12:18 +0000 (14:12 +0300)
committerLeif Åstrand <leif@vaadin.com>
Thu, 5 Jul 2012 11:12:18 +0000 (14:12 +0300)
tests/testbench/com/vaadin/tests/extensions/BasicExtension.java [new file with mode: 0644]
tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.java [new file with mode: 0644]
tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java [new file with mode: 0644]

diff --git a/tests/testbench/com/vaadin/tests/extensions/BasicExtension.java b/tests/testbench/com/vaadin/tests/extensions/BasicExtension.java
new file mode 100644 (file)
index 0000000..551d247
--- /dev/null
@@ -0,0 +1,15 @@
+/* 
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.tests.extensions;
+
+import com.vaadin.terminal.AbstractClientConnector;
+import com.vaadin.terminal.AbstractExtension;
+
+public class BasicExtension extends AbstractExtension {
+    @Override
+    public void extend(AbstractClientConnector target) {
+        super.extend(target);
+    }
+}
\ No newline at end of file
diff --git a/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html b/tests/testbench/com/vaadin/tests/extensions/BasicExtensionTest.html
new file mode 100644 (file)
index 0000000..6e8a0bf
--- /dev/null
@@ -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://192.168.2.41: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.extensions.BasicExtensionTest?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>//div[1]</td>
+       <td>BasicExtensionTestConnector extending LabelConnector</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>//div[2]</td>
+       <td>BasicExtensionTestConnector extending 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
new file mode 100644 (file)
index 0000000..02bdadc
--- /dev/null
@@ -0,0 +1,34 @@
+/* 
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+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.Label;
+
+@Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet")
+public class BasicExtensionTest extends AbstractTestRoot {
+
+    @Override
+    protected void setup(WrappedRequest request) {
+        Label label = new Label();
+        addComponent(label);
+
+        new BasicExtension().extend(this);
+        new BasicExtension().extend(label);
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Simple test for extending components";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(6690);
+    }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java b/tests/testbench/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java
new file mode 100644 (file)
index 0000000..aa5bec8
--- /dev/null
@@ -0,0 +1,27 @@
+/* 
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.tests.widgetset.client;
+
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
+import com.vaadin.terminal.gwt.client.ServerConnector;
+import com.vaadin.terminal.gwt.client.Util;
+import com.vaadin.terminal.gwt.client.extensions.AbstractExtensionConnector;
+import com.vaadin.terminal.gwt.client.ui.Connect;
+import com.vaadin.tests.extensions.BasicExtension;
+
+@Connect(BasicExtension.class)
+public class BasicExtensionTestConnector extends AbstractExtensionConnector {
+    @Override
+    protected void extend(ServerConnector target) {
+        String message = Util.getSimpleName(this) + " extending "
+                + Util.getSimpleName(target);
+
+        DivElement element = Document.get().createDivElement();
+        element.setInnerText(message);
+
+        Document.get().getBody().insertFirst(element);
+    }
+}