From: Henri Sara Date: Wed, 23 Sep 2015 13:28:28 +0000 (+0300) Subject: Use "vaadin-" as default prefix for Design (#18957) X-Git-Tag: 7.6.0.alpha7~55 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1011cff7e8139cd1b7138b2e538264c755c7482f;p=vaadin-framework.git Use "vaadin-" as default prefix for Design (#18957) Change-Id: Ic9e0650e5c8e305258cbce033c4ef3f33307bf0f --- diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index 77a1a3134e..857f2481d5 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -138,6 +138,7 @@ public interface Constants { static final String SERVLET_PARAMETER_SYNC_ID_CHECK = "syncIdCheck"; static final String SERVLET_PARAMETER_SENDURLSASPARAMETERS = "sendUrlsAsParameters"; static final String SERVLET_PARAMETER_PUSH_SUSPEND_TIMEOUT_LONGPOLLING = "pushLongPollingSuspendTimeout"; + static final String SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX = "legacyDesignPrefix"; // Configurable parameter names static final String PARAMETER_VAADIN_RESOURCES = "Resources"; diff --git a/server/src/com/vaadin/ui/declarative/Design.java b/server/src/com/vaadin/ui/declarative/Design.java index 63a2638423..8405160661 100644 --- a/server/src/com/vaadin/ui/declarative/Design.java +++ b/server/src/com/vaadin/ui/declarative/Design.java @@ -193,7 +193,7 @@ public class Design implements Serializable { ComponentFactory componentFactory, DesignContext context) { // Extract the package and class names. // Otherwise, get the full class name using the prefix to package - // mapping. Example: "v-vertical-layout" -> + // mapping. Example: "vaadin-vertical-layout" -> // "com.vaadin.ui.VerticalLayout" String[] parts = tagName.split("-", 2); if (parts.length < 2) { @@ -211,8 +211,8 @@ public class Design implements Serializable { // Split will ignore trailing and multiple dashes but that // should be // ok - // will be resolved to - // will be resolved to + // will be resolved to + // will be resolved to className += SharedUtil.capitalize(classNamePart); } String qualifiedClassName = packageName + "." + className; diff --git a/server/src/com/vaadin/ui/declarative/DesignContext.java b/server/src/com/vaadin/ui/declarative/DesignContext.java index 0d68c22ea0..39a30de534 100644 --- a/server/src/com/vaadin/ui/declarative/DesignContext.java +++ b/server/src/com/vaadin/ui/declarative/DesignContext.java @@ -30,6 +30,9 @@ import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import com.vaadin.annotations.DesignRoot; +import com.vaadin.server.Constants; +import com.vaadin.server.DeploymentConfiguration; +import com.vaadin.server.VaadinService; import com.vaadin.ui.Component; import com.vaadin.ui.HasComponents; import com.vaadin.ui.declarative.Design.ComponentFactory; @@ -39,13 +42,25 @@ import com.vaadin.ui.declarative.Design.ComponentMapper; * This class contains contextual information that is collected when a component * tree is constructed based on HTML design template. This information includes * mappings from local ids, global ids and captions to components , as well as a - * mapping between prefixes and package names (such as "v" -> "com.vaadin.ui"). + * mapping between prefixes and package names (such as "vaadin" -> + * "com.vaadin.ui"). + * + * Versions prior to 7.6 use "v" as the default prefix. Versions starting with + * 7.6 support reading designs with either "v" or "vaadin" as the prefix, but + * only write "vaadin" by default. Writing with the legacy prefix can be + * activated with the property or context parameter + * {@link Constants#SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX}. * * @since 7.4 * @author Vaadin Ltd */ public class DesignContext implements Serializable { + private static final String LEGACY_PREFIX = "v"; + private static final String VAADIN_PREFIX = "vaadin"; + + private static final String VAADIN_UI_PACKAGE = "com.vaadin.ui"; + // cache for object instances private static Map, Component> instanceCache = new ConcurrentHashMap, Component>(); @@ -67,23 +82,24 @@ public class DesignContext implements Serializable { // namespace mappings private Map packageToPrefix = new HashMap(); private Map prefixToPackage = new HashMap(); - // prefix names for which no package-mapping element will be created in the - // html tree (this includes at least "v" which is always taken to refer - // to "com.vaadin.ui". - private Map defaultPrefixes = new HashMap(); // component creation listeners private List listeners = new ArrayList(); private ShouldWriteDataDelegate shouldWriteDataDelegate = ShouldWriteDataDelegate.DEFAULT; + // this cannot be static because of testability issues + private Boolean legacyDesignPrefix = null; + public DesignContext(Document doc) { this.doc = doc; // Initialize the mapping between prefixes and package names. - defaultPrefixes.put("v", "com.vaadin.ui"); - for (String prefix : defaultPrefixes.keySet()) { - String packageName = defaultPrefixes.get(prefix); - addPackagePrefix(prefix, packageName); + if (isLegacyPrefixEnabled()) { + addPackagePrefix(LEGACY_PREFIX, VAADIN_UI_PACKAGE); + prefixToPackage.put(VAADIN_PREFIX, VAADIN_UI_PACKAGE); + } else { + addPackagePrefix(VAADIN_PREFIX, VAADIN_UI_PACKAGE); + prefixToPackage.put(LEGACY_PREFIX, VAADIN_UI_PACKAGE); } } @@ -259,9 +275,14 @@ public class DesignContext implements Serializable { /** * Creates a two-way mapping between a prefix and a package name. * + * Note that modifying the mapping for {@value #VAADIN_UI_PACKAGE} may + * invalidate the backwards compatibility mechanism supporting reading such + * components with either {@value #LEGACY_PREFIX} or {@value #VAADIN_PREFIX} + * as prefix. + * * @param prefix - * the prefix name without an ending dash (for instance, "v" is - * by default used for "com.vaadin.ui") + * the prefix name without an ending dash (for instance, "vaadin" + * is by default used for "com.vaadin.ui") * @param packageName * the name of the package corresponding to prefix * @@ -288,7 +309,11 @@ public class DesignContext implements Serializable { * registered */ public String getPackagePrefix(String packageName) { - return packageToPrefix.get(packageName); + if (VAADIN_UI_PACKAGE.equals(packageName)) { + return isLegacyPrefixEnabled() ? LEGACY_PREFIX : VAADIN_PREFIX; + } else { + return packageToPrefix.get(packageName); + } } /** @@ -395,8 +420,8 @@ public class DesignContext implements Serializable { Element head = doc.head(); for (String prefix : getPackagePrefixes()) { // Only store the prefix-name mapping if it is not a default mapping - // (such as "v" -> "com.vaadin.ui") - if (defaultPrefixes.get(prefix) == null) { + // (such as "vaadin" -> "com.vaadin.ui") + if (!VAADIN_PREFIX.equals(prefix) && !LEGACY_PREFIX.equals(prefix)) { Node newNode = doc.createElement("meta"); newNode.attr("name", "package-mapping"); String prefixToPackageName = prefix + ":" + getPackage(prefix); @@ -406,6 +431,31 @@ public class DesignContext implements Serializable { } } + /** + * Check whether the legacy prefix "v" or the default prefix "vaadin" should + * be used when writing designs. The property or context parameter + * {@link Constants#SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX} can be used to + * switch to the legacy prefix. + * + * @since + * @return true to use the legacy prefix, false by default + */ + protected boolean isLegacyPrefixEnabled() { + if (legacyDesignPrefix != null) { + return legacyDesignPrefix.booleanValue(); + } + if (VaadinService.getCurrent() == null) { + // This will happen at least in JUnit tests. + return false; + } + DeploymentConfiguration configuration = VaadinService.getCurrent() + .getDeploymentConfiguration(); + legacyDesignPrefix = configuration.getApplicationOrSystemProperty( + Constants.SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX, "false") + .equals("true"); + return legacyDesignPrefix.booleanValue(); + } + /** * Creates an html tree node corresponding to the given element. Also * initializes its attributes by calling writeDesign. As a result of the @@ -511,11 +561,21 @@ public class DesignContext implements Serializable { Component component = componentMapper.tagToComponent(tag, Design.getComponentFactory(), this); - assert tag.equals(componentMapper.componentToTag(component, this)); + assert tagEquals(tag, componentMapper.componentToTag(component, this)); return component; } + private boolean tagEquals(String tag1, String tag2) { + return tag1.equals(tag2) + || (hasVaadinPrefix(tag1) && hasVaadinPrefix(tag2)); + } + + private boolean hasVaadinPrefix(String tag) { + return tag.startsWith(LEGACY_PREFIX + "-") + || tag.startsWith(VAADIN_PREFIX + "-"); + } + /** * Instantiates given class via ComponentFactory. * diff --git a/server/tests/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperDeclarativeTest.java b/server/tests/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperDeclarativeTest.java index 735216c474..71373857fa 100644 --- a/server/tests/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperDeclarativeTest.java @@ -29,9 +29,9 @@ public class DragAndDropWrapperDeclarativeTest extends @Test public void testDefaultDnDWrapper() { Button okButton = new Button("OK"); - String input = "" + String input = "" + new DesignContext().createElement(okButton) - + ""; + + ""; DragAndDropWrapper wrapper = new DragAndDropWrapper(okButton); testWrite(input, wrapper); testRead(input, wrapper); @@ -40,9 +40,9 @@ public class DragAndDropWrapperDeclarativeTest extends @Test public void testNoDragImage() { Button okButton = new Button("OK"); - String input = "" + String input = "" + new DesignContext().createElement(okButton) - + ""; + + ""; DragAndDropWrapper wrapper = new DragAndDropWrapper(okButton); wrapper.setDragStartMode(DragStartMode.WRAPPER); testWrite(input, wrapper); @@ -53,10 +53,10 @@ public class DragAndDropWrapperDeclarativeTest extends public void testWithDragImage() { Button dragImage = new Button("Cancel"); Button okButton = new Button("OK"); - String input = "" + String input = "" + new DesignContext().createElement(okButton) + new DesignContext().createElement(dragImage).attr( - ":drag-image", "") + ""; + ":drag-image", "") + ""; DragAndDropWrapper wrapper = new DragAndDropWrapper(okButton); wrapper.setDragStartMode(DragStartMode.COMPONENT_OTHER); wrapper.setDragImageComponent(dragImage); diff --git a/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java b/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java index d058ae1dcd..b131c5a21d 100644 --- a/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java @@ -38,14 +38,14 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase { @Test // #16328 public void testReadWrite() throws IOException { - String design = "" + String design = "" + "Save" + "Open" + "Close" + "Help" + "About" + "SubItem" - + "WTF?!" + ""; + + "WTF?!" + ""; MenuBar bar = new MenuBar(); bar.setAutoOpen(true); bar.setHtmlContentAllowed(true); @@ -69,7 +69,7 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase { @Test // #16328 public void testTicketSpec1() throws IOException { - String design = " " + String design = " " + "File" + "Save" + "Open" @@ -85,7 +85,7 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase { + "" // + "" // + "foo" - + ""; + + ""; // for one reason or another, no component has a correct .equals // implementation, which makes tests a bit annoying MenuBar menuBar = new MenuBar(); @@ -120,12 +120,12 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase { @Test // #16328 public void testTicketSpec2() throws IOException { - String design = "" + String design = "" + "File" + "Save" + "Open" + "" + "Exit" // - + ""; + + ""; MenuBar menuBar = new MenuBar(); menuBar.setHtmlContentAllowed(true); MenuItem fileMenu = menuBar.addItem("File", null); diff --git a/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java b/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java index 1119301c55..b68f56218d 100644 --- a/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java +++ b/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java @@ -29,7 +29,7 @@ public class AbstractComponentSetResponsiveTest extends label.setContentMode(ContentMode.HTML); label.setResponsive(true); - String design = ""; + String design = ""; testWrite(design, label); testRead(design, label); diff --git a/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java b/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java index 85efa22c40..472c079e42 100644 --- a/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java +++ b/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java @@ -74,7 +74,7 @@ public class ComponentFactoryTest { } }); - Design.read(new ByteArrayInputStream("".getBytes())); + Design.read(new ByteArrayInputStream("".getBytes())); Assert.assertEquals("There should be one message logged", 1, messages.size()); @@ -93,7 +93,7 @@ public class ComponentFactoryTest { } }); - Design.read(new ByteArrayInputStream("".getBytes())); + Design.read(new ByteArrayInputStream("".getBytes())); } @Test(expected = DesignException.class) @@ -108,7 +108,7 @@ public class ComponentFactoryTest { } }); - Design.read(new ByteArrayInputStream("".getBytes())); + Design.read(new ByteArrayInputStream("".getBytes())); } @Test diff --git a/server/tests/src/com/vaadin/tests/design/DesignContextLocalIdTest.java b/server/tests/src/com/vaadin/tests/design/DesignContextLocalIdTest.java index 6cedb17409..f8fb1249b9 100644 --- a/server/tests/src/com/vaadin/tests/design/DesignContextLocalIdTest.java +++ b/server/tests/src/com/vaadin/tests/design/DesignContextLocalIdTest.java @@ -101,7 +101,7 @@ public class DesignContextLocalIdTest { Element e = ctx.createElement(ctr); assertEquals("Unexpected child local id for " + ctr.getClass().getSimpleName(), "button-id", e - .getElementsByTag("v-button").first().attr("_id")); + .getElementsByTag("vaadin-button").first().attr("_id")); } SingleComponentContainer[] sctrs = { new Window(), new Panel() }; @@ -111,7 +111,7 @@ public class DesignContextLocalIdTest { Element e = ctx.createElement(ctr); assertEquals("Unexpected child local id for " + ctr.getClass().getSimpleName(), "button-id", e - .getElementsByTag("v-button").first().attr("_id")); + .getElementsByTag("vaadin-button").first().attr("_id")); } } diff --git a/server/tests/src/com/vaadin/tests/design/DesignReadInConstructor.html b/server/tests/src/com/vaadin/tests/design/DesignReadInConstructor.html index 86c9c2a2da..72f65d744a 100644 --- a/server/tests/src/com/vaadin/tests/design/DesignReadInConstructor.html +++ b/server/tests/src/com/vaadin/tests/design/DesignReadInConstructor.html @@ -1,5 +1,5 @@ - - - - OK! - \ No newline at end of file + + + + OK! + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/InvalidTagNames.java b/server/tests/src/com/vaadin/tests/design/InvalidTagNames.java index 0b6ccf8cb1..9f405f4e56 100644 --- a/server/tests/src/com/vaadin/tests/design/InvalidTagNames.java +++ b/server/tests/src/com/vaadin/tests/design/InvalidTagNames.java @@ -42,7 +42,7 @@ public class InvalidTagNames { @Test(expected = DesignException.class) public void onlyPrefix() { - readDesign("foo"); + readDesign("foo"); } @Test @@ -55,7 +55,7 @@ public class InvalidTagNames { @Test(expected = DesignException.class) public void unknownClass() { - readDesign("foo"); + readDesign("foo"); } @Test(expected = DesignException.class) @@ -65,31 +65,31 @@ public class InvalidTagNames { // @Test(expected = DesignException.class) // This is a side effect of not actively checking for invalid input. Will be - // parsed currently as (this should not be considered API) + // parsed currently as (this should not be considered API) public void tagEndsInDash() { - Component c = readDesign(""); + Component c = readDesign(""); Assert.assertTrue(c.getClass() == Button.class); } // @Test(expected = DesignException.class) // This is a side effect of not actively checking for invalid input. Will be - // parsed currently as (this should not be considered API) + // parsed currently as (this should not be considered API) public void tagEndsInTwoDashes() { - Component c = readDesign(""); + Component c = readDesign(""); Assert.assertTrue(c.getClass() == Button.class); } // @Test(expected = DesignException.class) // This is a side effect of not actively checking for invalid input. Will be - // parsed currently as (this should not be considered API) + // parsed currently as (this should not be considered API) public void tagWithTwoDashes() { - Component c = readDesign(""); + Component c = readDesign(""); Assert.assertTrue(c.getClass() == Button.class); } @Test(expected = DesignException.class) public void specialCharacters() { - readDesign(""); + readDesign(""); } private Component readDesign(String string) { diff --git a/server/tests/src/com/vaadin/tests/design/LocaleTest.java b/server/tests/src/com/vaadin/tests/design/LocaleTest.java index 8f0ef4d13e..6cb288db23 100644 --- a/server/tests/src/com/vaadin/tests/design/LocaleTest.java +++ b/server/tests/src/com/vaadin/tests/design/LocaleTest.java @@ -145,18 +145,18 @@ public class LocaleTest { html.appendChild(doc.createElement("head")); Element body = doc.createElement("body"); html.appendChild(body); - Element evLayout = doc.createElement("v-vertical-layout"); + Element evLayout = doc.createElement("vaadin-vertical-layout"); evLayout.attr("locale", "en_US"); body.appendChild(evLayout); - Element ehLayout = doc.createElement("v-horizontal-layout"); + Element ehLayout = doc.createElement("vaadin-horizontal-layout"); evLayout.appendChild(ehLayout); - Element eb1 = doc.createElement("v-button"); + Element eb1 = doc.createElement("vaadin-button"); eb1.attr("locale", "en_US"); ehLayout.appendChild(eb1); - Element eb2 = doc.createElement("v-button"); + Element eb2 = doc.createElement("vaadin-button"); eb2.attr("locale", "en_GB"); ehLayout.appendChild(eb2); - Element eb3 = doc.createElement("v-button"); + Element eb3 = doc.createElement("vaadin-button"); ehLayout.appendChild(eb3); // parse the created document and check the constructed component diff --git a/server/tests/src/com/vaadin/tests/design/ParseLayoutTest.java b/server/tests/src/com/vaadin/tests/design/ParseLayoutTest.java index 50ab261195..20903512d1 100644 --- a/server/tests/src/com/vaadin/tests/design/ParseLayoutTest.java +++ b/server/tests/src/com/vaadin/tests/design/ParseLayoutTest.java @@ -15,10 +15,16 @@ */ package com.vaadin.tests.design; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -37,12 +43,6 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.declarative.Design; import com.vaadin.ui.declarative.DesignContext; import com.vaadin.ui.declarative.DesignException; -import org.junit.rules.ExpectedException; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.*; /** * A test for checking that parsing a layout preserves the IDs and the mapping diff --git a/server/tests/src/com/vaadin/tests/design/ParseLegacyPrefixTest.java b/server/tests/src/com/vaadin/tests/design/ParseLegacyPrefixTest.java new file mode 100644 index 0000000000..feaf73af3c --- /dev/null +++ b/server/tests/src/com/vaadin/tests/design/ParseLegacyPrefixTest.java @@ -0,0 +1,46 @@ +/* + * 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.design; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; + +import org.junit.Test; + +import com.vaadin.ui.declarative.Design; +import com.vaadin.ui.declarative.DesignContext; + +/** + * Test reading a design with all components using the legacy prefix. + */ +public class ParseLegacyPrefixTest { + + @Test + public void allComponentsAreParsed() throws FileNotFoundException { + DesignContext ctx = Design + .read(new FileInputStream( + "server/tests/src/com/vaadin/tests/design/all-components-legacy.html"), + null); + + assertThat(ctx, is(not(nullValue()))); + assertThat(ctx.getRootComponent(), is(not(nullValue()))); + } +} diff --git a/server/tests/src/com/vaadin/tests/design/ParseMixedLegacyAndNewPrefixTest.java b/server/tests/src/com/vaadin/tests/design/ParseMixedLegacyAndNewPrefixTest.java new file mode 100644 index 0000000000..2996cb23c1 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/design/ParseMixedLegacyAndNewPrefixTest.java @@ -0,0 +1,35 @@ +/* + * 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.design; + +import java.io.ByteArrayInputStream; + +import org.junit.Test; + +import com.vaadin.ui.declarative.Design; + +/** + * Parse mixed content with legacy and new prefixes (not a required feature but + * works). + */ +public class ParseMixedLegacyAndNewPrefixTest { + @Test + public void parseMixedContent() { + Design.read(new ByteArrayInputStream( + "" + .getBytes())); + } +} diff --git a/server/tests/src/com/vaadin/tests/design/WriteLegacyDesignTest.java b/server/tests/src/com/vaadin/tests/design/WriteLegacyDesignTest.java new file mode 100644 index 0000000000..e57a03c232 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/design/WriteLegacyDesignTest.java @@ -0,0 +1,102 @@ +/* + * 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.design; + +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.nodes.Node; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.vaadin.server.Constants; +import com.vaadin.server.DefaultDeploymentConfiguration; +import com.vaadin.server.DeploymentConfiguration; +import com.vaadin.server.VaadinService; +import com.vaadin.server.VaadinServletService; +import com.vaadin.ui.declarative.Design; +import com.vaadin.ui.declarative.DesignContext; +import com.vaadin.util.CurrentInstance; + +/** + * Parse and write a legacy design (using the "v-" prefix). + */ +public class WriteLegacyDesignTest { + + // The context is used for accessing the created component hierarchy. + private DesignContext ctx; + + @Before + public void setUp() throws Exception { + Properties properties = new Properties(); + properties + .put(Constants.SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX, "true"); + final DeploymentConfiguration configuration = new DefaultDeploymentConfiguration( + WriteLegacyDesignTest.class, properties); + + VaadinService service = new VaadinServletService(null, configuration); + + CurrentInstance.set(VaadinService.class, service); + + ctx = Design + .read(new FileInputStream( + "server/tests/src/com/vaadin/tests/design/testFile-legacy.html"), + null); + } + + @After + public void tearDown() { + CurrentInstance.set(VaadinService.class, null); + } + + private ByteArrayOutputStream serializeDesign(DesignContext context) + throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + Design.write(context, out); + + return out; + } + + @Test + public void designIsSerializedWithCorrectPrefixesAndPackageNames() + throws IOException { + ByteArrayOutputStream out = serializeDesign(ctx); + + Document doc = Jsoup.parse(out.toString("UTF-8")); + for (Node child : doc.body().childNodes()) { + checkNode(child); + } + } + + private void checkNode(Node node) { + if (node instanceof Element) { + assertTrue("Wrong design element prefix", node.nodeName() + .startsWith("v-")); + for (Node child : node.childNodes()) { + checkNode(child); + } + } + } + +} diff --git a/server/tests/src/com/vaadin/tests/design/all-components-legacy.html b/server/tests/src/com/vaadin/tests/design/all-components-legacy.html new file mode 100644 index 0000000000..39aecb6db1 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/design/all-components-legacy.html @@ -0,0 +1,122 @@ + + + + + + + + + + + + + OK + Cancel + + + + + OK + + + + + + OK + + + + + + OK + + + + + + OK + + + + + + + + + + + + + + + + test value + + OK + + OK + + + + + + + + + + In disabled tab - can’t be shown by default + + + + + + + + + + + + + + + In disabled tab - can’t be shown by default + + + + + + + + + First slot + + + Second slot + + + First slot + Second slot + + + + Hello world! + This is Rich content! + This is only text and will contain visible tags + + + + + + + + + + + + + + + + diff --git a/server/tests/src/com/vaadin/tests/design/all-components.html b/server/tests/src/com/vaadin/tests/design/all-components.html index 39aecb6db1..6507188cd7 100644 --- a/server/tests/src/com/vaadin/tests/design/all-components.html +++ b/server/tests/src/com/vaadin/tests/design/all-components.html @@ -4,119 +4,119 @@ - + - + - - OK - Cancel - + + OK + Cancel + - - OK - - + + OK + + - - OK - - + + OK + + - - OK - - + + OK + + - - OK - - + + OK + + - - - + + + - + - + - + - test value + test value - OK + OK - OK + OK - + - - - + + + - In disabled tab - can’t be shown by default + In disabled tab - can’t be shown by default - + - + - + - - - + + + - In disabled tab - can’t be shown by default + In disabled tab - can’t be shown by default - + - + - - First slot - - - Second slot - - - First slot - Second slot - + + First slot + + + Second slot + + + First slot + Second slot + - Hello world! - This is Rich content! - This is only text and will contain visible tags + Hello world! + This is Rich content! + This is only text and will contain visible tags - + - - + - + - + - + diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html index 66e9202ca7..3e7977f568 100644 --- a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html +++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html @@ -1,5 +1,5 @@ - - OK - Cancel - a Label that should not override pre initalized field - \ No newline at end of file + + OK + Cancel + a Label that should not override pre initalized field + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/duplicate-ids.html b/server/tests/src/com/vaadin/tests/design/duplicate-ids.html index ef845d46d5..984bb1e047 100644 --- a/server/tests/src/com/vaadin/tests/design/duplicate-ids.html +++ b/server/tests/src/com/vaadin/tests/design/duplicate-ids.html @@ -1,4 +1,4 @@ - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html b/server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html index 5a506ad00c..e8a698a39f 100644 --- a/server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html +++ b/server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html @@ -1,4 +1,4 @@ - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/local-ids.html b/server/tests/src/com/vaadin/tests/design/local-ids.html index 638d004124..76ff642ee0 100644 --- a/server/tests/src/com/vaadin/tests/design/local-ids.html +++ b/server/tests/src/com/vaadin/tests/design/local-ids.html @@ -1,4 +1,4 @@ - - - Say hello - + + + Say hello + diff --git a/server/tests/src/com/vaadin/tests/design/nested/WriteNestedTemplatesTest.java b/server/tests/src/com/vaadin/tests/design/nested/WriteNestedTemplatesTest.java index 344cd94ac2..5c78802472 100644 --- a/server/tests/src/com/vaadin/tests/design/nested/WriteNestedTemplatesTest.java +++ b/server/tests/src/com/vaadin/tests/design/nested/WriteNestedTemplatesTest.java @@ -15,15 +15,19 @@ */ package com.vaadin.tests.design.nested; -import com.vaadin.ui.declarative.DesignContext; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Element; import org.jsoup.parser.Tag; import org.junit.Before; import org.junit.Test; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.*; +import com.vaadin.ui.declarative.DesignContext; /** * @@ -43,7 +47,7 @@ public class WriteNestedTemplatesTest { } private Element createDesign() { - Element design = new Element(Tag.valueOf("v-vertical-layout"), "", + Element design = new Element(Tag.valueOf("vaadin-vertical-layout"), "", new Attributes()); DesignContext designContext = new DesignContext(); diff --git a/server/tests/src/com/vaadin/tests/design/nested/mychilddesign.html b/server/tests/src/com/vaadin/tests/design/nested/mychilddesign.html index c636033d2d..0d2613539b 100644 --- a/server/tests/src/com/vaadin/tests/design/nested/mychilddesign.html +++ b/server/tests/src/com/vaadin/tests/design/nested/mychilddesign.html @@ -4,9 +4,9 @@ - - test content + + test content custom content - + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/nested/mydesignroot.html b/server/tests/src/com/vaadin/tests/design/nested/mydesignroot.html index 55ac27c194..6bf38db8f6 100644 --- a/server/tests/src/com/vaadin/tests/design/nested/mydesignroot.html +++ b/server/tests/src/com/vaadin/tests/design/nested/mydesignroot.html @@ -4,7 +4,7 @@ - + - + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/testFile-legacy.html b/server/tests/src/com/vaadin/tests/design/testFile-legacy.html new file mode 100644 index 0000000000..79ae1e9eaf --- /dev/null +++ b/server/tests/src/com/vaadin/tests/design/testFile-legacy.html @@ -0,0 +1,19 @@ + + + + + + + + + + Native click me + Another button + Yet another button + Click me + + + + + + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/testFile.html b/server/tests/src/com/vaadin/tests/design/testFile.html index 79ae1e9eaf..ab23d1d1b2 100644 --- a/server/tests/src/com/vaadin/tests/design/testFile.html +++ b/server/tests/src/com/vaadin/tests/design/testFile.html @@ -4,16 +4,16 @@ - - - - Native click me - Another button - Yet another button - Click me - - - - + + + + Native click me + Another button + Yet another button + Click me + + + + \ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/verticallayout-one-child.html b/server/tests/src/com/vaadin/tests/design/verticallayout-one-child.html index 4b0123b9ed..cf3dc65e48 100644 --- a/server/tests/src/com/vaadin/tests/design/verticallayout-one-child.html +++ b/server/tests/src/com/vaadin/tests/design/verticallayout-one-child.html @@ -1,3 +1,3 @@ - - OK - + + OK + diff --git a/server/tests/src/com/vaadin/tests/design/verticallayout-two-children.html b/server/tests/src/com/vaadin/tests/design/verticallayout-two-children.html index 87ae9eee8e..dcf71a190b 100644 --- a/server/tests/src/com/vaadin/tests/design/verticallayout-two-children.html +++ b/server/tests/src/com/vaadin/tests/design/verticallayout-two-children.html @@ -1,4 +1,4 @@ - - - Say hello - + + + Say hello + diff --git a/server/tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutDeclarativeTest.java index 80ca95733c..f00eb91c50 100644 --- a/server/tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutDeclarativeTest.java @@ -32,10 +32,10 @@ public class AbsoluteLayoutDeclarativeTest extends @Test public void testAbsoluteLayoutFeatures() { - String design = "" - + "OK" - + "Cancel" - + ""; + String design = "" + + "OK" + + "Cancel" + + ""; AbsoluteLayout layout = new AbsoluteLayout(); layout.setCaption("test-layout"); Button b1 = new Button("OK"); @@ -51,7 +51,7 @@ public class AbsoluteLayoutDeclarativeTest extends @Test public void testEmpty() { - String design = ""; + String design = ""; AbsoluteLayout layout = new AbsoluteLayout(); testRead(design, layout); testWrite(design, layout); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java index 71021a06e1..15a667eb28 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java @@ -62,14 +62,14 @@ public class AbstractComponentDeclarativeTest extends @Test public void testEmptyDesign() { - String design = ""; + String design = ""; testRead(design, component); testWrite(design, component); } @Test public void testProperties() { - String design = "test-error\" immediate=\"\"/>"; component.setId("testId"); @@ -89,8 +89,8 @@ public class AbstractComponentDeclarativeTest extends public void testReadImmediate() { // Additional tests for the immediate property, including // explicit immediate values - String[] design = { "", "", - "", "" }; + String[] design = { "", "", + "", "" }; Boolean[] explicitImmediate = { null, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE }; boolean[] immediate = { false, false, true, true }; @@ -105,7 +105,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testExternalIcon() { - String design = ""; + String design = ""; component .setIcon(new ExternalResource("http://example.com/example.gif")); testRead(design, component); @@ -114,7 +114,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testThemeIcon() { - String design = ""; + String design = ""; component.setIcon(new ThemeResource("example.gif")); testRead(design, component); testWrite(design, component); @@ -122,7 +122,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testFileResourceIcon() { - String design = ""; + String design = ""; component.setIcon(new FileResource(new File("img/example.gif"))); testRead(design, component); testWrite(design, component); @@ -130,7 +130,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testWidthAndHeight() { - String design = ""; + String design = ""; component.setWidth("70%"); component.setHeight("12px"); testRead(design, component); @@ -139,7 +139,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testSizeFull() { - String design = ""; + String design = ""; component.setSizeFull(); testRead(design, component); testWrite(design, component); @@ -147,7 +147,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testSizeAuto() { - String design = ""; + String design = ""; component.setSizeUndefined(); testRead(design, component); testWrite(design, component); @@ -155,7 +155,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testHeightFull() { - String design = ""; + String design = ""; component.setHeight("100%"); component.setWidth("20px"); testRead(design, component); @@ -164,7 +164,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testHeightAuto() { - String design = ""; + String design = ""; // we need to have default height of 100% -> use split panel AbstractComponent component = new HorizontalSplitPanel(); component.setHeight(null); @@ -175,7 +175,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testWidthFull() { - String design = "Foo"; + String design = "Foo"; AbstractComponent component = new Button(); component.setCaptionAsHtml(true); component.setCaption("Foo"); @@ -187,7 +187,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testWidthAuto() { - String design = ""; + String design = ""; component.setCaptionAsHtml(false); component.setHeight("20px"); component.setWidth(null); @@ -197,7 +197,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testResponsive() { - String design = ""; + String design = ""; Responsive.makeResponsive(component); testRead(design, component); testWrite(design, component); @@ -205,7 +205,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testResponsiveFalse() { - String design = ""; + String design = ""; // Only test read as the attribute responsive=false would not be written testRead(design, component); } @@ -223,7 +223,7 @@ public class AbstractComponentDeclarativeTest extends private Element createDesign(String key, String value) { Attributes attributes = new Attributes(); attributes.put(key, value); - Element node = new Element(Tag.valueOf("v-label"), "", attributes); + Element node = new Element(Tag.valueOf("vaadin-label"), "", attributes); return node; } diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java index b4afde5923..a4ed0d364f 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java @@ -33,7 +33,7 @@ public class AbstractFieldDeclarativeTest extends @Test public void testPlainText() { - String design = ""; AbstractField tf = new TextField(); @@ -61,7 +61,7 @@ public class AbstractFieldDeclarativeTest extends public void testModelReadOnly() { // Test that read only value coming from property data source is not // written to design. - String design = ""; + String design = ""; AbstractField component = new TextField(); ObjectProperty property = new ObjectProperty("test"); property.setReadOnly(true); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java index 28ccfa407c..b23083ab05 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java @@ -42,7 +42,7 @@ public class AbstractOrderedLayoutDeclarativeTest extends @Test public void testMargins() { - testMargins("v-vertical-layout"); + testMargins("vaadin-vertical-layout"); } @Test @@ -74,8 +74,8 @@ public class AbstractOrderedLayoutDeclarativeTest extends } private String getDesign(float expandRatio, String... alignments) { - String result = ""; - result += " { public String getDesignSingleSelectNewItemsAllowed() { - return ""; } @@ -58,7 +58,7 @@ public class AbstractSelectDeclarativeTest extends } public String getDesignMultiSelect() { - return ""; + return ""; } public AbstractSelect getExpectedMultiSelect() { @@ -99,8 +99,8 @@ public class AbstractSelectDeclarativeTest extends @Test(expected = DesignException.class) public void testReadMultipleValuesForSingleSelect() { - testRead("" + "" - + "" + "", null); + testRead("" + "" + + "" + "", null); } @Test @@ -111,8 +111,9 @@ public class AbstractSelectDeclarativeTest extends ls.addItem("2"); ls.select("1"); ls.select("2"); - testRead("" + "" - + "" + "", ls); + testRead("" + + "" + "" + + "", ls); } @Test @@ -122,8 +123,9 @@ public class AbstractSelectDeclarativeTest extends ls.addItem("1"); ls.addItem("2"); ls.select("1"); - testRead("" + "" - + "" + "", ls); + testRead("" + + "" + "" + + "", ls); } @Test @@ -133,8 +135,8 @@ public class AbstractSelectDeclarativeTest extends ls.addItem("1"); ls.addItem("2"); ls.select("1"); - testRead("" + "" - + "" + "", ls); + testRead("" + "" + + "" + "", ls); } @Test @@ -151,10 +153,10 @@ public class AbstractSelectDeclarativeTest extends } private String getDesignForInlineData() { - return "\n" + return "\n" + " \n" // + " \n"// - + ""; + + ""; } private AbstractSelect getExpectedComponentForInlineData() { @@ -213,7 +215,7 @@ public class AbstractSelectDeclarativeTest extends attributes.put("item-icon-property-id", "icon"); attributes.put("null-selection-allowed", ""); attributes.put("null-selection-item-id", "No items selected"); - return new Element(Tag.valueOf("v-combo-box"), "", attributes); + return new Element(Tag.valueOf("vaadin-combo-box"), "", attributes); } private Element createDesignWithAttributesMultiSelect() { @@ -221,13 +223,13 @@ public class AbstractSelectDeclarativeTest extends attributes.put("multi-select", ""); attributes.put("item-caption-mode", "EXPLICIT"); attributes.put("null-selection-allowed", "false"); - return new Element(Tag.valueOf("v-list-select"), "", attributes); + return new Element(Tag.valueOf("vaadin-list-select"), "", attributes); } @Test public void testWriteAttributesSingleSelect() { ComboBox cb = createSingleSelectWithOnlyAttributes(); - Element e = new Element(Tag.valueOf("v-combo-box"), ""); + Element e = new Element(Tag.valueOf("vaadin-combo-box"), ""); cb.writeDesign(e, new DesignContext()); assertEquals("Wrong caption for the combo box.", "A combo box", e.attr("caption")); @@ -248,7 +250,7 @@ public class AbstractSelectDeclarativeTest extends @Test public void testWriteMultiListSelect() { ListSelect ls = createMultiSelect(); - Element e = new Element(Tag.valueOf("v-list-select"), ""); + Element e = new Element(Tag.valueOf("vaadin-list-select"), ""); ls.writeDesign(e, new DesignContext()); assertEquals("Null selection should not be allowed.", "false", e.attr("null-selection-allowed")); @@ -260,9 +262,9 @@ public class AbstractSelectDeclarativeTest extends @Test public void testHtmlEntities() { - String design = "" + String design = "" + " " - + " " + ""; + + " " + ""; AbstractSelect read = read(design); Assert.assertEquals("> One", read.getItemCaption("one")); @@ -270,7 +272,7 @@ public class AbstractSelectDeclarativeTest extends AbstractSelect underTest = new ComboBox(); underTest.addItem("> One"); - Element root = new Element(Tag.valueOf("v-combo-box"), ""); + Element root = new Element(Tag.valueOf("vaadin-combo-box"), ""); DesignContext dc = new DesignContext(); dc.setShouldWriteDataDelegate(DeclarativeTestBaseBase.ALWAYS_WRITE_DATA); underTest.writeDesign(root, dc); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java b/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java index 3e6a7a15cb..92a8c12a9a 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java @@ -35,7 +35,7 @@ public class OptionGroupDeclarativeTests extends @Test public void testBasicSyntax() { - String expected = ""; + String expected = ""; testReadWrite(expected); } @@ -47,12 +47,12 @@ public class OptionGroupDeclarativeTests extends //@formatter:off String expected = - "" + "" + "" + "" + "" + "" - + ""; + + ""; //@formatter:on testReadWrite(expected); @@ -67,12 +67,12 @@ public class OptionGroupDeclarativeTests extends //@formatter:off String expected = - "" + "" + "" + "" + "" + "" - + ""; + + ""; //@formatter:on testReadWrite(expected); @@ -87,12 +87,12 @@ public class OptionGroupDeclarativeTests extends //@formatter:off String expected = - "" + "" + "" + "" + "" + "" - + ""; + + ""; //@formatter:on testReadWrite(expected); @@ -111,12 +111,12 @@ public class OptionGroupDeclarativeTests extends //@formatter:off String expected = - "" + "" + "" + "" + "" + "" - + ""; + + ""; //@formatter:on testReadWrite(expected); @@ -131,13 +131,13 @@ public class OptionGroupDeclarativeTests extends og.setItemCaption("bar", "False"); //@formatter:off - String expected = - "" + String expected = + "" + "" + "" + "" + "" - + ""; + + ""; //@formatter:on testReadWrite(expected); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java index 11d97d191b..3ac8416762 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java @@ -37,10 +37,10 @@ public class AbstractSplitPanelDeclarativeTest extends @Test public void testWithBothChildren() { - String design = " " - + ""; + + "reversed=\"\"> " + + ""; AbstractSplitPanel sp = new HorizontalSplitPanel(); sp.setSplitPosition(20.5f, Unit.PERCENTAGE, true); sp.setMinSplitPosition(20, Unit.PERCENTAGE); @@ -54,8 +54,8 @@ public class AbstractSplitPanelDeclarativeTest extends @Test public void testWithFirstChild() { - String design = "" - + ""; + String design = "" + + ""; AbstractSplitPanel sp = new VerticalSplitPanel(); Table t = new Table(); t.setCaption("First slot"); @@ -66,8 +66,8 @@ public class AbstractSplitPanelDeclarativeTest extends @Test public void testWithSecondChild() { - String design = "Second slot" - + ""; + String design = "Second slot" + + ""; AbstractSplitPanel sp = new HorizontalSplitPanel(); Button b = new Button("Second slot"); b.setCaptionAsHtml(true); @@ -78,7 +78,7 @@ public class AbstractSplitPanelDeclarativeTest extends @Test public void testEmpty() { - String design = ""; + String design = ""; AbstractSplitPanel sp = new HorizontalSplitPanel(); testRead(design, sp); testWrite(design, sp); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java index b8e570bc89..4d6411845e 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java @@ -33,7 +33,7 @@ public class AbstractTextFieldDeclarativeTest extends @Test public void testAttributes() { - String design = ""; diff --git a/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java index ec2b5241f3..d1143ff0c1 100644 --- a/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java @@ -35,7 +35,7 @@ public class AudioDeclarativeTest extends DeclarativeTestBase