diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2015-03-23 12:10:07 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-03-24 09:04:25 +0000 |
commit | 2a671f2810dfb409cc4d30a1606868282d0925d3 (patch) | |
tree | ddc54f63c6dcbf82ced308659ed5a2b10869ebfe /uitest/src | |
parent | 4f3397df74dc737a9c5592d5418e741433e20dee (diff) | |
download | vaadin-framework-2a671f2810dfb409cc4d30a1606868282d0925d3.tar.gz vaadin-framework-2a671f2810dfb409cc4d30a1606868282d0925d3.zip |
Fix declarative support for CustomLayout (#17210)
CustomLayout now has a public default constructor. If a template is not set
using one of the setters, a warning message is displayed like in the case where
the template file is specified but not found.
Change-Id: I5d56f24fafc5c82e6ab76dec393a0c25bd78aae5
Diffstat (limited to 'uitest/src')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplate.java | 44 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplateTest.java | 43 |
2 files changed, 87 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplate.java b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplate.java new file mode 100644 index 0000000000..de1caf86df --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplate.java @@ -0,0 +1,44 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.customlayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.CustomLayout; +import com.vaadin.ui.Label; + +public class CustomLayoutWithNullTemplate extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + CustomLayout cl = new CustomLayout(); + cl.addComponent(new Label("This Label should be visible."), "foo"); + cl.addComponent(new Button("This Button too."), "bar"); + + addComponent(cl); + } + + @Override + protected String getTestDescription() { + return "Verify that a default-constructed CustomLayout renders child components"; + } + + @Override + protected Integer getTicketNumber() { + return 17210; + } +} diff --git a/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplateTest.java b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplateTest.java new file mode 100644 index 0000000000..668d43f18f --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithNullTemplateTest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.customlayout; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.vaadin.testbench.ElementQuery; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.CustomLayoutElement; +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class CustomLayoutWithNullTemplateTest extends SingleBrowserTest { + + @Test + public void testChildComponents() { + openTestURL(); + + ElementQuery<CustomLayoutElement> customLayout = $(CustomLayoutElement.class); + + // Verify the Button and Label are rendered inside the CustomLayout. + assertTrue("Button was not rendered.", + customLayout.$(ButtonElement.class).exists()); + assertTrue("Label was not rendered.", customLayout + .$(LabelElement.class).exists()); + } + +} |