diff options
author | Sauli Tähkäpää <sauli@vaadin.com> | 2014-07-06 14:37:48 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-08-20 13:51:06 +0000 |
commit | 1856423be3ad100679b9ac38656dd610c0061a76 (patch) | |
tree | 1795b0db61482e0101881b193950b22ea8a20ba0 | |
parent | 794e6d322425044954ffa3dab900f4bc859ebb67 (diff) | |
download | vaadin-framework-1856423be3ad100679b9ac38656dd610c0061a76.tar.gz vaadin-framework-1856423be3ad100679b9ac38656dd610c0061a76.zip |
Convert CustomComponentChildVisibility to TB4.
Change-Id: I8d1a61df37eb3af1f5c0ebcdcf3097df59a44652
3 files changed, 39 insertions, 58 deletions
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 index ac2f0452b3..0000000000 --- a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.html +++ /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&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> diff --git a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java index a9899b2815..48484165ff 100644 --- a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java +++ b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java @@ -15,11 +15,9 @@ */ 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 index 0000000000..4e0204604b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java @@ -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 |