+++ /dev/null
-<?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&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>
*/
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;
@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);
}
--- /dev/null
+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