From 1011cff7e8139cd1b7138b2e538264c755c7482f Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Wed, 23 Sep 2015 16:28:28 +0300 Subject: Use "vaadin-" as default prefix for Design (#18957) Change-Id: Ic9e0650e5c8e305258cbce033c4ef3f33307bf0f --- .../DragAndDropWrapperDeclarativeTest.java | 12 +- .../components/menubar/MenuBarDeclarativeTest.java | 12 +- .../design/AbstractComponentSetResponsiveTest.java | 2 +- .../vaadin/tests/design/ComponentFactoryTest.java | 6 +- .../tests/design/DesignContextLocalIdTest.java | 4 +- .../tests/design/DesignReadInConstructor.html | 10 +- .../com/vaadin/tests/design/InvalidTagNames.java | 18 +-- .../src/com/vaadin/tests/design/LocaleTest.java | 10 +- .../com/vaadin/tests/design/ParseLayoutTest.java | 14 +-- .../vaadin/tests/design/ParseLegacyPrefixTest.java | 46 ++++++++ .../design/ParseMixedLegacyAndNewPrefixTest.java | 35 ++++++ .../vaadin/tests/design/WriteLegacyDesignTest.java | 102 ++++++++++++++++ .../vaadin/tests/design/all-components-legacy.html | 122 ++++++++++++++++++++ .../com/vaadin/tests/design/all-components.html | 128 ++++++++++----------- .../designroot/DesignWithEmptyAnnotation.html | 10 +- .../src/com/vaadin/tests/design/duplicate-ids.html | 8 +- .../vaadin/tests/design/duplicate-local-ids.html | 8 +- .../src/com/vaadin/tests/design/local-ids.html | 8 +- .../design/nested/WriteNestedTemplatesTest.java | 12 +- .../vaadin/tests/design/nested/mychilddesign.html | 6 +- .../vaadin/tests/design/nested/mydesignroot.html | 4 +- .../com/vaadin/tests/design/testFile-legacy.html | 19 +++ .../src/com/vaadin/tests/design/testFile.html | 22 ++-- .../tests/design/verticallayout-one-child.html | 6 +- .../tests/design/verticallayout-two-children.html | 8 +- .../AbsoluteLayoutDeclarativeTest.java | 10 +- .../AbstractComponentDeclarativeTest.java | 34 +++--- .../AbstractFieldDeclarativeTest.java | 4 +- .../AbstractOrderedLayoutDeclarativeTest.java | 10 +- .../AbstractSelectDeclarativeTest.java | 40 ++++--- .../OptionGroupDeclarativeTests.java | 24 ++-- .../AbstractSplitPanelDeclarativeTest.java | 16 +-- .../AbstractTextFieldDeclarativeTest.java | 2 +- .../component/audio/AudioDeclarativeTest.java | 6 +- .../component/audio/VideoDeclarativeTest.java | 6 +- .../browserframe/BrowserFrameDeclarativeTest.java | 4 +- .../component/button/ButtonDeclarativeTest.java | 41 +++---- .../calendar/CalendarDeclarativeTest.java | 4 +- .../checkbox/CheckboxDeclarativeTest.java | 6 +- .../AbstractColorPickerDeclarativeTest.java | 8 +- .../combobox/ComboBoxDeclarativeTest.java | 8 +- .../csslayout/CssLayoutDeclarativeTest.java | 8 +- .../customlayout/CustomLayoutDeclarativeTest.java | 28 ++--- .../datefield/DateFieldDeclarativeTest.java | 6 +- .../datefield/PopupDateFieldDeclarativeTest.java | 2 +- .../component/flash/FlashDeclarativeTest.java | 6 +- .../declarative/GridColumnDeclarativeTest.java | 16 +-- .../declarative/GridDeclarativeAttributeTest.java | 12 +- .../GridHeaderFooterDeclarativeTest.java | 69 ++++++----- .../declarative/GridInlineDataDeclarativeTest.java | 28 ++--- .../declarative/GridStructureDeclarativeTest.java | 8 +- .../gridlayout/GridLayoutDeclarativeTest.java | 36 +++--- .../component/image/ImageDeclarativeTest.java | 4 +- .../component/label/LabelDeclarativeTest.java | 22 ++-- .../server/component/link/LinkDeclarativeTest.java | 6 +- .../listselect/ListSelectDeclarativeTest.java | 6 +- .../nativeselect/NativeSelectDeclarativeTest.java | 8 +- .../component/panel/PanelDeclarativeTest.java | 8 +- .../PasswordFieldDeclarativeTest.java | 2 +- .../popupview/PopupViewDeclarativeTest.java | 12 +- .../progressbar/ProgressBarDeclarativeTest.java | 10 +- .../richtextarea/RichTextAreaDeclarativeTest.java | 10 +- .../component/slider/SliderDeclarativeTest.java | 8 +- .../component/table/TableDeclarativeTestBase.java | 2 +- .../tabsheet/TabSheetDeclarativeTest.java | 12 +- .../textarea/TextAreaDeclarativeTest.java | 8 +- .../textfield/TextFieldDeclarativeTest.java | 6 +- .../server/component/tree/TreeDeclarativeTest.java | 10 +- .../treetable/TreeTableDeclarativeTest.java | 16 +-- .../TwinColSelectDeclarativeTest.java | 8 +- .../component/upload/UploadDeclarativeTest.java | 6 +- .../component/window/WindowDeclarativeTest.java | 24 ++-- .../src/com/vaadin/ui/declarative/DesignTest.java | 2 +- 73 files changed, 804 insertions(+), 460 deletions(-) create mode 100644 server/tests/src/com/vaadin/tests/design/ParseLegacyPrefixTest.java create mode 100644 server/tests/src/com/vaadin/tests/design/ParseMixedLegacyAndNewPrefixTest.java create mode 100644 server/tests/src/com/vaadin/tests/design/WriteLegacyDesignTest.java create mode 100644 server/tests/src/com/vaadin/tests/design/all-components-legacy.html create mode 100644 server/tests/src/com/vaadin/tests/design/testFile-legacy.html (limited to 'server/tests/src') 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