diff options
author | Teemu Pöntelin <teemu@vaadin.com> | 2014-12-04 20:09:42 +0200 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-12-16 22:52:32 +0200 |
commit | 6a9f18e592c9bd99e90d3886f96beaab6df7d064 (patch) | |
tree | b0e85b174eddee0b88a84881efe7e8c503164b23 /uitest | |
parent | 64ca4836e9c5224e86764b504459c795d4701c09 (diff) | |
download | vaadin-framework-6a9f18e592c9bd99e90d3886f96beaab6df7d064.tar.gz vaadin-framework-6a9f18e592c9bd99e90d3886f96beaab6df7d064.zip |
Fix CustomLayout child rendering when template is missing (#8696)
Change-Id: I8ce4fbc566f030bf22c555f68b97beb781b19805
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplate.java | 44 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplateTest.java | 43 |
2 files changed, 87 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplate.java b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplate.java new file mode 100644 index 0000000000..54949a053d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplate.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 CustomLayoutWithoutTemplate extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + CustomLayout cl = new CustomLayout("missing-layout-file.html"); + cl.addComponent(new Label("This Label should be visible."), "foo"); + cl.addComponent(new Button("And this Button too."), "bar"); + + addComponent(cl); + } + + @Override + protected String getTestDescription() { + return "Verify that CustomLayout renders child components even if the template is missing."; + } + + @Override + protected Integer getTicketNumber() { + return 8696; + } +} diff --git a/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplateTest.java b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplateTest.java new file mode 100644 index 0000000000..695d9cceff --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutWithoutTemplateTest.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 CustomLayoutWithoutTemplateTest 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()); + } + +} |