]> source.dussan.org Git - vaadin-framework.git/commitdiff
Convert CustomComponentChildVisibility to TB4.
authorSauli Tähkäpää <sauli@vaadin.com>
Sun, 6 Jul 2014 11:37:48 +0000 (14:37 +0300)
committerVaadin Code Review <review@vaadin.com>
Wed, 20 Aug 2014 13:51:06 +0000 (13:51 +0000)
Change-Id: I8d1a61df37eb3af1f5c0ebcdcf3097df59a44652

uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.html [deleted file]
uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java
uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java [new file with mode: 0644]

diff --git a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.html b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.html
deleted file mode 100644 (file)
index ac2f045..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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://arturwin.office.itmill.com: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.customcomponent.CustomComponentChildVisibility?debug&amp;restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>assertText</td>
-       <td>vaadin=runcomvaadintestscomponentscustomcomponentCustomComponentChildVisibility::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VPanel[0]/VLabel[0]</td>
-       <td>In panel</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscustomcomponentCustomComponentChildVisibility::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCheckBox[0]/domChild[0]</td>
-       <td>7,7</td>
-</tr>
-<tr>
-       <td>assertElementNotPresent</td>
-       <td>vaadin=runcomvaadintestscomponentscustomcomponentCustomComponentChildVisibility::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VPanel[0]/VLabel[0]</td>
-       <td>In panel</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscustomcomponentCustomComponentChildVisibility::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td>
-       <td>7,7</td>
-</tr>
-<tr>
-       <td>assertText</td>
-       <td>vaadin=runcomvaadintestscomponentscustomcomponentCustomComponentChildVisibility::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VPanel[0]/VLabel[0]</td>
-       <td>In panel</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
index a9899b2815380a7f34f520b6a0b2633e5158fc50..48484165fff39ea91e31905db39f596bd3ee183f 100644 (file)
  */
 package com.vaadin.tests.components.customcomponent;
 
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Button;
 import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Panel;
@@ -28,20 +26,21 @@ public class CustomComponentChildVisibility extends AbstractTestUI {
 
     @Override
     protected void setup(VaadinRequest request) {
+        Label label = new Label("In panel");
+        label.setId("label");
         final CustomComponent cc = new CustomComponent(new Panel(
-                "In CustomComponent", new Label("In panel")));
+                "In CustomComponent", label));
 
-        final CheckBox cb = new CheckBox("CustomComponent visible");
-        cb.setValue(true);
-        cb.setImmediate(true);
-        cb.addValueChangeListener(new ValueChangeListener() {
+        Button hideButton = new Button("Hide CustomComponent");
+        hideButton.addClickListener(new Button.ClickListener() {
             @Override
-            public void valueChange(ValueChangeEvent event) {
-                cc.setVisible(cb.getValue());
+            public void buttonClick(Button.ClickEvent event) {
+                cc.setVisible(false);
             }
         });
+
         addComponent(cc);
-        addComponent(cb);
+        addComponent(hideButton);
 
     }
 
diff --git a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java
new file mode 100644 (file)
index 0000000..4e02046
--- /dev/null
@@ -0,0 +1,29 @@
+package com.vaadin.tests.components.customcomponent;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class CustomComponentChildVisibilityTest extends MultiBrowserTest {
+
+    @Test
+    public void childVisibilityIsSet() {
+        openTestURL();
+
+        assertTrue(isChildElementVisible());
+
+        $(ButtonElement.class).first().click();
+
+        assertFalse(isChildElementVisible());
+    }
+
+    private boolean isChildElementVisible() {
+        return $(LabelElement.class).all().size() > 1;
+    }
+
+
+}
\ No newline at end of file