Change-Id: Ic9e0650e5c8e305258cbce033c4ef3f33307bf0ftags/7.6.0.alpha7
@@ -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"; |
@@ -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 | |||
// <v-button--> will be resolved to <v-button> | |||
// <v--button> will be resolved to <v-button> | |||
// <vaadin-button--> will be resolved to <vaadin-button> | |||
// <vaadin--button> will be resolved to <vaadin-button> | |||
className += SharedUtil.capitalize(classNamePart); | |||
} | |||
String qualifiedClassName = packageName + "." + className; |
@@ -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<Class<?>, Component> instanceCache = new ConcurrentHashMap<Class<?>, Component>(); | |||
@@ -67,23 +82,24 @@ public class DesignContext implements Serializable { | |||
// namespace mappings | |||
private Map<String, String> packageToPrefix = new HashMap<String, String>(); | |||
private Map<String, String> prefixToPackage = new HashMap<String, String>(); | |||
// 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<String, String> defaultPrefixes = new HashMap<String, String>(); | |||
// component creation listeners | |||
private List<ComponentCreationListener> listeners = new ArrayList<ComponentCreationListener>(); | |||
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. | |||
* |
@@ -29,9 +29,9 @@ public class DragAndDropWrapperDeclarativeTest extends | |||
@Test | |||
public void testDefaultDnDWrapper() { | |||
Button okButton = new Button("OK"); | |||
String input = "<v-drag-and-drop-wrapper>" | |||
String input = "<vaadin-drag-and-drop-wrapper>" | |||
+ new DesignContext().createElement(okButton) | |||
+ "</v-drag-and-drop-wrapper>"; | |||
+ "</vaadin-drag-and-drop-wrapper>"; | |||
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 = "<v-drag-and-drop-wrapper drag-start-mode='wrapper'>" | |||
String input = "<vaadin-drag-and-drop-wrapper drag-start-mode='wrapper'>" | |||
+ new DesignContext().createElement(okButton) | |||
+ "</v-drag-and-drop-wrapper>"; | |||
+ "</vaadin-drag-and-drop-wrapper>"; | |||
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 = "<v-drag-and-drop-wrapper drag-start-mode='component_other'>" | |||
String input = "<vaadin-drag-and-drop-wrapper drag-start-mode='component_other'>" | |||
+ new DesignContext().createElement(okButton) | |||
+ new DesignContext().createElement(dragImage).attr( | |||
":drag-image", "") + "</v-drag-and-drop-wrapper>"; | |||
":drag-image", "") + "</vaadin-drag-and-drop-wrapper>"; | |||
DragAndDropWrapper wrapper = new DragAndDropWrapper(okButton); | |||
wrapper.setDragStartMode(DragStartMode.COMPONENT_OTHER); | |||
wrapper.setDragImageComponent(dragImage); |
@@ -38,14 +38,14 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> { | |||
@Test | |||
// #16328 | |||
public void testReadWrite() throws IOException { | |||
String design = "<v-menu-bar auto-open='' tabindex=5>" | |||
String design = "<vaadin-menu-bar auto-open='' tabindex=5>" | |||
+ "<menu checkable=''>Save</menu>" | |||
+ "<menu description='Open a file'>Open</menu>" | |||
+ "<menu disabled=''>Close</menu>" | |||
+ "<menu icon='http://foo.bar/ico.png'>Help</menu>" | |||
+ "<menu visible='false'>About</menu>" | |||
+ "<menu>Sub<menu>Item</menu></menu>" | |||
+ "<menu more>WTF?!</menu>" + "</v-menu-bar>"; | |||
+ "<menu more>WTF?!</menu>" + "</vaadin-menu-bar>"; | |||
MenuBar bar = new MenuBar(); | |||
bar.setAutoOpen(true); | |||
bar.setHtmlContentAllowed(true); | |||
@@ -69,7 +69,7 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> { | |||
@Test | |||
// #16328 | |||
public void testTicketSpec1() throws IOException { | |||
String design = "<v-menu-bar auto-open='' plain-text tabindex=5> " | |||
String design = "<vaadin-menu-bar auto-open='' plain-text tabindex=5> " | |||
+ "<menu>File" | |||
+ "<menu>Save</menu>" | |||
+ "<menu icon=\"theme://../runo/icons/16/folder.png\">Open</menu>" | |||
@@ -85,7 +85,7 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> { | |||
+ "</menu>" // | |||
+ "</menu>" // | |||
+ "<menu more icon=\"theme://icon.png\">foo</menu>" | |||
+ "</v-menu-bar>"; | |||
+ "</vaadin-menu-bar>"; | |||
// 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<MenuBar> { | |||
@Test | |||
// #16328 | |||
public void testTicketSpec2() throws IOException { | |||
String design = "<v-menu-bar>" | |||
String design = "<vaadin-menu-bar>" | |||
+ "<menu><b>File</b>" | |||
+ "<menu><font style=\"color: red\">Save</font></menu>" | |||
+ "<menu icon=\"theme://../runo/icons/16/folder.png\">Open</menu>" | |||
+ "<menu separator='' />" + "<menu disabled=''>Exit</menu>" // | |||
+ "</menu></v-menu-bar>"; | |||
+ "</menu></vaadin-menu-bar>"; | |||
MenuBar menuBar = new MenuBar(); | |||
menuBar.setHtmlContentAllowed(true); | |||
MenuItem fileMenu = menuBar.addItem("<b>File</b>", null); |
@@ -29,7 +29,7 @@ public class AbstractComponentSetResponsiveTest extends | |||
label.setContentMode(ContentMode.HTML); | |||
label.setResponsive(true); | |||
String design = "<v-label responsive='' />"; | |||
String design = "<vaadin-label responsive='' />"; | |||
testWrite(design, label); | |||
testRead(design, label); |
@@ -74,7 +74,7 @@ public class ComponentFactoryTest { | |||
} | |||
}); | |||
Design.read(new ByteArrayInputStream("<v-label />".getBytes())); | |||
Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes())); | |||
Assert.assertEquals("There should be one message logged", 1, | |||
messages.size()); | |||
@@ -93,7 +93,7 @@ public class ComponentFactoryTest { | |||
} | |||
}); | |||
Design.read(new ByteArrayInputStream("<v-label />".getBytes())); | |||
Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes())); | |||
} | |||
@Test(expected = DesignException.class) | |||
@@ -108,7 +108,7 @@ public class ComponentFactoryTest { | |||
} | |||
}); | |||
Design.read(new ByteArrayInputStream("<v-label />".getBytes())); | |||
Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes())); | |||
} | |||
@Test |
@@ -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")); | |||
} | |||
} | |||
@@ -1,5 +1,5 @@ | |||
<v-vertical-layout> | |||
<v-text-field caption="First name" /> | |||
<v-text-field caption="Last name" /> | |||
<v-button>OK!</v-button> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-text-field caption="First name" /> | |||
<vaadin-text-field caption="Last name" /> | |||
<vaadin-button>OK!</vaadin-button> | |||
</vaadin-vertical-layout> |
@@ -42,7 +42,7 @@ public class InvalidTagNames { | |||
@Test(expected = DesignException.class) | |||
public void onlyPrefix() { | |||
readDesign("<v->foo</v->"); | |||
readDesign("<vaadin->foo</vaadin->"); | |||
} | |||
@Test | |||
@@ -55,7 +55,7 @@ public class InvalidTagNames { | |||
@Test(expected = DesignException.class) | |||
public void unknownClass() { | |||
readDesign("<v-unknownbutton>foo</v-unknownbutton>"); | |||
readDesign("<vaadin-unknownbutton>foo</vaadin-unknownbutton>"); | |||
} | |||
@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 <v-button> (this should not be considered API) | |||
// parsed currently as <vaadin-button> (this should not be considered API) | |||
public void tagEndsInDash() { | |||
Component c = readDesign("<v-button-></v-button->"); | |||
Component c = readDesign("<vaadin-button-></vaadin-button->"); | |||
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 <v-button> (this should not be considered API) | |||
// parsed currently as <vaadin-button> (this should not be considered API) | |||
public void tagEndsInTwoDashes() { | |||
Component c = readDesign("<v-button--></v-button-->"); | |||
Component c = readDesign("<vaadin-button--></vaadin-button-->"); | |||
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 <v-button> (this should not be considered API) | |||
// parsed currently as <vaadin-button> (this should not be considered API) | |||
public void tagWithTwoDashes() { | |||
Component c = readDesign("<v--button></v--button>"); | |||
Component c = readDesign("<vaadin--button></vaadin--button>"); | |||
Assert.assertTrue(c.getClass() == Button.class); | |||
} | |||
@Test(expected = DesignException.class) | |||
public void specialCharacters() { | |||
readDesign("<v-button-&!#></v-button-&!#>"); | |||
readDesign("<vaadin-button-&!#></vaadin-button-&!#>"); | |||
} | |||
private Component readDesign(String string) { |
@@ -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 |
@@ -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 |
@@ -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()))); | |||
} | |||
} |
@@ -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( | |||
"<v-vertical-layout><vaadin-label /></v-vertical-layout>" | |||
.getBytes())); | |||
} | |||
} |
@@ -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); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,122 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta name="package-mapping" content="my:com.addon.mypackage"/> | |||
</head> | |||
<body> | |||
<v-vertical-layout> | |||
<!-- abstract component --> | |||
<v-button primary-style-name="button" id="foo" style-name="red" caption="Some caption" icon="vaadin://themes/runo/icons/16/ok.png" description="My tooltip" error="Something went wrong" locale="en_US"></v-button> | |||
<!-- absolute layout --> | |||
<v-absolute-layout> | |||
<v-button :top="100px" :left="0px" :z-index=21>OK</v-button> | |||
<v-button :bottom="0px" :right="0px">Cancel</v-button> | |||
</v-absolute-layout> | |||
<!-- vertical layout --> | |||
<v-vertical-layout spacing margin> | |||
<v-button :top>OK</v-button> | |||
<v-table size-full :expand=1 /> | |||
</v-vertical-layout> | |||
<!-- horizontal layout --> | |||
<v-horizontal-layout spacing margin> | |||
<v-button :top>OK</v-button> | |||
<v-table size-full :expand=1 /> | |||
</v-horizontal-layout> | |||
<!-- form layout --> | |||
<v-form-layout spacing margin> | |||
<v-button :top>OK</v-button> | |||
<v-table size-full :expand=1 /> | |||
</v-form-layout> | |||
<!-- css layout --> | |||
<v-css-layout> | |||
<v-button>OK</v-button> | |||
<v-table size-full /> | |||
</v-css-layout> | |||
<!-- panel --> | |||
<v-panel caption="Hello world" tabindex=2 scroll-left="10" scroll-top="10"> | |||
<v-table size-full /> | |||
</v-panel> | |||
<!-- abstract field --> | |||
<v-text-field buffered validation-visible=false invalid-committed invalid-allowed=false required required-error="This is a required field" conversion-error="Input {0} cannot be parsed" tabindex=3 readonly /> | |||
<!-- abstract text field, text field --> | |||
<v-text-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" /> | |||
<!-- password field --> | |||
<v-password-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" /> | |||
<!-- text area --> | |||
<v-text-area rows=5 wordwrap=false >test value</v-text-area> | |||
<!-- button --> | |||
<v-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</v-button> | |||
<!-- native button --> | |||
<v-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</v-button> | |||
<!-- tabsheet --> | |||
<v-tab-sheet tabindex=5> | |||
<tab visible=false closable caption="My first tab"> | |||
<v-vertical-layout> | |||
<v-text-field/> | |||
</v-vertical-layout> | |||
</tab> | |||
<tab enabled=false caption="Disabled second tab"> | |||
<v-button>In disabled tab - can’t be shown by default</v-button> | |||
</tab> | |||
<tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId"> | |||
<v-text-field input-prompt="Icon only in tab" /> | |||
</tab> | |||
</v-tab-sheet> | |||
<!-- accordion --> | |||
<v-accordion tabindex=5> | |||
<tab visible=false closable caption="My first tab"> | |||
<v-vertical-layout> | |||
<v-text-field/> | |||
</v-vertical-layout> | |||
</tab> | |||
<tab enabled=false caption="Disabled second tab"> | |||
<v-button>In disabled tab - can’t be shown by default</v-button> | |||
</tab> | |||
<tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId"> | |||
<v-text-field input-prompt="Icon only in tab" /> | |||
</tab> | |||
</v-accordion> | |||
<!-- abstract split panel --> | |||
<v-horizontal-split-panel split-position="20px" min-split-position="0px" max-split-position="50px" locked> | |||
<v-button>First slot</v-button> | |||
</v-horizontal-split-panel> | |||
<v-vertical-split-panel split-position="25%" reversed> | |||
<v-button :second>Second slot</v-button> | |||
</v-vertical-split-panel> | |||
<v-horizontal-split-panel split-position="25%" reversed> | |||
<v-button>First slot</v-button> | |||
<v-button>Second slot</v-button> | |||
</v-horizontal-split-panel> | |||
<!-- label --> | |||
<v-label>Hello world!</v-label> | |||
<v-label>This is <b><u>Rich</u></b> content!</v-label> | |||
<v-label plain-text>This is only <b>text</b> and will contain visible tags</v-label> | |||
<!-- checkbox --> | |||
<v-check-box checked/> | |||
<!-- abstract select --> | |||
<v-list-select new-items-allowed multi-select | |||
item-caption-mode="index" | |||
null-selection-allowed=false> | |||
</v-list-select> | |||
<v-combo-box> | |||
<option icon="http://something/my-icon.png">First value</option> | |||
<option>Second value</option> | |||
</v-combo-box> | |||
</v-vertical-layout> | |||
</body> | |||
</html> |
@@ -4,119 +4,119 @@ | |||
<meta name="package-mapping" content="my:com.addon.mypackage"/> | |||
</head> | |||
<body> | |||
<v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<!-- abstract component --> | |||
<v-button primary-style-name="button" id="foo" style-name="red" caption="Some caption" icon="vaadin://themes/runo/icons/16/ok.png" description="My tooltip" error="Something went wrong" locale="en_US"></v-button> | |||
<vaadin-button primary-style-name="button" id="foo" style-name="red" caption="Some caption" icon="vaadin://themes/runo/icons/16/ok.png" description="My tooltip" error="Something went wrong" locale="en_US"></vaadin-button> | |||
<!-- absolute layout --> | |||
<v-absolute-layout> | |||
<v-button :top="100px" :left="0px" :z-index=21>OK</v-button> | |||
<v-button :bottom="0px" :right="0px">Cancel</v-button> | |||
</v-absolute-layout> | |||
<vaadin-absolute-layout> | |||
<vaadin-button :top="100px" :left="0px" :z-index=21>OK</vaadin-button> | |||
<vaadin-button :bottom="0px" :right="0px">Cancel</vaadin-button> | |||
</vaadin-absolute-layout> | |||
<!-- vertical layout --> | |||
<v-vertical-layout spacing margin> | |||
<v-button :top>OK</v-button> | |||
<v-table size-full :expand=1 /> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout spacing margin> | |||
<vaadin-button :top>OK</vaadin-button> | |||
<vaadin-table size-full :expand=1 /> | |||
</vaadin-vertical-layout> | |||
<!-- horizontal layout --> | |||
<v-horizontal-layout spacing margin> | |||
<v-button :top>OK</v-button> | |||
<v-table size-full :expand=1 /> | |||
</v-horizontal-layout> | |||
<vaadin-horizontal-layout spacing margin> | |||
<vaadin-button :top>OK</vaadin-button> | |||
<vaadin-table size-full :expand=1 /> | |||
</vaadin-horizontal-layout> | |||
<!-- form layout --> | |||
<v-form-layout spacing margin> | |||
<v-button :top>OK</v-button> | |||
<v-table size-full :expand=1 /> | |||
</v-form-layout> | |||
<vaadin-form-layout spacing margin> | |||
<vaadin-button :top>OK</vaadin-button> | |||
<vaadin-table size-full :expand=1 /> | |||
</vaadin-form-layout> | |||
<!-- css layout --> | |||
<v-css-layout> | |||
<v-button>OK</v-button> | |||
<v-table size-full /> | |||
</v-css-layout> | |||
<vaadin-css-layout> | |||
<vaadin-button>OK</vaadin-button> | |||
<vaadin-table size-full /> | |||
</vaadin-css-layout> | |||
<!-- panel --> | |||
<v-panel caption="Hello world" tabindex=2 scroll-left="10" scroll-top="10"> | |||
<v-table size-full /> | |||
</v-panel> | |||
<vaadin-panel caption="Hello world" tabindex=2 scroll-left="10" scroll-top="10"> | |||
<vaadin-table size-full /> | |||
</vaadin-panel> | |||
<!-- abstract field --> | |||
<v-text-field buffered validation-visible=false invalid-committed invalid-allowed=false required required-error="This is a required field" conversion-error="Input {0} cannot be parsed" tabindex=3 readonly /> | |||
<vaadin-text-field buffered validation-visible=false invalid-committed invalid-allowed=false required required-error="This is a required field" conversion-error="Input {0} cannot be parsed" tabindex=3 readonly /> | |||
<!-- abstract text field, text field --> | |||
<v-text-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" /> | |||
<vaadin-text-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" /> | |||
<!-- password field --> | |||
<v-password-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" /> | |||
<vaadin-password-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" /> | |||
<!-- text area --> | |||
<v-text-area rows=5 wordwrap=false >test value</v-text-area> | |||
<vaadin-text-area rows=5 wordwrap=false >test value</vaadin-text-area> | |||
<!-- button --> | |||
<v-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</v-button> | |||
<vaadin-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</vaadin-button> | |||
<!-- native button --> | |||
<v-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</v-button> | |||
<vaadin-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</vaadin-button> | |||
<!-- tabsheet --> | |||
<v-tab-sheet tabindex=5> | |||
<vaadin-tab-sheet tabindex=5> | |||
<tab visible=false closable caption="My first tab"> | |||
<v-vertical-layout> | |||
<v-text-field/> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-text-field/> | |||
</vaadin-vertical-layout> | |||
</tab> | |||
<tab enabled=false caption="Disabled second tab"> | |||
<v-button>In disabled tab - can’t be shown by default</v-button> | |||
<vaadin-button>In disabled tab - can’t be shown by default</vaadin-button> | |||
</tab> | |||
<tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId"> | |||
<v-text-field input-prompt="Icon only in tab" /> | |||
<vaadin-text-field input-prompt="Icon only in tab" /> | |||
</tab> | |||
</v-tab-sheet> | |||
</vaadin-tab-sheet> | |||
<!-- accordion --> | |||
<v-accordion tabindex=5> | |||
<vaadin-accordion tabindex=5> | |||
<tab visible=false closable caption="My first tab"> | |||
<v-vertical-layout> | |||
<v-text-field/> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-text-field/> | |||
</vaadin-vertical-layout> | |||
</tab> | |||
<tab enabled=false caption="Disabled second tab"> | |||
<v-button>In disabled tab - can’t be shown by default</v-button> | |||
<vaadin-button>In disabled tab - can’t be shown by default</vaadin-button> | |||
</tab> | |||
<tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId"> | |||
<v-text-field input-prompt="Icon only in tab" /> | |||
<vaadin-text-field input-prompt="Icon only in tab" /> | |||
</tab> | |||
</v-accordion> | |||
</vaadin-accordion> | |||
<!-- abstract split panel --> | |||
<v-horizontal-split-panel split-position="20px" min-split-position="0px" max-split-position="50px" locked> | |||
<v-button>First slot</v-button> | |||
</v-horizontal-split-panel> | |||
<v-vertical-split-panel split-position="25%" reversed> | |||
<v-button :second>Second slot</v-button> | |||
</v-vertical-split-panel> | |||
<v-horizontal-split-panel split-position="25%" reversed> | |||
<v-button>First slot</v-button> | |||
<v-button>Second slot</v-button> | |||
</v-horizontal-split-panel> | |||
<vaadin-horizontal-split-panel split-position="20px" min-split-position="0px" max-split-position="50px" locked> | |||
<vaadin-button>First slot</vaadin-button> | |||
</vaadin-horizontal-split-panel> | |||
<vaadin-vertical-split-panel split-position="25%" reversed> | |||
<vaadin-button :second>Second slot</vaadin-button> | |||
</vaadin-vertical-split-panel> | |||
<vaadin-horizontal-split-panel split-position="25%" reversed> | |||
<vaadin-button>First slot</vaadin-button> | |||
<vaadin-button>Second slot</vaadin-button> | |||
</vaadin-horizontal-split-panel> | |||
<!-- label --> | |||
<v-label>Hello world!</v-label> | |||
<v-label>This is <b><u>Rich</u></b> content!</v-label> | |||
<v-label plain-text>This is only <b>text</b> and will contain visible tags</v-label> | |||
<vaadin-label>Hello world!</vaadin-label> | |||
<vaadin-label>This is <b><u>Rich</u></b> content!</vaadin-label> | |||
<vaadin-label plain-text>This is only <b>text</b> and will contain visible tags</vaadin-label> | |||
<!-- checkbox --> | |||
<v-check-box checked/> | |||
<vaadin-check-box checked/> | |||
<!-- abstract select --> | |||
<v-list-select new-items-allowed multi-select | |||
<vaadin-list-select new-items-allowed multi-select | |||
item-caption-mode="index" | |||
null-selection-allowed=false> | |||
</v-list-select> | |||
</vaadin-list-select> | |||
<v-combo-box> | |||
<vaadin-combo-box> | |||
<option icon="http://something/my-icon.png">First value</option> | |||
<option>Second value</option> | |||
</v-combo-box> | |||
</vaadin-combo-box> | |||
</v-vertical-layout> | |||
</vaadin-vertical-layout> | |||
</body> | |||
</html> |
@@ -1,5 +1,5 @@ | |||
<v-vertical-layout> | |||
<v-button>OK</v-button> | |||
<v-button>Cancel</v-button> | |||
<v-label caption="preInitializedField">a Label that should not override pre initalized field<v-label/> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-button>OK</vaadin-button> | |||
<vaadin-button>Cancel</vaadin-button> | |||
<vaadin-label caption="preInitializedField">a Label that should not override pre initalized field<vaadin-label/> | |||
</vaadin-vertical-layout> |
@@ -1,4 +1,4 @@ | |||
<v-vertical-layout> | |||
<v-label id="foo"/> | |||
<v-label id="foo"/> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-label id="foo"/> | |||
<vaadin-label id="foo"/> | |||
</vaadin-vertical-layout> |
@@ -1,4 +1,4 @@ | |||
<v-vertical-layout> | |||
<v-label _id="foo"/> | |||
<v-label _id="foo"/> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-label _id="foo"/> | |||
<vaadin-label _id="foo"/> | |||
</vaadin-vertical-layout> |
@@ -1,4 +1,4 @@ | |||
<v-vertical-layout> | |||
<v-text-field caption="Enter your name" _id="foo"/> | |||
<v-button _id="bar">Say hello</v-button> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-text-field caption="Enter your name" _id="foo"/> | |||
<vaadin-button _id="bar">Say hello</vaadin-button> | |||
</vaadin-vertical-layout> |
@@ -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(); |
@@ -4,9 +4,9 @@ | |||
<meta name="package-mapping" content="x:com.vaadin.tests.design.nested"/> | |||
</head> | |||
<body> | |||
<v-horizontal-layout caption="Default caption for child design"> | |||
<v-label _id="childLabel">test content</v-label> | |||
<vaadin-horizontal-layout caption="Default caption for child design"> | |||
<vaadin-label _id="childLabel">test content</vaadin-label> | |||
<!-- Test some custom component in child template --> | |||
<x-my-child-design-custom-component _id="childCustomComponent">custom content</x-my-child-design-custom-component> | |||
</v-horizontal-layout> | |||
</vaadin-horizontal-layout> | |||
</body> |
@@ -4,7 +4,7 @@ | |||
<meta name="package-mapping" content="x:com.vaadin.tests.design.nested"/> | |||
</head> | |||
<body> | |||
<v-vertical-layout caption="root caption"> | |||
<vaadin-vertical-layout caption="root caption"> | |||
<x-my-extended-child-design _id="childDesign" caption="child caption"/> | |||
</v-vertical-layout> | |||
</vaadin-vertical-layout> | |||
</body> |
@@ -0,0 +1,19 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta name="package-mapping" content="my:com.addon.mypackage"/> | |||
</head> | |||
<body> | |||
<v-vertical-layout width="500px"> | |||
<v-horizontal-layout> | |||
<v-label plain-text caption="FooBar"></v-label> | |||
<v-native-button _id=firstButton>Native click me</v-native-button> | |||
<v-native-button id = secondButton _id="localID">Another button</v-native-button> | |||
<v-native-button>Yet another button</v-native-button> | |||
<v-button plain-text width = "150px">Click me</v-button> | |||
</v-horizontal-layout> | |||
<v-text-field caption = "Text input"/> | |||
<v-text-area caption = "Text area" height="200px" width="300px"/> | |||
</v-vertical-layout> | |||
</body> | |||
</html> |
@@ -4,16 +4,16 @@ | |||
<meta name="package-mapping" content="my:com.addon.mypackage"/> | |||
</head> | |||
<body> | |||
<v-vertical-layout width="500px"> | |||
<v-horizontal-layout> | |||
<v-label plain-text caption="FooBar"></v-label> | |||
<v-native-button _id=firstButton>Native click me</v-native-button> | |||
<v-native-button id = secondButton _id="localID">Another button</v-native-button> | |||
<v-native-button>Yet another button</v-native-button> | |||
<v-button plain-text width = "150px">Click me</v-button> | |||
</v-horizontal-layout> | |||
<v-text-field caption = "Text input"/> | |||
<v-text-area caption = "Text area" height="200px" width="300px"/> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout width="500px"> | |||
<vaadin-horizontal-layout> | |||
<vaadin-label plain-text caption="FooBar"></vaadin-label> | |||
<vaadin-native-button _id=firstButton>Native click me</vaadin-native-button> | |||
<vaadin-native-button id = secondButton _id="localID">Another button</vaadin-native-button> | |||
<vaadin-native-button>Yet another button</vaadin-native-button> | |||
<vaadin-button plain-text width = "150px">Click me</vaadin-button> | |||
</vaadin-horizontal-layout> | |||
<vaadin-text-field caption = "Text input"/> | |||
<vaadin-text-area caption = "Text area" height="200px" width="300px"/> | |||
</vaadin-vertical-layout> | |||
</body> | |||
</html> |
@@ -1,3 +1,3 @@ | |||
<v-vertical-layout> | |||
<v-button>OK</v-button> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-button>OK</vaadin-button> | |||
</vaadin-vertical-layout> |
@@ -1,4 +1,4 @@ | |||
<v-vertical-layout> | |||
<v-text-field caption="Enter your name" /> | |||
<v-button>Say hello</v-button> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout> | |||
<vaadin-text-field caption="Enter your name" /> | |||
<vaadin-button>Say hello</vaadin-button> | |||
</vaadin-vertical-layout> |
@@ -32,10 +32,10 @@ public class AbsoluteLayoutDeclarativeTest extends | |||
@Test | |||
public void testAbsoluteLayoutFeatures() { | |||
String design = "<v-absolute-layout caption=\"test-layout\">" | |||
+ "<v-button :top='100px' :left='0px' :z-index=21>OK</v-button>" | |||
+ "<v-button :bottom='0px' :right='0px'>Cancel</v-button>" | |||
+ "</v-absolute-layout>"; | |||
String design = "<vaadin-absolute-layout caption=\"test-layout\">" | |||
+ "<vaadin-button :top='100px' :left='0px' :z-index=21>OK</vaadin-button>" | |||
+ "<vaadin-button :bottom='0px' :right='0px'>Cancel</vaadin-button>" | |||
+ "</vaadin-absolute-layout>"; | |||
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 = "<v-absolute-layout/>"; | |||
String design = "<vaadin-absolute-layout/>"; | |||
AbsoluteLayout layout = new AbsoluteLayout(); | |||
testRead(design, layout); | |||
testWrite(design, layout); |
@@ -62,14 +62,14 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testEmptyDesign() { | |||
String design = "<v-label>"; | |||
String design = "<vaadin-label>"; | |||
testRead(design, component); | |||
testWrite(design, component); | |||
} | |||
@Test | |||
public void testProperties() { | |||
String design = "<v-label id=\"testId\" primary-style-name=\"test-style\" " | |||
String design = "<vaadin-label id=\"testId\" primary-style-name=\"test-style\" " | |||
+ "caption=\"test-caption\" locale=\"fi_FI\" description=\"test-description\" " | |||
+ "error=\"<div>test-error</div>\" 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 = { "<v-label/>", "<v-label immediate=\"false\"/>", | |||
"<v-label immediate=\"true\"/>", "<v-label immediate=\"\"/>" }; | |||
String[] design = { "<vaadin-label/>", "<vaadin-label immediate=\"false\"/>", | |||
"<vaadin-label immediate=\"true\"/>", "<vaadin-label immediate=\"\"/>" }; | |||
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 = "<v-label icon=\"http://example.com/example.gif\"/>"; | |||
String design = "<vaadin-label icon=\"http://example.com/example.gif\"/>"; | |||
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 = "<v-label icon=\"theme://example.gif\"/>"; | |||
String design = "<vaadin-label icon=\"theme://example.gif\"/>"; | |||
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 = "<v-label icon=\"img/example.gif\"/>"; | |||
String design = "<vaadin-label icon=\"img/example.gif\"/>"; | |||
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 = "<v-label width=\"70%\" height=\"12px\"/>"; | |||
String design = "<vaadin-label width=\"70%\" height=\"12px\"/>"; | |||
component.setWidth("70%"); | |||
component.setHeight("12px"); | |||
testRead(design, component); | |||
@@ -139,7 +139,7 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testSizeFull() { | |||
String design = "<v-label size-full=\"\"/>"; | |||
String design = "<vaadin-label size-full=\"\"/>"; | |||
component.setSizeFull(); | |||
testRead(design, component); | |||
testWrite(design, component); | |||
@@ -147,7 +147,7 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testSizeAuto() { | |||
String design = "<v-label size-auto=\"\"/>"; | |||
String design = "<vaadin-label size-auto=\"\"/>"; | |||
component.setSizeUndefined(); | |||
testRead(design, component); | |||
testWrite(design, component); | |||
@@ -155,7 +155,7 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testHeightFull() { | |||
String design = "<v-label height-full=\"\"/ width=\"20px\"/>"; | |||
String design = "<vaadin-label height-full=\"\"/ width=\"20px\"/>"; | |||
component.setHeight("100%"); | |||
component.setWidth("20px"); | |||
testRead(design, component); | |||
@@ -164,7 +164,7 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testHeightAuto() { | |||
String design = "<v-horizontal-split-panel height-auto=\"\"/ width=\"20px\" >"; | |||
String design = "<vaadin-horizontal-split-panel height-auto=\"\"/ width=\"20px\" >"; | |||
// 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 = "<v-button width-full=\"\"/ height=\"20px\">Foo</button>"; | |||
String design = "<vaadin-button width-full=\"\"/ height=\"20px\">Foo</button>"; | |||
AbstractComponent component = new Button(); | |||
component.setCaptionAsHtml(true); | |||
component.setCaption("Foo"); | |||
@@ -187,7 +187,7 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testWidthAuto() { | |||
String design = "<v-label height=\"20px\"/ width-auto=\"\"/>"; | |||
String design = "<vaadin-label height=\"20px\"/ width-auto=\"\"/>"; | |||
component.setCaptionAsHtml(false); | |||
component.setHeight("20px"); | |||
component.setWidth(null); | |||
@@ -197,7 +197,7 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testResponsive() { | |||
String design = "<v-label responsive =\"\"/>"; | |||
String design = "<vaadin-label responsive =\"\"/>"; | |||
Responsive.makeResponsive(component); | |||
testRead(design, component); | |||
testWrite(design, component); | |||
@@ -205,7 +205,7 @@ public class AbstractComponentDeclarativeTest extends | |||
@Test | |||
public void testResponsiveFalse() { | |||
String design = "<v-label responsive =\"false\"/>"; | |||
String design = "<vaadin-label responsive =\"false\"/>"; | |||
// 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; | |||
} | |||
@@ -33,7 +33,7 @@ public class AbstractFieldDeclarativeTest extends | |||
@Test | |||
public void testPlainText() { | |||
String design = "<v-text-field buffered='' validation-visible='false' invalid-committed=''" | |||
String design = "<vaadin-text-field buffered='' validation-visible='false' invalid-committed=''" | |||
+ " invalid-allowed='false' required='' required-error='This is a required field'" | |||
+ " conversion-error='Input {0} cannot be parsed' tabindex=3 readonly=''/>"; | |||
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 = "<v-text-field value=test></v-text-field>"; | |||
String design = "<vaadin-text-field value=test></vaadin-text-field>"; | |||
AbstractField component = new TextField(); | |||
ObjectProperty<String> property = new ObjectProperty<String>("test"); | |||
property.setReadOnly(true); |
@@ -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 = "<v-vertical-layout caption=test-layout>"; | |||
result += "<v-label caption=test-label "; | |||
String result = "<vaadin-vertical-layout caption=test-layout>"; | |||
result += "<vaadin-label caption=test-label "; | |||
String ratioString = expandRatio == 1.0f ? "\"\"" : String | |||
.valueOf(expandRatio); | |||
if (expandRatio != 0) { | |||
@@ -86,7 +86,7 @@ public class AbstractOrderedLayoutDeclarativeTest extends | |||
result += " " + alignment + "=\"\""; | |||
} | |||
} | |||
result += "></v-label><v-button "; | |||
result += "></vaadin-label><vaadin-button "; | |||
if (expandRatio != 0) { | |||
result += ":expand=" + ratioString; | |||
} | |||
@@ -95,7 +95,7 @@ public class AbstractOrderedLayoutDeclarativeTest extends | |||
result += " " + alignment + "=\"\""; | |||
} | |||
} | |||
result += "></v-button></v-vertical-layout>"; | |||
result += "></vaadin-button></vaadin-vertical-layout>"; | |||
return result; | |||
} | |||
@@ -43,7 +43,7 @@ public class AbstractSelectDeclarativeTest extends | |||
DeclarativeTestBase<AbstractSelect> { | |||
public String getDesignSingleSelectNewItemsAllowed() { | |||
return "<v-combo-box new-items-allowed='' item-caption-mode='icon_only'" | |||
return "<vaadin-combo-box new-items-allowed='' item-caption-mode='icon_only'" | |||
+ " null-selection-item-id='nullIid'/>"; | |||
} | |||
@@ -58,7 +58,7 @@ public class AbstractSelectDeclarativeTest extends | |||
} | |||
public String getDesignMultiSelect() { | |||
return "<v-list-select multi-select='' null-selection-allowed='false' new-items-allowed='' item-caption-mode='property' />"; | |||
return "<vaadin-list-select multi-select='' null-selection-allowed='false' new-items-allowed='' item-caption-mode='property' />"; | |||
} | |||
public AbstractSelect getExpectedMultiSelect() { | |||
@@ -99,8 +99,8 @@ public class AbstractSelectDeclarativeTest extends | |||
@Test(expected = DesignException.class) | |||
public void testReadMultipleValuesForSingleSelect() { | |||
testRead("<v-list-select>" + "<option selected>1</option>" | |||
+ "<option selected>2</option>" + "</v-list-select>", null); | |||
testRead("<vaadin-list-select>" + "<option selected>1</option>" | |||
+ "<option selected>2</option>" + "</vaadin-list-select>", null); | |||
} | |||
@Test | |||
@@ -111,8 +111,9 @@ public class AbstractSelectDeclarativeTest extends | |||
ls.addItem("2"); | |||
ls.select("1"); | |||
ls.select("2"); | |||
testRead("<v-list-select multi-select>" + "<option selected>1</option>" | |||
+ "<option selected>2</option>" + "</v-list-select>", ls); | |||
testRead("<vaadin-list-select multi-select>" | |||
+ "<option selected>1</option>" + "<option selected>2</option>" | |||
+ "</vaadin-list-select>", ls); | |||
} | |||
@Test | |||
@@ -122,8 +123,9 @@ public class AbstractSelectDeclarativeTest extends | |||
ls.addItem("1"); | |||
ls.addItem("2"); | |||
ls.select("1"); | |||
testRead("<v-list-select multi-select>" + "<option selected>1</option>" | |||
+ "<option>2</option>" + "</v-list-select>", ls); | |||
testRead("<vaadin-list-select multi-select>" | |||
+ "<option selected>1</option>" + "<option>2</option>" | |||
+ "</vaadin-list-select>", ls); | |||
} | |||
@Test | |||
@@ -133,8 +135,8 @@ public class AbstractSelectDeclarativeTest extends | |||
ls.addItem("1"); | |||
ls.addItem("2"); | |||
ls.select("1"); | |||
testRead("<v-list-select>" + "<option selected>1</option>" | |||
+ "<option>2</option>" + "</v-list-select>", ls); | |||
testRead("<vaadin-list-select>" + "<option selected>1</option>" | |||
+ "<option>2</option>" + "</vaadin-list-select>", ls); | |||
} | |||
@Test | |||
@@ -151,10 +153,10 @@ public class AbstractSelectDeclarativeTest extends | |||
} | |||
private String getDesignForInlineData() { | |||
return "<v-list-select>\n" | |||
return "<vaadin-list-select>\n" | |||
+ " <option icon='http://some.url/icon.png'>Value 1</option>\n" // | |||
+ " <option selected>Value 2</option>\n"// | |||
+ "</v-list-select>"; | |||
+ "</vaadin-list-select>"; | |||
} | |||
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 = "<v-combo-box>" | |||
String design = "<vaadin-combo-box>" | |||
+ " <option item-id=\"one\">> One</option>" | |||
+ " <option>> Two</option>" + "</v-combo-box>"; | |||
+ " <option>> Two</option>" + "</vaadin-combo-box>"; | |||
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); |
@@ -35,7 +35,7 @@ public class OptionGroupDeclarativeTests extends | |||
@Test | |||
public void testBasicSyntax() { | |||
String expected = "<v-option-group />"; | |||
String expected = "<vaadin-option-group />"; | |||
testReadWrite(expected); | |||
} | |||
@@ -47,12 +47,12 @@ public class OptionGroupDeclarativeTests extends | |||
//@formatter:off | |||
String expected = | |||
"<v-option-group>" | |||
"<vaadin-option-group>" | |||
+ "<option>foo</option>" | |||
+ "<option>bar</option>" | |||
+ "<option>baz</option>" | |||
+ "<option>bang</option>" | |||
+ "</v-option-group>"; | |||
+ "</vaadin-option-group>"; | |||
//@formatter:on | |||
testReadWrite(expected); | |||
@@ -67,12 +67,12 @@ public class OptionGroupDeclarativeTests extends | |||
//@formatter:off | |||
String expected = | |||
"<v-option-group>" | |||
"<vaadin-option-group>" | |||
+ "<option>foo</option>" | |||
+ "<option>bar</option>" | |||
+ "<option disabled>baz</option>" | |||
+ "<option>bang</option>" | |||
+ "</v-option-group>"; | |||
+ "</vaadin-option-group>"; | |||
//@formatter:on | |||
testReadWrite(expected); | |||
@@ -87,12 +87,12 @@ public class OptionGroupDeclarativeTests extends | |||
//@formatter:off | |||
String expected = | |||
"<v-option-group>" | |||
"<vaadin-option-group>" | |||
+ "<option>foo</option>" | |||
+ "<option icon='theme://foobar.png'>bar</option>" | |||
+ "<option>baz</option>" | |||
+ "<option>bang</option>" | |||
+ "</v-option-group>"; | |||
+ "</vaadin-option-group>"; | |||
//@formatter:on | |||
testReadWrite(expected); | |||
@@ -111,12 +111,12 @@ public class OptionGroupDeclarativeTests extends | |||
//@formatter:off | |||
String expected = | |||
"<v-option-group html-content-allowed=''>" | |||
"<vaadin-option-group html-content-allowed=''>" | |||
+ "<option item-id=\"foo\"><b>True</b></option>" | |||
+ "<option item-id=\"bar\"><font color='red'>False</font></option>" | |||
+ "<option>baz</option>" | |||
+ "<option>bang</option>" | |||
+ "</v-option-group>"; | |||
+ "</vaadin-option-group>"; | |||
//@formatter:on | |||
testReadWrite(expected); | |||
@@ -131,13 +131,13 @@ public class OptionGroupDeclarativeTests extends | |||
og.setItemCaption("bar", "<font color=\"red\">False</font>"); | |||
//@formatter:off | |||
String expected = | |||
"<v-option-group>" | |||
String expected = | |||
"<vaadin-option-group>" | |||
+ "<option item-id=\"foo\"><b>True</b></option>" | |||
+ "<option item-id=\"bar\"><font color=\"red\">False</font></option>" | |||
+ "<option>baz</option>" | |||
+ "<option>bang</option>" | |||
+ "</v-option-group>"; | |||
+ "</vaadin-option-group>"; | |||
//@formatter:on | |||
testReadWrite(expected); |
@@ -37,10 +37,10 @@ public class AbstractSplitPanelDeclarativeTest extends | |||
@Test | |||
public void testWithBothChildren() { | |||
String design = "<v-horizontal-split-panel split-position=20.5% " | |||
String design = "<vaadin-horizontal-split-panel split-position=20.5% " | |||
+ "min-split-position=20% max-split-position=50px locked='' " | |||
+ "reversed=\"\"> <v-table /> <v-vertical-layout />" | |||
+ "</v-horizontal-split-panel>"; | |||
+ "reversed=\"\"> <vaadin-table /> <vaadin-vertical-layout />" | |||
+ "</vaadin-horizontal-split-panel>"; | |||
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 = "<v-vertical-split-panel><v-table caption=\"First slot\"/>" | |||
+ "</v-vertical-split-panel>"; | |||
String design = "<vaadin-vertical-split-panel><vaadin-table caption=\"First slot\"/>" | |||
+ "</vaadin-vertical-split-panel>"; | |||
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 = "<v-horizontal-split-panel><v-button :second>Second slot</v-button>" | |||
+ "</v-vertical-split-panel>"; | |||
String design = "<vaadin-horizontal-split-panel><vaadin-button :second>Second slot</vaadin-button>" | |||
+ "</vaadin-vertical-split-panel>"; | |||
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 = "<v-horizontal-split-panel/>"; | |||
String design = "<vaadin-horizontal-split-panel/>"; | |||
AbstractSplitPanel sp = new HorizontalSplitPanel(); | |||
testRead(design, sp); | |||
testWrite(design, sp); |
@@ -33,7 +33,7 @@ public class AbstractTextFieldDeclarativeTest extends | |||
@Test | |||
public void testAttributes() { | |||
String design = "<v-text-field null-representation=this-is-null " | |||
String design = "<vaadin-text-field null-representation=this-is-null " | |||
+ "null-setting-allowed='' maxlength=5 columns=3 " | |||
+ "input-prompt=input text-change-event-mode=eager " | |||
+ "text-change-timeout=100 />"; |
@@ -35,7 +35,7 @@ public class AudioDeclarativeTest extends DeclarativeTestBase<Audio> { | |||
@Test | |||
public void testEmptyAudio() { | |||
String design = "<v-audio />"; | |||
String design = "<vaadin-audio />"; | |||
Audio audio = new Audio(); | |||
testRead(design, audio); | |||
testWrite(design, audio); | |||
@@ -43,12 +43,12 @@ public class AudioDeclarativeTest extends DeclarativeTestBase<Audio> { | |||
@Test | |||
public void testAudioMultipleSources() { | |||
String design = "<v-audio muted='' show-controls='false'>" | |||
String design = "<vaadin-audio muted='' show-controls='false'>" | |||
+ "some <b>text</b>" // | |||
+ "<source href='http://foo.pl' />" | |||
+ "<source href='https://bar.pl' />" // | |||
+ "<source href='ohai' />" // | |||
+ "</v-audio>"; | |||
+ "</vaadin-audio>"; | |||
Audio audio = new Audio(); | |||
audio.setAltText("some <b>text</b>"); | |||
audio.setAutoplay(false); |
@@ -28,7 +28,7 @@ public class VideoDeclarativeTest extends DeclarativeTestBase<Video> { | |||
@Test | |||
public void testEmptyVideo() { | |||
String design = "<v-video />"; | |||
String design = "<vaadin-video />"; | |||
Video audio = new Video(); | |||
testRead(design, audio); | |||
testWrite(design, audio); | |||
@@ -36,13 +36,13 @@ public class VideoDeclarativeTest extends DeclarativeTestBase<Video> { | |||
@Test | |||
public void testVideoMultipleSources() { | |||
String design = "<v-video muted='' show-controls='false'>" | |||
String design = "<vaadin-video muted='' show-controls='false'>" | |||
+ "some <b>text</b>" // | |||
+ "<source href='http://foo.pl' />" | |||
+ "<source href='https://bar.pl' />" // | |||
+ "<source href='ohai' />" // | |||
+ "<poster href='http://foo.pl/poster' />" // | |||
+ "</v-video>"; | |||
+ "</vaadin-video>"; | |||
Video video = new Video(); | |||
video.setAltText("some <b>text</b>"); | |||
video.setAutoplay(false); |
@@ -31,7 +31,7 @@ public class BrowserFrameDeclarativeTest extends | |||
DeclarativeTestBase<BrowserFrame> { | |||
protected String getDesign() { | |||
return "<v-browser-frame source='http://foo.bar/some.html' />"; | |||
return "<vaadin-browser-frame source='http://foo.bar/some.html' />"; | |||
} | |||
protected BrowserFrame getExpectedResult() { | |||
@@ -52,6 +52,6 @@ public class BrowserFrameDeclarativeTest extends | |||
@Test | |||
public void testEmpty() { | |||
testRead("<v-browser-frame/>", new BrowserFrame()); | |||
testRead("<vaadin-browser-frame/>", new BrowserFrame()); | |||
} | |||
} |
@@ -38,73 +38,74 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> { | |||
@Test | |||
public void testEmptyPlainText() { | |||
String design = "<v-button plain-text=''></v-button>"; | |||
String design = "<vaadin-button plain-text=''></vaadin-button>"; | |||
testButtonAndNativeButton(design, false, ""); | |||
} | |||
@Test | |||
public void testPlainTextCaption() { | |||
String design = "<v-button plain-text=''>Click</v-button>"; | |||
String design = "<vaadin-button plain-text=''>Click</vaadin-button>"; | |||
testButtonAndNativeButton(design, false, "Click"); | |||
} | |||
@Test | |||
public void testEmptyHtml() { | |||
String design = "<v-button />"; | |||
String design = "<vaadin-button />"; | |||
testButtonAndNativeButton(design, true, ""); | |||
} | |||
@Test | |||
public void testHtmlCaption() { | |||
String design = "<v-button><b>Click</b></v-button>"; | |||
String design = "<vaadin-button><b>Click</b></vaadin-button>"; | |||
testButtonAndNativeButton(design, true, "<b>Click</b>"); | |||
} | |||
@Test | |||
public void testWithCaptionAttribute() { | |||
// The caption attribute should be ignored | |||
String design = "<v-button caption=Caption>Click</v-button>"; | |||
String expectedWritten = "<v-button>Click</v-button>"; | |||
String design = "<vaadin-button caption=Caption>Click</vaadin-button>"; | |||
String expectedWritten = "<vaadin-button>Click</vaadin-button>"; | |||
testButtonAndNativeButton(design, true, "Click", expectedWritten); | |||
} | |||
@Test | |||
public void testWithOnlyCaptionAttribute() { | |||
String design = "<v-button caption=Click/>"; | |||
String expectedWritten = "<v-button/>"; | |||
String design = "<vaadin-button caption=Click/>"; | |||
String expectedWritten = "<vaadin-button/>"; | |||
testButtonAndNativeButton(design, true, "", expectedWritten); | |||
} | |||
@Test | |||
public void testHtmlEntitiesInCaption() { | |||
String designPlainText = "<v-button plain-text=\"true\">> One</v-button>"; | |||
String designPlainText = "<vaadin-button plain-text=\"true\">> One</vaadin-button>"; | |||
String expectedCaptionPlainText = "> One"; | |||
Button read = read(designPlainText); | |||
Assert.assertEquals(expectedCaptionPlainText, read.getCaption()); | |||
designPlainText = designPlainText | |||
.replace("v-button", "v-native-button"); | |||
designPlainText = designPlainText.replace("vaadin-button", | |||
"vaadin-native-button"); | |||
Button nativeButton = read(designPlainText); | |||
Assert.assertEquals(expectedCaptionPlainText, nativeButton.getCaption()); | |||
String designHtml = "<v-button>> One</v-button>"; | |||
String designHtml = "<vaadin-button>> One</vaadin-button>"; | |||
String expectedCaptionHtml = "> One"; | |||
read = read(designHtml); | |||
Assert.assertEquals(expectedCaptionHtml, read.getCaption()); | |||
designHtml = designHtml.replace("v-button", "v-native-button"); | |||
designHtml = designHtml | |||
.replace("vaadin-button", "vaadin-native-button"); | |||
nativeButton = read(designHtml); | |||
Assert.assertEquals(expectedCaptionHtml, nativeButton.getCaption()); | |||
read = new Button("& Test"); | |||
read.setHtmlContentAllowed(true); | |||
Element root = new Element(Tag.valueOf("v-button"), ""); | |||
Element root = new Element(Tag.valueOf("vaadin-button"), ""); | |||
read.writeDesign(root, new DesignContext()); | |||
assertEquals("& Test", root.html()); | |||
read.setHtmlContentAllowed(false); | |||
root = new Element(Tag.valueOf("v-button"), ""); | |||
root = new Element(Tag.valueOf("vaadin-button"), ""); | |||
read.writeDesign(root, new DesignContext()); | |||
assertEquals("&amp; Test", root.html()); | |||
@@ -124,9 +125,9 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> { | |||
testRead(expectedWritten, b); | |||
testWrite(expectedWritten, b); | |||
// Test NativeButton | |||
design = design.replace("v-button", "v-native-button"); | |||
expectedWritten = expectedWritten | |||
.replace("v-button", "v-native-button"); | |||
design = design.replace("vaadin-button", "vaadin-native-button"); | |||
expectedWritten = expectedWritten.replace("vaadin-button", | |||
"vaadin-native-button"); | |||
NativeButton nb = new NativeButton(); | |||
nb.setCaptionAsHtml(html); | |||
nb.setCaption(caption); | |||
@@ -136,8 +137,8 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> { | |||
@Test | |||
public void testAttributes() { | |||
String design = "<v-button tabindex=3 plain-text='' icon-alt=OK " | |||
+ "click-shortcut=shift-ctrl-o></v-button>"; | |||
String design = "<vaadin-button tabindex=3 plain-text='' icon-alt=OK " | |||
+ "click-shortcut=shift-ctrl-o></vaadin-button>"; | |||
Button b = new Button(""); | |||
b.setTabIndex(3); | |||
b.setIconAlternateText("OK"); |
@@ -30,12 +30,12 @@ public class CalendarDeclarativeTest extends DeclarativeTestBase<Calendar> { | |||
@Test | |||
public void testEmpty() { | |||
verifyDeclarativeDesign("<v-calendar></v-calendar>", new Calendar()); | |||
verifyDeclarativeDesign("<vaadin-calendar></vaadin-calendar>", new Calendar()); | |||
} | |||
@Test | |||
public void testCalendarAllFeatures() throws ParseException { | |||
String design = "<v-calendar start-date='2014-11-17' end-date='2014-11-23' " | |||
String design = "<vaadin-calendar start-date='2014-11-17' end-date='2014-11-23' " | |||
+ "first-visible-day-of-week=2 last-visible-day-of-week=5 " | |||
+ "time-zone='EST' time-format='12h' first-visible-hour-of-day=8 " | |||
+ "last-visible-hour-of-day=18 weekly-caption-format='mmm MM/dd' />"; |
@@ -30,7 +30,7 @@ public class CheckboxDeclarativeTest extends DeclarativeTestBase<CheckBox> { | |||
@Test | |||
public void testChecked() { | |||
String design = "<v-check-box />"; | |||
String design = "<vaadin-check-box />"; | |||
CheckBox checkBox = new CheckBox(); | |||
testRead(design, checkBox); | |||
testWrite(design, checkBox); | |||
@@ -38,7 +38,7 @@ public class CheckboxDeclarativeTest extends DeclarativeTestBase<CheckBox> { | |||
@Test | |||
public void testUnchecked() { | |||
String design = "<v-check-box checked='' />"; | |||
String design = "<vaadin-check-box checked='' />"; | |||
CheckBox checkBox = new CheckBox(); | |||
checkBox.setValue(true); | |||
testRead(design, checkBox); | |||
@@ -47,7 +47,7 @@ public class CheckboxDeclarativeTest extends DeclarativeTestBase<CheckBox> { | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-check-box readonly checked='' />"; | |||
String design = "<vaadin-check-box readonly checked='' />"; | |||
CheckBox checkBox = new CheckBox(); | |||
checkBox.setValue(true); | |||
checkBox.setReadOnly(true); |
@@ -29,7 +29,7 @@ public class AbstractColorPickerDeclarativeTest extends | |||
@Test | |||
public void testAllAbstractColorPickerFeatures() { | |||
String design = "<v-color-picker color='#fafafa' default-caption-enabled='' position='100,100'" | |||
String design = "<vaadin-color-picker color='#fafafa' default-caption-enabled='' position='100,100'" | |||
+ " popup-style='simple' rgb-visibility='false' hsv-visibility='false'" | |||
+ " history-visibility=false textfield-visibility=false />"; | |||
ColorPicker colorPicker = new ColorPicker(); | |||
@@ -50,7 +50,7 @@ public class AbstractColorPickerDeclarativeTest extends | |||
@Test | |||
public void testEmptyColorPicker() { | |||
String design = "<v-color-picker />"; | |||
String design = "<vaadin-color-picker />"; | |||
ColorPicker colorPicker = new ColorPicker(); | |||
testRead(design, colorPicker); | |||
testWrite(design, colorPicker); | |||
@@ -58,7 +58,7 @@ public class AbstractColorPickerDeclarativeTest extends | |||
@Test | |||
public void testAllAbstractColorPickerAreaFeatures() { | |||
String design = "<v-color-picker-area color='#fafafa' default-caption-enabled='' position='100,100'" | |||
String design = "<vaadin-color-picker-area color='#fafafa' default-caption-enabled='' position='100,100'" | |||
+ " popup-style='simple' rgb-visibility='false' hsv-visibility='false'" | |||
+ " history-visibility=false textfield-visibility=false />"; | |||
AbstractColorPicker colorPicker = new ColorPickerArea(); | |||
@@ -79,7 +79,7 @@ public class AbstractColorPickerDeclarativeTest extends | |||
@Test | |||
public void testEmptyColorPickerArea() { | |||
String design = "<v-color-picker-area />"; | |||
String design = "<vaadin-color-picker-area />"; | |||
AbstractColorPicker colorPicker = new ColorPickerArea(); | |||
testRead(design, colorPicker); | |||
testWrite(design, colorPicker); |
@@ -38,7 +38,7 @@ public class ComboBoxDeclarativeTest extends DeclarativeTestBase<ComboBox> { | |||
} | |||
private String getReadOnlyWithOptionsDesign() { | |||
return "<v-combo-box text-input-allowed='false'><option>Hello</option><option>World</option></v-combo-box>"; | |||
return "<vaadin-combo-box text-input-allowed='false'><option>Hello</option><option>World</option></vaadin-combo-box>"; | |||
} | |||
@Test | |||
@@ -59,7 +59,7 @@ public class ComboBoxDeclarativeTest extends DeclarativeTestBase<ComboBox> { | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-combo-box readonly value='foo'><option selected>foo</option></v-combo-box>"; | |||
String design = "<vaadin-combo-box readonly value='foo'><option selected>foo</option></vaadin-combo-box>"; | |||
ComboBox comboBox = new ComboBox(); | |||
comboBox.addItems("foo", "bar"); | |||
@@ -69,12 +69,12 @@ public class ComboBoxDeclarativeTest extends DeclarativeTestBase<ComboBox> { | |||
testRead(design, comboBox); | |||
// Selects items are not written out by default | |||
String design2 = "<v-combo-box readonly></v-combo-box>"; | |||
String design2 = "<vaadin-combo-box readonly></vaadin-combo-box>"; | |||
testWrite(design2, comboBox); | |||
} | |||
private String getBasicDesign() { | |||
return "<v-combo-box input-prompt=\"Select something\" filtering-mode=\"off\" scroll-to-selected-item='false'>"; | |||
return "<vaadin-combo-box input-prompt=\"Select something\" filtering-mode=\"off\" scroll-to-selected-item='false'>"; | |||
} | |||
private ComboBox getBasicExpected() { |
@@ -33,11 +33,11 @@ public class CssLayoutDeclarativeTest extends DeclarativeTestBase<CssLayout> { | |||
@Test | |||
public void testNoChildren() { | |||
String design = "<v-css-layout />"; | |||
String design = "<vaadin-css-layout />"; | |||
CssLayout layout = new CssLayout(); | |||
testRead(design, layout); | |||
testWrite(design, layout); | |||
design = "<v-css-layout caption=\"A caption\"/>"; | |||
design = "<vaadin-css-layout caption=\"A caption\"/>"; | |||
layout = new CssLayout(); | |||
layout.setCaption("A caption"); | |||
testRead(design, layout); | |||
@@ -46,8 +46,8 @@ public class CssLayoutDeclarativeTest extends DeclarativeTestBase<CssLayout> { | |||
@Test | |||
public void testFeatures() { | |||
String design = "<v-css-layout caption=test-layout><v-label caption=test-label />" | |||
+ "<v-button>test-button</v-button></v-css-layout>"; | |||
String design = "<vaadin-css-layout caption=test-layout><vaadin-label caption=test-label />" | |||
+ "<vaadin-button>test-button</vaadin-button></vaadin-css-layout>"; | |||
CssLayout layout = new CssLayout(); | |||
layout.setCaption("test-layout"); | |||
Label l = new Label(); |
@@ -33,17 +33,17 @@ public class CustomLayoutDeclarativeTest extends | |||
@Test | |||
public void testEmpty() { | |||
String design = "<v-custom-layout>"; | |||
String design = "<vaadin-custom-layout>"; | |||
CustomLayout expected = new CustomLayout(); | |||
test(design, expected); | |||
} | |||
@Test | |||
public void testWithChildren() { | |||
String design = "<v-custom-layout>" + // | |||
"<v-button plain-text :location='b'></v-button>" + // | |||
"<v-label plain-text :location='l'></v-label>" + // | |||
"</v-custom-layout>"; | |||
String design = "<vaadin-custom-layout>" + // | |||
"<vaadin-button plain-text :location='b'></vaadin-button>" + // | |||
"<vaadin-label plain-text :location='l'></vaadin-label>" + // | |||
"</vaadin-custom-layout>"; | |||
CustomLayout expected = new CustomLayout(); | |||
expected.addComponent(new Button(), "b"); | |||
@@ -54,7 +54,7 @@ public class CustomLayoutDeclarativeTest extends | |||
@Test | |||
public void testWithOneChild() { | |||
String design = "<v-custom-layout><v-button plain-text></v-button></v-custom-layout>"; | |||
String design = "<vaadin-custom-layout><vaadin-button plain-text></vaadin-button></vaadin-custom-layout>"; | |||
CustomLayout expected = new CustomLayout(); | |||
expected.addComponent(new Button()); | |||
@@ -64,17 +64,17 @@ public class CustomLayoutDeclarativeTest extends | |||
@Test | |||
public void testWithTemplate() { | |||
String design = "<v-custom-layout template-name='template.html'></v-custom-layout>"; | |||
String design = "<vaadin-custom-layout template-name='template.html'></vaadin-custom-layout>"; | |||
CustomLayout expected = new CustomLayout("template.html"); | |||
test(design, expected); | |||
} | |||
@Test | |||
public void testWithDuplicateLocations() { | |||
String design = "<v-custom-layout>" + // | |||
"<v-button plain-text :location='foo'></v-button>" + // | |||
"<v-label plain-text :location='foo'></v-label>" + // | |||
"</v-custom-layout>"; | |||
String design = "<vaadin-custom-layout>" + // | |||
"<vaadin-button plain-text :location='foo'></vaadin-button>" + // | |||
"<vaadin-label plain-text :location='foo'></vaadin-label>" + // | |||
"</vaadin-custom-layout>"; | |||
CustomLayout expected = new CustomLayout(); | |||
expected.addComponent(new Button(), "foo"); | |||
@@ -82,9 +82,9 @@ public class CustomLayoutDeclarativeTest extends | |||
testRead(design, expected); | |||
String written = "<v-custom-layout>" + // | |||
"<v-label plain-text :location='foo'></v-label>" + // | |||
"</v-custom-layout>"; | |||
String written = "<vaadin-custom-layout>" + // | |||
"<vaadin-label plain-text :location='foo'></vaadin-label>" + // | |||
"</vaadin-custom-layout>"; | |||
testWrite(written, expected); | |||
} |
@@ -33,7 +33,7 @@ import com.vaadin.ui.DateField; | |||
public class DateFieldDeclarativeTest extends DeclarativeTestBase<DateField> { | |||
private String getYearResolutionDesign() { | |||
return "<v-date-field resolution='year' value='2020'/>"; | |||
return "<vaadin-date-field resolution='year' value='2020'/>"; | |||
} | |||
private DateField getYearResolutionExpected() { | |||
@@ -44,7 +44,7 @@ public class DateFieldDeclarativeTest extends DeclarativeTestBase<DateField> { | |||
} | |||
private String getTimezoneDesign() { | |||
return "<v-date-field range-start=\"2014-05-05 00:00:00+0300\" range-end=\"2014-06-05 00:00:00+0300\" date-out-of-range-message=\"Please select a sensible date\" date-format=\"yyyy-MM-dd\" lenient='' show-iso-week-numbers='' parse-error-message=\"You are doing it wrong\" time-zone=\"GMT+05:00\" value=\"2014-05-15 00:00:00+0300\"/>"; | |||
return "<vaadin-date-field range-start=\"2014-05-05 00:00:00+0300\" range-end=\"2014-06-05 00:00:00+0300\" date-out-of-range-message=\"Please select a sensible date\" date-format=\"yyyy-MM-dd\" lenient='' show-iso-week-numbers='' parse-error-message=\"You are doing it wrong\" time-zone=\"GMT+05:00\" value=\"2014-05-15 00:00:00+0300\"/>"; | |||
} | |||
private DateField getTimezoneExpected() { | |||
@@ -90,7 +90,7 @@ public class DateFieldDeclarativeTest extends DeclarativeTestBase<DateField> { | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-date-field readonly resolution='year' value='2020-01-01 00:00:00+0200'/>"; | |||
String design = "<vaadin-date-field readonly resolution='year' value='2020-01-01 00:00:00+0200'/>"; | |||
DateField df = new DateField(); | |||
df.setResolution(Resolution.YEAR); | |||
df.setValue(new Date(2020 - 1900, 1 - 1, 1)); |
@@ -34,7 +34,7 @@ public class PopupDateFieldDeclarativeTest extends | |||
DeclarativeTestBase<PopupDateField> { | |||
private String getBasicDesign() { | |||
return "<v-popup-date-field assistive-text='at' text-field-enabled='false' show-iso-week-numbers resolution=\"MINUTE\" range-end=\"2019-01-15\" input-prompt=\"Pick a day\" value=\"2003-02-27 07:15\"></v-popup-date-field>"; | |||
return "<vaadin-popup-date-field assistive-text='at' text-field-enabled='false' show-iso-week-numbers resolution=\"MINUTE\" range-end=\"2019-01-15\" input-prompt=\"Pick a day\" value=\"2003-02-27 07:15\"></vaadin-popup-date-field>"; | |||
} | |||
private PopupDateField getBasicExpected() { |
@@ -43,10 +43,10 @@ public class FlashDeclarativeTest extends DeclarativeTestBase<Flash> { | |||
}; | |||
protected String getDesign() { | |||
return "<v-flash standby='Please wait' archive='arch' codebase='foo' codetype='bar' >" | |||
return "<vaadin-flash standby='Please wait' archive='arch' codebase='foo' codetype='bar' >" | |||
+ " <parameter name='baz' value='foo' />\n" // | |||
+ " <parameter name='foo' value='bar' />\n" // | |||
+ "</v-flash>"; // | |||
+ "</vaadin-flash>"; // | |||
} | |||
@Test | |||
@@ -61,7 +61,7 @@ public class FlashDeclarativeTest extends DeclarativeTestBase<Flash> { | |||
@Test | |||
public void testEmpty() { | |||
testRead("<v-flash />", new Flash()); | |||
testRead("<vaadin-flash />", new Flash()); | |||
} | |||
} |
@@ -23,7 +23,7 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testSimpleGridColumns() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" | |||
+ " <col sortable='' width='100' property-id='Column1'>" | |||
+ " <col sortable=false max-width='200' expand='2' property-id='Column2'>" | |||
@@ -32,7 +32,7 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { | |||
+ " <col sortable='' hidden='' property-id='Column5'>" | |||
+ "</colgroup>" // | |||
+ "<thead />" // | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class).setWidth(100); | |||
grid.addColumn("Column2", String.class).setMaximumWidth(200) | |||
@@ -53,14 +53,14 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testReadColumnsWithoutPropertyId() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" | |||
+ " <col sortable=true width='100' property-id='Column1'>" | |||
+ " <col sortable=true max-width='200' expand='2'>" // property-id="property-1" | |||
+ " <col sortable=true min-width='15' expand='1' property-id='Column3'>" | |||
+ " <col sortable=true hidden=true hidable=true hiding-toggle-caption='col 4'>" // property-id="property-3" | |||
+ "</colgroup>" // | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class).setWidth(100); | |||
grid.addColumn("property-1", String.class).setMaximumWidth(200) | |||
@@ -75,11 +75,11 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testReadEmptyExpand() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" | |||
+ " <col sortable=true expand />" | |||
+ "</colgroup>" // | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("property-0", String.class).setExpandRatio(1); | |||
@@ -89,11 +89,11 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testReadColumnWithNoAttributes() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" // | |||
+ " <col />" // | |||
+ "</colgroup>" // | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("property-0", String.class); |
@@ -37,7 +37,7 @@ public class GridDeclarativeAttributeTest extends DeclarativeTestBase<Grid> { | |||
@Test | |||
public void testBasicAttributes() { | |||
String design = "<v-grid editable='' rows=20 frozen-columns=-1 " | |||
String design = "<vaadin-grid editable='' rows=20 frozen-columns=-1 " | |||
+ "editor-save-caption='Tallenna' editor-cancel-caption='Peruuta' column-reordering-allowed=''>"; | |||
Grid grid = new Grid(); | |||
@@ -55,8 +55,8 @@ public class GridDeclarativeAttributeTest extends DeclarativeTestBase<Grid> { | |||
@Test | |||
public void testFrozenColumnsAttributes() { | |||
String design = "<v-grid frozen-columns='2'><table>" // | |||
+ "<colgroup><col><col><col></colgroup></table></v-grid>"; | |||
String design = "<vaadin-grid frozen-columns='2'><table>" // | |||
+ "<colgroup><col><col><col></colgroup></table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("property-0", String.class); | |||
@@ -69,15 +69,15 @@ public class GridDeclarativeAttributeTest extends DeclarativeTestBase<Grid> { | |||
@Test | |||
public void testSelectionMode() { | |||
String design = "<v-grid selection-mode='none'>"; | |||
String design = "<vaadin-grid selection-mode='none'>"; | |||
assertSame(NoSelectionModel.class, read(design).getSelectionModel() | |||
.getClass()); | |||
design = "<v-grid selection-mode='single'>"; | |||
design = "<vaadin-grid selection-mode='single'>"; | |||
assertSame(SingleSelectionModel.class, read(design).getSelectionModel() | |||
.getClass()); | |||
design = "<v-grid selection-mode='multi'>"; | |||
design = "<vaadin-grid selection-mode='multi'>"; | |||
assertSame(MultiSelectionModel.class, read(design).getSelectionModel() | |||
.getClass()); | |||
} |
@@ -33,7 +33,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testSingleDefaultHeader() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ " <col sortable='' property-id='Column2'>" | |||
@@ -45,7 +45,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
+ " <th plain-text=''>Column2</th>" | |||
+ " <th plain-text=''>Column3</tr>" | |||
+ "</thead>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class); | |||
@@ -59,7 +59,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testSingleDefaultHTMLHeader() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ " <col sortable='' property-id='Column2'>" | |||
@@ -68,7 +68,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
+ "<thead>" | |||
+ " <tr default=''><th>Column1<th>Column2<th>Column3</tr>" | |||
+ "</thead>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class); | |||
@@ -87,13 +87,14 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testNoHeaderRows() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ "</colgroup>" | |||
+ "<thead />" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class); | |||
grid.removeHeaderRow(grid.getDefaultHeaderRow()); | |||
@@ -105,7 +106,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testMultipleHeadersWithColSpans() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ " <col sortable='' property-id='Column2'>" | |||
@@ -116,8 +117,9 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
+ " <tr default=''><th>Column1<th>Column2<th>Column3</tr>" | |||
+ " <tr><th>Foo<th colspan=2>Bar</tr>" | |||
+ "</thead>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class); | |||
grid.addColumn("Column2", String.class); | |||
@@ -141,7 +143,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testSingleDefaultFooter() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ " <col sortable='' property-id='Column2'>" | |||
@@ -151,8 +153,9 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
+ "<tfoot>" | |||
+ " <tr><td plain-text=''>Column1<td plain-text=''>Column2<td plain-text=''>Column3</tr>" | |||
+ "</tfoot>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class); | |||
grid.addColumn("Column2", String.class); | |||
@@ -172,7 +175,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testSingleDefaultHTMLFooter() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ " <col sortable='' property-id='Column2'>" | |||
@@ -182,8 +185,9 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
+ "<tfoot>" | |||
+ " <tr><td>Column1<td>Column2<td>Column3</tr>" | |||
+ "</tfoot>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class); | |||
grid.addColumn("Column2", String.class); | |||
@@ -203,7 +207,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testMultipleFootersWithColSpans() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ " <col sortable='' property-id='Column2'>" | |||
@@ -215,8 +219,9 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
+ " <tr><td>Column1<td>Column2<td>Column3</tr>" | |||
+ " <tr><td>Foo<td colspan=2>Bar</tr>" | |||
+ "</tfoot>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = new Grid(); | |||
grid.addColumn("Column1", String.class); | |||
grid.addColumn("Column2", String.class); | |||
@@ -242,15 +247,16 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testComponentInGridHeader() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ "</colgroup>" | |||
+ "<thead>" | |||
+ "<tr default=''><th><v-label><b>Foo</b></v-label></tr>" | |||
+ "<tr default=''><th><vaadin-label><b>Foo</b></vaadin-label></tr>" | |||
+ "</thead>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Label component = new Label("<b>Foo</b>"); | |||
component.setContentMode(ContentMode.HTML); | |||
@@ -265,16 +271,17 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testComponentInGridFooter() { | |||
//@formatter:off | |||
String design = "<v-grid><table>" | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Column1'>" | |||
+ "</colgroup>" | |||
+ "<thead />" // No headers read or written | |||
+ "<tfoot>" | |||
+ "<tr><td><v-label><b>Foo</b></v-label></tr>" | |||
+ "<tr><td><vaadin-label><b>Foo</b></vaadin-label></tr>" | |||
+ "</tfoot>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Label component = new Label("<b>Foo</b>"); | |||
component.setContentMode(ContentMode.HTML); | |||
@@ -289,15 +296,21 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testHtmlEntitiesinGridHeaderFooter() { | |||
// @formatter off | |||
String design = "<v-grid><table>" + "<colgroup>" | |||
//@formatter:off | |||
String design = "<vaadin-grid><table>" | |||
+ "<colgroup>" | |||
+ " <col sortable=\"true\" property-id=\"> test\">" | |||
+ "</colgroup>" + "<thead>" | |||
+ "</colgroup>" | |||
+ "<thead>" | |||
+ " <tr><th plain-text=\"true\">> Test</th></tr>" | |||
+ "</thead>" + "<tfoot>" | |||
+ "</thead>" | |||
+ "<tfoot>" | |||
+ " <tr><td plain-text=\"true\">> Test</td></tr>" | |||
+ "</tfoot>" + "<tbody />" + "</table></v-grid>"; | |||
// @formatter off | |||
+ "</tfoot>" | |||
+ "<tbody />" | |||
+ "</table></vaadin-grid>"; | |||
//@formatter:on | |||
Grid grid = read(design); | |||
String actualHeader = grid.getHeaderRow(0).getCell("> test").getText(); | |||
String actualFooter = grid.getFooterRow(0).getCell("> test").getText(); | |||
@@ -325,7 +338,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
header.getCell("test").setText("& Test"); | |||
footer.getCell("test").setText("& Test"); | |||
Element root = new Element(Tag.valueOf("v-grid"), ""); | |||
Element root = new Element(Tag.valueOf("vaadin-grid"), ""); | |||
grid.writeDesign(root, new DesignContext()); | |||
Assert.assertEquals("&amp; Test", root.getElementsByTag("th") | |||
@@ -340,7 +353,7 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase { | |||
header.getCell("test").setHtml("& Test"); | |||
footer.getCell("test").setHtml("& Test"); | |||
root = new Element(Tag.valueOf("v-grid"), ""); | |||
root = new Element(Tag.valueOf("vaadin-grid"), ""); | |||
grid.writeDesign(root, new DesignContext()); | |||
Assert.assertEquals("& Test", root.getElementsByTag("th").get(0) |
@@ -25,7 +25,7 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testSimpleInlineData() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Col1' />" | |||
+ "</colgroup>" // | |||
@@ -34,8 +34,8 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase { | |||
+ "<tr><td>Foo</tr>" // | |||
+ "<tr><td>Bar</tr>" // | |||
+ "<tr><td>Baz</tr>" // | |||
+ "</tbody>" | |||
+ "</table></v-grid>"; | |||
+ "</tbody>" // | |||
+ "</table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("Col1", String.class); | |||
@@ -52,7 +52,7 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testMultipleColumnsInlineData() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Col1' />" | |||
+ " <col sortable='' property-id='Col2' />" | |||
@@ -62,8 +62,8 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase { | |||
+ "<tbody>" // | |||
+ "<tr><td>Foo<td>Bar<td>Baz</tr>" // | |||
+ "<tr><td>My<td>Summer<td>Car</tr>" // | |||
+ "</tbody>" | |||
+ "</table></v-grid>"; | |||
+ "</tbody>" // | |||
+ "</table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("Col1", String.class); | |||
@@ -81,7 +81,7 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testMultipleColumnsInlineDataReordered() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" | |||
+ " <col sortable='' property-id='Col2' />" | |||
+ " <col sortable='' property-id='Col3' />" | |||
@@ -91,8 +91,8 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase { | |||
+ "<tbody>" // | |||
+ "<tr><td>Bar<td>Baz<td>Foo</tr>" // | |||
+ "<tr><td>Summer<td>Car<td>My</tr>" // | |||
+ "</tbody>" | |||
+ "</table></v-grid>"; | |||
+ "</tbody>" // | |||
+ "</table></vaadin-grid>"; | |||
Grid grid = new Grid(); | |||
grid.addColumn("Col1", String.class); | |||
@@ -108,19 +108,19 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase { | |||
testWrite(design, grid, true); | |||
testRead(design, grid, true, true); | |||
} | |||
@Test | |||
public void testHtmlEntities() { | |||
String design = "<v-grid><table>"// | |||
String design = "<vaadin-grid><table>"// | |||
+ "<colgroup>" | |||
+ " <col property-id='test' />" | |||
+ "</colgroup>" // | |||
+ "<thead />" // No headers read or written | |||
+ "<tbody>" | |||
+ "<tbody>" // | |||
+ " <tr><td>&Test</tr></td>" | |||
+ "</tbody>" | |||
+ "</table></v-grid>"; | |||
+ "</table></vaadin-grid>"; | |||
Grid read = read(design); | |||
Container cds = read.getContainerDataSource(); | |||
Assert.assertEquals("&Test", |
@@ -24,13 +24,13 @@ public class GridStructureDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test | |||
public void testReadEmptyGrid() { | |||
String design = "<v-grid />"; | |||
String design = "<vaadin-grid />"; | |||
testRead(design, new Grid(), false); | |||
} | |||
@Test | |||
public void testEmptyGrid() { | |||
String design = "<v-grid></v-grid>"; | |||
String design = "<vaadin-grid></vaadin-grid>"; | |||
Grid expected = new Grid(); | |||
testWrite(design, expected); | |||
testRead(design, expected, true); | |||
@@ -38,13 +38,13 @@ public class GridStructureDeclarativeTest extends GridDeclarativeTestBase { | |||
@Test(expected = DesignException.class) | |||
public void testMalformedGrid() { | |||
String design = "<v-grid><v-label /></v-grid>"; | |||
String design = "<vaadin-grid><vaadin-label /></vaadin-grid>"; | |||
testRead(design, new Grid()); | |||
} | |||
@Test(expected = DesignException.class) | |||
public void testGridWithNoColGroup() { | |||
String design = "<v-grid><table><thead><tr><th>Foo</tr></thead></table></v-grid>"; | |||
String design = "<vaadin-grid><table><thead><tr><th>Foo</tr></thead></table></vaadin-grid>"; | |||
testRead(design, new Grid()); | |||
} | |||
} |
@@ -34,7 +34,7 @@ public class GridLayoutDeclarativeTest extends | |||
@Test | |||
public void testMargins() { | |||
testMargins("v-grid-layout"); | |||
testMargins("vaadin-grid-layout"); | |||
} | |||
@Test | |||
@@ -47,13 +47,13 @@ public class GridLayoutDeclarativeTest extends | |||
b2.setCaptionAsHtml(true); | |||
b3.setCaptionAsHtml(true); | |||
b4.setCaptionAsHtml(true); | |||
String design = "<v-grid-layout><row>" // | |||
String design = "<vaadin-grid-layout><row>" // | |||
+ "<column expand=1>" + writeChild(b1) + "</column>" // | |||
+ "<column expand=3>" + writeChild(b2) + "</column>" // | |||
+ "</row><row>" // | |||
+ "<column>" + writeChild(b3) + "</column>" // | |||
+ "<column>" + writeChild(b4) + "</column>" // | |||
+ "</row></v-grid-layout>"; | |||
+ "</row></vaadin-grid-layout>"; | |||
GridLayout gl = new GridLayout(2, 2); | |||
gl.addComponent(b1); | |||
gl.addComponent(b2); | |||
@@ -69,10 +69,10 @@ public class GridLayoutDeclarativeTest extends | |||
public void testOneBigComponentGridLayout() { | |||
Button b1 = new Button("Button 0,0 -> 1,1"); | |||
b1.setCaptionAsHtml(true); | |||
String design = "<v-grid-layout><row>" // | |||
String design = "<vaadin-grid-layout><row>" // | |||
+ "<column colspan=2 rowspan=2>" + writeChild(b1) + "</column>" // | |||
+ "</row><row expand=2>" // | |||
+ "</row></v-grid-layout>"; | |||
+ "</row></vaadin-grid-layout>"; | |||
GridLayout gl = new GridLayout(2, 2); | |||
gl.addComponent(b1, 0, 0, 1, 1); | |||
gl.setRowExpandRatio(1, 2); | |||
@@ -121,7 +121,7 @@ public class GridLayoutDeclarativeTest extends | |||
// 4 4 - 2 6 | |||
// - - 7 7 6 | |||
String design = "<v-grid-layout><row>" // | |||
String design = "<vaadin-grid-layout><row>" // | |||
+ "<column colspan=3>" + writeChild(b1) + "</column>" // | |||
+ "<column rowspan=4>" + writeChild(b2) + "</column>" // | |||
+ "<column rowspan=2>" + writeChild(b3) + "</column>" // | |||
@@ -135,7 +135,7 @@ public class GridLayoutDeclarativeTest extends | |||
+ "</row><row>" // | |||
+ "<column colspan=2 />" // Empty placeholder | |||
+ "<column colspan=2>" + writeChild(b7) + "</column>" // | |||
+ "</row></v-grid-layout>"; | |||
+ "</row></vaadin-grid-layout>"; | |||
testWrite(design, gl); | |||
testRead(design, gl); | |||
} | |||
@@ -148,14 +148,14 @@ public class GridLayoutDeclarativeTest extends | |||
gl.addComponent(b1, 4, 0, 4, 4); | |||
gl.setColumnExpandRatio(2, 2.0f); | |||
String design = "<v-grid-layout><row>" // | |||
String design = "<vaadin-grid-layout><row>" // | |||
+ "<column colspan=4 rowspan=5 expand='0,0,2,0' />" // | |||
+ "<column rowspan=5>" + writeChild(b1) + "</column>" // | |||
+ "</row><row>" // | |||
+ "</row><row>" // | |||
+ "</row><row>" // | |||
+ "</row><row>" // | |||
+ "</row></v-grid-layout>"; | |||
+ "</row></vaadin-grid-layout>"; | |||
testWrite(design, gl); | |||
testRead(design, gl); | |||
} | |||
@@ -168,14 +168,14 @@ public class GridLayoutDeclarativeTest extends | |||
gl.addComponent(b1, 0, 0, 0, 4); | |||
gl.setColumnExpandRatio(4, 2.0f); | |||
String design = "<v-grid-layout><row>" // | |||
String design = "<vaadin-grid-layout><row>" // | |||
+ "<column rowspan=5>" + writeChild(b1) + "</column>" // | |||
+ "<column colspan=4 rowspan=5 expand='0,0,0,2' />" // | |||
+ "</row><row>" // | |||
+ "</row><row>" // | |||
+ "</row><row>" // | |||
+ "</row><row>" // | |||
+ "</row></v-grid-layout>"; | |||
+ "</row></vaadin-grid-layout>"; | |||
testWrite(design, gl); | |||
testRead(design, gl); | |||
} | |||
@@ -183,7 +183,7 @@ public class GridLayoutDeclarativeTest extends | |||
@Test | |||
public void testEmptyGridLayout() { | |||
GridLayout gl = new GridLayout(); | |||
String design = "<v-grid-layout />"; | |||
String design = "<vaadin-grid-layout />"; | |||
testWrite(design, gl); | |||
testRead(design, gl); | |||
} | |||
@@ -214,21 +214,21 @@ public class GridLayoutDeclarativeTest extends | |||
String design = "<!DOCTYPE html>" + // | |||
"<html>" + // | |||
" <body> " + // | |||
" <v-grid-layout> " + // | |||
" <vaadin-grid-layout> " + // | |||
" <row> " + // | |||
" <column> " + // | |||
" <v-grid-layout> " + // | |||
" <vaadin-grid-layout> " + // | |||
" <row> " + // | |||
" <column> " + // | |||
" <v-button>" + // | |||
" <vaadin-button>" + // | |||
" Button " + // | |||
" </v-button> " + // | |||
" </vaadin-button> " + // | |||
" </column> " + // | |||
" </row> " + // | |||
" </v-grid-layout> " + // | |||
" </vaadin-grid-layout> " + // | |||
" </column> " + // | |||
" </row> " + // | |||
" </v-grid-layout> " + // | |||
" </vaadin-grid-layout> " + // | |||
" </body>" + // | |||
"</html>"; | |||
GridLayout outer = new GridLayout(); |
@@ -30,7 +30,7 @@ import com.vaadin.ui.Image; | |||
public class ImageDeclarativeTest extends DeclarativeTestBase<Image> { | |||
protected String getDesign() { | |||
return "<v-image source='http://foo.bar/img.png' alt='Some random image from the theme'></v-image>"; | |||
return "<vaadin-image source='http://foo.bar/img.png' alt='Some random image from the theme'></vaadin-image>"; | |||
} | |||
protected Image getExpectedResult() { | |||
@@ -52,7 +52,7 @@ public class ImageDeclarativeTest extends DeclarativeTestBase<Image> { | |||
@Test | |||
public void testEmpty() { | |||
testRead("<v-image />", new Image()); | |||
testRead("<vaadin-image />", new Image()); | |||
} | |||
} |
@@ -36,7 +36,7 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
@Test | |||
public void testEmpty() { | |||
String design = "<v-label />"; | |||
String design = "<vaadin-label />"; | |||
Label l = new Label(); | |||
l.setContentMode(ContentMode.HTML); | |||
testRead(design, l); | |||
@@ -45,7 +45,7 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
@Test | |||
public void testDefault() { | |||
String design = "<v-label>Hello world!</v-label>"; | |||
String design = "<vaadin-label>Hello world!</vaadin-label>"; | |||
Label l = createLabel("Hello world!", null, true); | |||
testRead(design, l); | |||
testWrite(design, l); | |||
@@ -53,7 +53,7 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
@Test | |||
public void testRich() { | |||
String design = "<v-label>This is <b><u>Rich</u></b> content!</v-label>"; | |||
String design = "<vaadin-label>This is <b><u>Rich</u></b> content!</vaadin-label>"; | |||
Label l = createLabel("This is \n<b><u>Rich</u></b> content!", null, | |||
true); | |||
testRead(design, l); | |||
@@ -62,8 +62,8 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
@Test | |||
public void testPlainText() { | |||
String design = "<v-label plain-text>This is only <b>text</b>" | |||
+ " and will contain visible tags</v-label>"; | |||
String design = "<vaadin-label plain-text>This is only <b>text</b>" | |||
+ " and will contain visible tags</vaadin-label>"; | |||
Label l = createLabel( | |||
"This is only <b>text</b> and will contain visible tags", null, | |||
false); | |||
@@ -73,8 +73,8 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
@Test | |||
public void testContentAndCaption() { | |||
String design = "<v-label caption='This is a label'>This is <b><u>Rich</u></b> " | |||
+ "content!</v-label>"; | |||
String design = "<vaadin-label caption='This is a label'>This is <b><u>Rich</u></b> " | |||
+ "content!</vaadin-label>"; | |||
Label l = createLabel("This is \n<b><u>Rich</u></b> content!", | |||
"This is a label", true); | |||
testRead(design, l); | |||
@@ -83,7 +83,7 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
@Test | |||
public void testCaption() { | |||
String design = "<v-label caption='This is a label' />"; | |||
String design = "<vaadin-label caption='This is a label' />"; | |||
Label l = createLabel(null, "This is a label", true); | |||
testRead(design, l); | |||
testWrite(design, l); | |||
@@ -91,7 +91,7 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
@Test | |||
public void testHtmlEntities() { | |||
String design = "<v-label plain-text=\"true\">> Test</v-label>"; | |||
String design = "<vaadin-label plain-text=\"true\">> Test</vaadin-label>"; | |||
Label read = read(design); | |||
Assert.assertEquals("> Test", read.getValue()); | |||
@@ -102,12 +102,12 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { | |||
Label label = new Label("& Test"); | |||
label.setContentMode(ContentMode.TEXT); | |||
Element root = new Element(Tag.valueOf("v-label"), ""); | |||
Element root = new Element(Tag.valueOf("vaadin-label"), ""); | |||
label.writeDesign(root, new DesignContext()); | |||
Assert.assertEquals("&amp; Test", root.html()); | |||
label.setContentMode(ContentMode.HTML); | |||
root = new Element(Tag.valueOf("v-label"), ""); | |||
root = new Element(Tag.valueOf("vaadin-label"), ""); | |||
label.writeDesign(root, new DesignContext()); | |||
Assert.assertEquals("& Test", root.html()); | |||
} |
@@ -29,7 +29,7 @@ import com.vaadin.ui.Link; | |||
*/ | |||
public class LinkDeclarativeTest extends DeclarativeTestBase<Link> { | |||
private String getBasicDesign() { | |||
return "<v-link href='http://vaadin.com' target='vaadin-window' target-height=500" | |||
return "<vaadin-link href='http://vaadin.com' target='vaadin-window' target-height=500" | |||
+ " target-width=800 target-border='none' />"; | |||
} | |||
@@ -55,12 +55,12 @@ public class LinkDeclarativeTest extends DeclarativeTestBase<Link> { | |||
@Test | |||
public void testReadEmpty() { | |||
testRead("<v-link />", new Link()); | |||
testRead("<vaadin-link />", new Link()); | |||
} | |||
@Test | |||
public void testWriteEmpty() { | |||
testWrite("<v-link />", new Link()); | |||
testWrite("<vaadin-link />", new Link()); | |||
} | |||
} |
@@ -31,8 +31,8 @@ public class ListSelectDeclarativeTest extends DeclarativeTestBase<ListSelect> { | |||
} | |||
private String getWithOptionsDesign() { | |||
return "<v-list-select rows=10>\n" + " <option>Male</option>\n" | |||
+ " <option>Female</option>\n" + "</v-list-select>\n" | |||
return "<vaadin-list-select rows=10>\n" + " <option>Male</option>\n" | |||
+ " <option>Female</option>\n" + "</vaadin-list-select>\n" | |||
+ ""; | |||
} | |||
@@ -54,7 +54,7 @@ public class ListSelectDeclarativeTest extends DeclarativeTestBase<ListSelect> { | |||
} | |||
private String getBasicDesign() { | |||
return "<v-list-select caption='Hello' />"; | |||
return "<vaadin-list-select caption='Hello' />"; | |||
} | |||
@Test |
@@ -29,7 +29,7 @@ public class NativeSelectDeclarativeTest extends | |||
DeclarativeTestBase<NativeSelect> { | |||
public String getBasicDesign() { | |||
return "<v-native-select><option>foo</option><option>bar</option></v-native-select>"; | |||
return "<vaadin-native-select><option>foo</option><option>bar</option></vaadin-native-select>"; | |||
} | |||
@@ -52,7 +52,7 @@ public class NativeSelectDeclarativeTest extends | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-native-select readonly><option selected>foo</option><option>bar</option></v-native-select>"; | |||
String design = "<vaadin-native-select readonly><option selected>foo</option><option>bar</option></vaadin-native-select>"; | |||
NativeSelect ns = new NativeSelect(); | |||
ns.addItems("foo", "bar"); | |||
@@ -62,8 +62,8 @@ public class NativeSelectDeclarativeTest extends | |||
testRead(design, ns); | |||
// Selects items are not written out by default | |||
String design2 = "<v-native-select readonly></v-native-select>"; | |||
String design2 = "<vaadin-native-select readonly></vaadin-native-select>"; | |||
testWrite(design2, ns); | |||
} | |||
} | |||
} |
@@ -32,10 +32,10 @@ public class PanelDeclarativeTest extends DeclarativeTestBase<Panel> { | |||
@Test | |||
public void testFeatures() { | |||
String design = "<v-panel id=panelId caption=\"A panel\" tabindex=2 scroll-left=10 " | |||
String design = "<vaadin-panel id=panelId caption=\"A panel\" tabindex=2 scroll-left=10 " | |||
+ "scroll-top=20 width=200px height=150px> " | |||
+ "<v-vertical-layout width=300px height=400px /> " | |||
+ "</v-panel>"; | |||
+ "<vaadin-vertical-layout width=300px height=400px /> " | |||
+ "</vaadin-panel>"; | |||
Panel p = new Panel(); | |||
p.setId("panelId"); | |||
p.setCaption("A panel"); | |||
@@ -56,7 +56,7 @@ public class PanelDeclarativeTest extends DeclarativeTestBase<Panel> { | |||
public void testWithMoreThanOneChild() { | |||
// Check that attempting to have two components in a panel causes a | |||
// DesignException. | |||
String design = "<v-panel> <v-vertical-layout/> <v-horizontal-layout/> </v-panel>"; | |||
String design = "<vaadin-panel> <vaadin-vertical-layout/> <vaadin-horizontal-layout/> </vaadin-panel>"; | |||
testRead(design, null); | |||
} | |||
} |
@@ -30,7 +30,7 @@ public class PasswordFieldDeclarativeTest extends | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-password-field readonly=\"\" value=\"test value\"/>"; | |||
String design = "<vaadin-password-field readonly=\"\" value=\"test value\"/>"; | |||
PasswordField tf = new PasswordField(); | |||
tf.setValue("test value"); | |||
tf.setReadOnly(true); |
@@ -30,9 +30,9 @@ public class PopupViewDeclarativeTest extends DeclarativeTestBase<PopupView> { | |||
public void testEmptyPopupView() { | |||
PopupView component = new PopupView(); | |||
Component popup = component.getContent().getPopupComponent(); | |||
String design = "<v-popup-view><popup-content>" | |||
String design = "<vaadin-popup-view><popup-content>" | |||
+ new DesignContext().createElement(popup) | |||
+ "</popup-content></v-popup-view>"; | |||
+ "</popup-content></vaadin-popup-view>"; | |||
testWrite(design, component); | |||
testRead(design, component); | |||
} | |||
@@ -48,12 +48,12 @@ public class PopupViewDeclarativeTest extends DeclarativeTestBase<PopupView> { | |||
component.setHideOnMouseOut(true); | |||
component.setPopupVisible(true); | |||
// hide-on-mouse-out is true by default. not seen in design | |||
String design = "<v-popup-view popup-visible=''>" // | |||
String design = "<vaadin-popup-view popup-visible=''>" // | |||
+ "Click <u>here</u> to open" | |||
+ "<popup-content>" | |||
+ new DesignContext().createElement(verticalLayout) | |||
+ "</popup-content>" // | |||
+ "</v-popup-view>"; | |||
+ "</vaadin-popup-view>"; | |||
testWrite(design, component); | |||
testRead(design, component); | |||
} | |||
@@ -63,11 +63,11 @@ public class PopupViewDeclarativeTest extends DeclarativeTestBase<PopupView> { | |||
final Label label = new Label("Foo"); | |||
PopupView component = new PopupView("Click Me!", label); | |||
component.setHideOnMouseOut(false); | |||
String design = "<v-popup-view hide-on-mouse-out='false'>" // | |||
String design = "<vaadin-popup-view hide-on-mouse-out='false'>" // | |||
+ "Click Me!" | |||
+ "<popup-content>" | |||
+ new DesignContext().createElement(label) + "</popup-content>" // | |||
+ "</v-popup-view>"; | |||
+ "</vaadin-popup-view>"; | |||
testWrite(design, component); | |||
testRead(design, component); | |||
} |
@@ -29,7 +29,7 @@ public class ProgressBarDeclarativeTest extends | |||
DeclarativeTestBase<ProgressBar> { | |||
public String getBasicDesign() { | |||
return "<v-progress-bar value=0.5 indeterminate=''>"; | |||
return "<vaadin-progress-bar value=0.5 indeterminate=''>"; | |||
} | |||
@@ -52,17 +52,17 @@ public class ProgressBarDeclarativeTest extends | |||
@Test | |||
public void testReadEmpty() { | |||
testRead("<v-progress-bar>", new ProgressBar()); | |||
testRead("<vaadin-progress-bar>", new ProgressBar()); | |||
} | |||
@Test | |||
public void testWriteEmpty() { | |||
testWrite("<v-progress-bar>", new ProgressBar()); | |||
testWrite("<vaadin-progress-bar>", new ProgressBar()); | |||
} | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-progress-bar readonly value=0.5 indeterminate=''>"; | |||
String design = "<vaadin-progress-bar readonly value=0.5 indeterminate=''>"; | |||
ProgressBar progressBar = new ProgressBar(); | |||
progressBar.setIndeterminate(true); | |||
progressBar.setValue(0.5f); | |||
@@ -72,4 +72,4 @@ public class ProgressBarDeclarativeTest extends | |||
testWrite(design, progressBar); | |||
} | |||
} | |||
} |
@@ -24,9 +24,9 @@ public class RichTextAreaDeclarativeTest extends | |||
DeclarativeTestBase<RichTextArea> { | |||
private String getBasicDesign() { | |||
return "<v-rich-text-area null-representation='' null-setting-allowed=''>\n" | |||
return "<vaadin-rich-text-area null-representation='' null-setting-allowed=''>\n" | |||
+ "\n <b>Header</b> <br/>Some text\n " | |||
+ "</v-rich-text-area>"; | |||
+ "</vaadin-rich-text-area>"; | |||
} | |||
private RichTextArea getBasicExpected() { | |||
@@ -49,17 +49,17 @@ public class RichTextAreaDeclarativeTest extends | |||
@Test | |||
public void testReadEmpty() { | |||
testRead("<v-rich-text-area />", new RichTextArea()); | |||
testRead("<vaadin-rich-text-area />", new RichTextArea()); | |||
} | |||
@Test | |||
public void testWriteEmpty() { | |||
testWrite("<v-rich-text-area />", new RichTextArea()); | |||
testWrite("<vaadin-rich-text-area />", new RichTextArea()); | |||
} | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-rich-text-area readonly style-name='v-richtextarea-readonly'>Hello World!</v-text-area>"; | |||
String design = "<vaadin-rich-text-area readonly style-name='v-richtextarea-readonly'>Hello World!</vaadin-text-area>"; | |||
RichTextArea ta = new RichTextArea(); | |||
ta.setValue("Hello World!"); | |||
ta.setReadOnly(true); |
@@ -31,7 +31,7 @@ public class SliderDeclarativeTest extends DeclarativeTestBase<Slider> { | |||
@Test | |||
public void testDefault() { | |||
String design = "<v-slider>"; | |||
String design = "<vaadin-slider>"; | |||
Slider expected = new Slider(); | |||
@@ -41,7 +41,7 @@ public class SliderDeclarativeTest extends DeclarativeTestBase<Slider> { | |||
@Test | |||
public void testHorizontal() { | |||
String design = "<v-slider min=10 max=20 resolution=1 value=12.3>"; | |||
String design = "<vaadin-slider min=10 max=20 resolution=1 value=12.3>"; | |||
Slider expected = new Slider(); | |||
expected.setMin(10.0); | |||
@@ -55,7 +55,7 @@ public class SliderDeclarativeTest extends DeclarativeTestBase<Slider> { | |||
@Test | |||
public void testVertical() { | |||
String design = "<v-slider vertical>"; | |||
String design = "<vaadin-slider vertical>"; | |||
Slider expected = new Slider(); | |||
expected.setOrientation(SliderOrientation.VERTICAL); | |||
@@ -66,7 +66,7 @@ public class SliderDeclarativeTest extends DeclarativeTestBase<Slider> { | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-slider readonly min=10 max=20 resolution=1 value=12.3>"; | |||
String design = "<vaadin-slider readonly min=10 max=20 resolution=1 value=12.3>"; | |||
Slider expected = new Slider(); | |||
expected.setMin(10.0); |
@@ -36,7 +36,7 @@ public abstract class TableDeclarativeTestBase extends | |||
} | |||
protected String getTag() { | |||
return "v-table"; | |||
return "vaadin-table"; | |||
} | |||
protected void compareBody(Table read, Table expected) { |
@@ -35,10 +35,10 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase<TabSheet> { | |||
@Test | |||
public void testFeatures() { | |||
String design = "<v-tab-sheet tabindex=5><tab caption=test-caption " | |||
String design = "<vaadin-tab-sheet tabindex=5><tab caption=test-caption " | |||
+ "visible=false closable='' enabled=false icon=http://www.vaadin.com/test.png" | |||
+ " icon-alt=OK description=test-desc style-name=test-style " | |||
+ "id=test-id><v-text-field/></tab></v-tab-sheet>"; | |||
+ "id=test-id><vaadin-text-field/></tab></vaadin-tab-sheet>"; | |||
TabSheet ts = new TabSheet(); | |||
ts.setTabIndex(5); | |||
TextField tf = new TextField(); | |||
@@ -59,7 +59,7 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase<TabSheet> { | |||
@Test | |||
public void testSelected() { | |||
String design = "<v-tab-sheet><tab selected=''><v-text-field/></tab></v-tab-sheet>"; | |||
String design = "<vaadin-tab-sheet><tab selected=''><vaadin-text-field/></tab></vaadin-tab-sheet>"; | |||
TabSheet ts = new TabSheet(); | |||
TextField tf = new TextField(); | |||
ts.addTab(tf); | |||
@@ -70,10 +70,10 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase<TabSheet> { | |||
@Test | |||
public void tabsNotShown() { | |||
String design = "<v-tab-sheet tabs-visible=\"false\">\n" | |||
String design = "<vaadin-tab-sheet tabs-visible=\"false\">\n" | |||
+ " <tab caption=\"My Tab\" selected=\"\">\n" | |||
+ " <v-label>My Content</v-label>\n" + " </tab>\n" | |||
+ "</v-tab-sheet>\n"; | |||
+ " <vaadin-label>My Content</vaadin-label>\n" + " </tab>\n" | |||
+ "</vaadin-tab-sheet>\n"; | |||
TabSheet ts = new TabSheet(); | |||
ts.setTabsVisible(false); | |||
Label l = new Label("My Content", ContentMode.HTML); |
@@ -36,7 +36,7 @@ public class TextAreaDeclarativeTest extends DeclarativeTestBase<TextArea> { | |||
@Test | |||
public void testTextArea() { | |||
String design = "<v-text-area rows=6 wordwrap=false>Hello World!</v-text-area>"; | |||
String design = "<vaadin-text-area rows=6 wordwrap=false>Hello World!</vaadin-text-area>"; | |||
TextArea ta = new TextArea(); | |||
ta.setRows(6); | |||
ta.setWordwrap(false); | |||
@@ -47,14 +47,14 @@ public class TextAreaDeclarativeTest extends DeclarativeTestBase<TextArea> { | |||
@Test | |||
public void testHtmlEntities() throws IOException { | |||
String design = "<v-text-area>& Test</v-text-area>"; | |||
String design = "<vaadin-text-area>& Test</vaadin-text-area>"; | |||
TextArea read = read(design); | |||
Assert.assertEquals("& Test", read.getValue()); | |||
read.setValue("& Test"); | |||
DesignContext dc = new DesignContext(); | |||
Element root = new Element(Tag.valueOf("v-text-area"), ""); | |||
Element root = new Element(Tag.valueOf("vaadin-text-area"), ""); | |||
read.writeDesign(root, dc); | |||
Assert.assertEquals("&amp; Test", root.html()); | |||
@@ -62,7 +62,7 @@ public class TextAreaDeclarativeTest extends DeclarativeTestBase<TextArea> { | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-text-area readonly rows=6 wordwrap=false>Hello World!</v-text-area>"; | |||
String design = "<vaadin-text-area readonly rows=6 wordwrap=false>Hello World!</vaadin-text-area>"; | |||
TextArea ta = new TextArea(); | |||
ta.setRows(6); | |||
ta.setWordwrap(false); |
@@ -30,7 +30,7 @@ public class TextFieldDeclarativeTest extends DeclarativeTestBase<TextField> { | |||
@Test | |||
public void testEmpty() { | |||
String design = "<v-text-field/>"; | |||
String design = "<vaadin-text-field/>"; | |||
TextField tf = new TextField(); | |||
testRead(design, tf); | |||
testWrite(design, tf); | |||
@@ -38,7 +38,7 @@ public class TextFieldDeclarativeTest extends DeclarativeTestBase<TextField> { | |||
@Test | |||
public void testValue() { | |||
String design = "<v-text-field value=\"test value\"/>"; | |||
String design = "<vaadin-text-field value=\"test value\"/>"; | |||
TextField tf = new TextField(); | |||
tf.setValue("test value"); | |||
testRead(design, tf); | |||
@@ -47,7 +47,7 @@ public class TextFieldDeclarativeTest extends DeclarativeTestBase<TextField> { | |||
@Test | |||
public void testReadOnlyValue() { | |||
String design = "<v-text-field readonly=\"\" value=\"test value\"/>"; | |||
String design = "<vaadin-text-field readonly=\"\" value=\"test value\"/>"; | |||
TextField tf = new TextField(); | |||
tf.setValue("test value"); | |||
tf.setReadOnly(true); |
@@ -32,7 +32,7 @@ public class TreeDeclarativeTest extends DeclarativeTestBase<Tree> { | |||
@Test | |||
public void testDragMode() { | |||
String design = "<v-tree drag-mode='node' />"; | |||
String design = "<vaadin-tree drag-mode='node' />"; | |||
Tree tree = new Tree(); | |||
tree.setDragMode(TreeDragMode.NODE); | |||
@@ -43,13 +43,13 @@ public class TreeDeclarativeTest extends DeclarativeTestBase<Tree> { | |||
@Test | |||
public void testEmpty() { | |||
testRead("<v-tree />", new Tree()); | |||
testWrite("<v-tree />", new Tree()); | |||
testRead("<vaadin-tree />", new Tree()); | |||
testWrite("<vaadin-tree />", new Tree()); | |||
} | |||
@Test | |||
public void testNodes() { | |||
String design = "<v-tree>" // | |||
String design = "<vaadin-tree>" // | |||
+ " <node text='Node'/>" // | |||
+ " <node text='Parent'>" // | |||
+ " <node text='Child'>" // | |||
@@ -57,7 +57,7 @@ public class TreeDeclarativeTest extends DeclarativeTestBase<Tree> { | |||
+ " </node>" // | |||
+ " </node>" // | |||
+ " <node text='With icon' icon='http://example.com/icon.png'/>" // | |||
+ "</v-tree>"; | |||
+ "</vaadin-tree>"; | |||
Tree tree = new Tree(); | |||
@@ -33,7 +33,7 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest { | |||
@Test | |||
public void testAttributes() { | |||
String design = "<v-tree-table animations-enabled=''>"; | |||
String design = "<vaadin-tree-table animations-enabled=''>"; | |||
TreeTable table = getTable(); | |||
table.setAnimationsEnabled(true); | |||
@@ -43,7 +43,7 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest { | |||
@Test | |||
public void testHierarchy() { | |||
String design = "<v-tree-table>" // | |||
String design = "<vaadin-tree-table>" // | |||
+ "<table>" // | |||
+ "<colgroup><col property-id=''></colgroup>" // | |||
+ "<tbody>" // | |||
@@ -57,7 +57,7 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest { | |||
+ " <tr depth=1 item-id='2.1'><td></tr>" // | |||
+ "</tbody>" // | |||
+ "</table>" // | |||
+ "</v-tree-table>"; | |||
+ "</vaadin-tree-table>"; | |||
TreeTable table = getTable(); | |||
table.addContainerProperty("", String.class, ""); | |||
@@ -83,7 +83,7 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest { | |||
@Test | |||
public void testCollapsed() { | |||
String design = "<v-tree-table>" // | |||
String design = "<vaadin-tree-table>" // | |||
+ " <table>" // | |||
+ " <colgroup><col property-id=''></colgroup>" // | |||
+ " <tbody>" // | |||
@@ -92,7 +92,7 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest { | |||
+ " <tr depth=2 item-id='1.1.1'><td></tr>" // | |||
+ " </tbody>" // | |||
+ " </table>" // | |||
+ "</v-tree-table>"; | |||
+ "</vaadin-tree-table>"; | |||
TreeTable table = getTable(); | |||
table.addContainerProperty("", String.class, ""); | |||
@@ -116,12 +116,12 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest { | |||
} | |||
protected void assertMalformed(String hierarchy) { | |||
String design = "<v-tree-table>" // | |||
String design = "<vaadin-tree-table>" // | |||
+ " <table>" // | |||
+ " <colgroup><col property-id=''></colgroup>" // | |||
+ " <tbody>" + hierarchy + "</tbody>" // | |||
+ " </table>" // | |||
+ "</v-tree-table>"; | |||
+ "</vaadin-tree-table>"; | |||
try { | |||
read(design); | |||
@@ -151,6 +151,6 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest { | |||
@Override | |||
protected String getTag() { | |||
return "v-tree-table"; | |||
return "vaadin-tree-table"; | |||
} | |||
} |
@@ -31,11 +31,11 @@ public class TwinColSelectDeclarativeTest extends | |||
DeclarativeTestBase<TwinColSelect> { | |||
public String getBasicDesign() { | |||
return "<v-twin-col-select rows=5 right-column-caption='Selected values' left-column-caption='Unselected values'>\n" | |||
return "<vaadin-twin-col-select rows=5 right-column-caption='Selected values' left-column-caption='Unselected values'>\n" | |||
+ " <option>First item</option>\n" | |||
+ " <option selected>Second item</option>\n" | |||
+ " <option selected>Third item</option>\n" | |||
+ "</v-twin-col-select>"; | |||
+ "</vaadin-twin-col-select>"; | |||
} | |||
@@ -63,12 +63,12 @@ public class TwinColSelectDeclarativeTest extends | |||
@Test | |||
public void testReadEmpty() { | |||
testRead("<v-twin-col-select />", new TwinColSelect()); | |||
testRead("<vaadin-twin-col-select />", new TwinColSelect()); | |||
} | |||
@Test | |||
public void testWriteEmpty() { | |||
testWrite("<v-twin-col-select />", new TwinColSelect()); | |||
testWrite("<vaadin-twin-col-select />", new TwinColSelect()); | |||
} | |||
} |
@@ -39,7 +39,7 @@ public class UploadDeclarativeTest extends DeclarativeTestBase<Upload> { | |||
} | |||
private String getBasicDesign() { | |||
return "<v-upload button-caption='Send the file' tabindex=5 />"; | |||
return "<vaadin-upload button-caption='Send the file' tabindex=5 />"; | |||
} | |||
private Upload getBasicExpected() { | |||
@@ -51,11 +51,11 @@ public class UploadDeclarativeTest extends DeclarativeTestBase<Upload> { | |||
@Test | |||
public void testReadEmpty() { | |||
testRead("<v-upload />", new Upload()); | |||
testRead("<vaadin-upload />", new Upload()); | |||
} | |||
@Test | |||
public void testWriteEmpty() { | |||
testWrite("<v-upload />", new Upload()); | |||
testWrite("<vaadin-upload />", new Upload()); | |||
} | |||
} |
@@ -38,7 +38,7 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
@Test | |||
public void testDefault() { | |||
String design = "<v-window>"; | |||
String design = "<vaadin-window>"; | |||
Window expected = new Window(); | |||
@@ -49,14 +49,14 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
@Test | |||
public void testFeatures() { | |||
String design = "<v-window position='100,100' window-mode='maximized' " | |||
String design = "<vaadin-window position='100,100' window-mode='maximized' " | |||
+ "center modal='' resizable=false resize-lazy='' closable=false draggable=false " | |||
+ "close-shortcut='ctrl-alt-escape' " | |||
+ "assistive-prefix='Hello' assistive-postfix='World' assistive-role='alertdialog' " | |||
+ "tab-stop-enabled='' " | |||
+ "tab-stop-top-assistive-text='Do not move above the window' " | |||
+ "tab-stop-bottom-assistive-text='End of window'>" | |||
+ "</v-window>"; | |||
+ "</vaadin-window>"; | |||
Window expected = new Window(); | |||
@@ -106,7 +106,7 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
expected.addCloseShortcut(KeyCode.ARROW_RIGHT, ModifierKey.CTRL); | |||
// Test validity | |||
String design = "<v-window close-shortcut='escape spacebar ctrl-alt-left ctrl-right' />"; | |||
String design = "<vaadin-window close-shortcut='escape spacebar ctrl-alt-left ctrl-right' />"; | |||
testRead(design, expected); | |||
testWrite(design, expected); | |||
@@ -114,7 +114,7 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
expected.removeCloseShortcut(KeyCode.SPACEBAR); | |||
// Test again | |||
design = "<v-window close-shortcut='escape ctrl-alt-left ctrl-right' />"; | |||
design = "<vaadin-window close-shortcut='escape ctrl-alt-left ctrl-right' />"; | |||
testRead(design, expected); | |||
testWrite(design, expected); | |||
@@ -133,7 +133,7 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
protected void assertInvalidPosition(String position) { | |||
try { | |||
read("<v-window position='" + position + "'>"); | |||
read("<vaadin-window position='" + position + "'>"); | |||
Assert.fail("Invalid position '" + position + "' should throw"); | |||
} catch (Exception e) { | |||
// expected | |||
@@ -143,8 +143,8 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
@Test | |||
public void testChildContent() { | |||
String design = "<v-window>" + createElement(new Button("OK")) | |||
+ "</v-window>"; | |||
String design = "<vaadin-window>" + createElement(new Button("OK")) | |||
+ "</vaadin-window>"; | |||
Window expected = new Window(); | |||
expected.setContent(new Button("OK")); | |||
@@ -156,8 +156,8 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
@Test(expected = DesignException.class) | |||
public void testMultipleContentChildren() { | |||
String design = "<v-window>" + createElement(new Label("Hello")) | |||
+ createElement(new Button("OK")) + "</v-window>"; | |||
String design = "<vaadin-window>" + createElement(new Label("Hello")) | |||
+ createElement(new Button("OK")) + "</vaadin-window>"; | |||
read(design); | |||
} | |||
@@ -168,7 +168,7 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
Label assistive1 = new Label("Assistive text"); | |||
Label assistive2 = new Label("More assistive text"); | |||
String design = "<v-window>" | |||
String design = "<vaadin-window>" | |||
+ createElement(assistive1).attr(":assistive-description", "") | |||
+ createElement(new Button("OK")) | |||
+ createElement(assistive2).attr(":assistive-description", ""); | |||
@@ -179,7 +179,7 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> { | |||
testRead(design, expected); | |||
String written = "<v-window>" + createElement(new Button("OK")) | |||
String written = "<vaadin-window>" + createElement(new Button("OK")) | |||
+ createElement(assistive1).attr(":assistive-description", "") | |||
+ createElement(assistive2).attr(":assistive-description", ""); | |||
@@ -90,7 +90,7 @@ public class DesignTest { | |||
private String getHtmlLabelValue(String html) { | |||
Document document = Jsoup.parse(html); | |||
Element label = document.select("v-label").get(0); | |||
Element label = document.select("vaadin-label").get(0); | |||
StringBuilder builder = new StringBuilder(); | |||
for (Node child : label.childNodes()) { |
@@ -1,4 +1,4 @@ | |||
<v-grid | |||
<vaadin-grid | |||
editor-save-caption='Save' | |||
editor-cancel-caption='Cancel' | |||
frozen-columns=1 | |||
@@ -37,7 +37,7 @@ | |||
</tr> | |||
<tr> | |||
<th> | |||
<v-text-field width='100%' input-prompt='Filter'></v-textfield> | |||
<vaadin-text-field width='100%' input-prompt='Filter'></vaadin-textfield> | |||
<!-- | |||
--> | |||
</th> | |||
@@ -496,4 +496,4 @@ | |||
</tr> | |||
</tfoot> | |||
</table> | |||
</v-grid> | |||
</vaadin-grid> |
@@ -1,4 +1,4 @@ | |||
<v-grid caption="Double click to edit" width="100%" height="100%" | |||
<vaadin-grid caption="Double click to edit" width="100%" height="100%" | |||
editable selection-mode="none"> | |||
<table> | |||
<colgroup> | |||
@@ -78,4 +78,4 @@ | |||
</tr> | |||
</tbody> | |||
</table> | |||
</v-grid> | |||
</vaadin-grid> |
@@ -1,4 +1,4 @@ | |||
<v-grid width='100%' height='100%' selection-mode='multi' editable='false'> | |||
<vaadin-grid width='100%' height='100%' selection-mode='multi' editable='false'> | |||
<table> | |||
<colgroup> | |||
<col /> | |||
@@ -115,4 +115,4 @@ | |||
</tr> | |||
</tbody> | |||
</table> | |||
</v-grid> | |||
</vaadin-grid> |
@@ -1,23 +1,23 @@ | |||
<v-vertical-layout size-full margin spacing> | |||
<v-horizontal-layout spacing margin width-full> | |||
<v-label size-auto>POTUS Database</v-label> | |||
<v-button :expand>Add new</v-button> | |||
</v-horizontal-layout> | |||
<v-table _id="potusList" :expand selectable size-full /> | |||
<v-vertical-layout _id="form" spacing margin> | |||
<v-horizontal-layout spacing> | |||
<v-text-field caption="First Name" width="300px" /> | |||
<v-text-field caption="Last Name" width="300px" /> | |||
</v-horizontal-layout> | |||
<v-horizontal-layout spacing> | |||
<v-combo-box caption="Party" width="300px" /> | |||
<v-popup-date-field caption="Took Office" /> | |||
<v-popup-date-field caption="Left Office" /> | |||
</v-horizontal-layout> | |||
<v-horizontal-layout spacing width-full> | |||
<v-button style-name="primary">Save</v-button> | |||
<v-button>Revert</v-button> | |||
<v-button :expand :right>Delete</v-button> | |||
</v-horizontal-layout> | |||
</v-vertical-layout> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout size-full margin spacing> | |||
<vaadin-horizontal-layout spacing margin width-full> | |||
<vaadin-label size-auto>POTUS Database</vaadin-label> | |||
<vaadin-button :expand>Add new</vaadin-button> | |||
</vaadin-horizontal-layout> | |||
<vaadin-table _id="potusList" :expand selectable size-full /> | |||
<vaadin-vertical-layout _id="form" spacing margin> | |||
<vaadin-horizontal-layout spacing> | |||
<vaadin-text-field caption="First Name" width="300px" /> | |||
<vaadin-text-field caption="Last Name" width="300px" /> | |||
</vaadin-horizontal-layout> | |||
<vaadin-horizontal-layout spacing> | |||
<vaadin-combo-box caption="Party" width="300px" /> | |||
<vaadin-popup-date-field caption="Took Office" /> | |||
<vaadin-popup-date-field caption="Left Office" /> | |||
</vaadin-horizontal-layout> | |||
<vaadin-horizontal-layout spacing width-full> | |||
<vaadin-button style-name="primary">Save</vaadin-button> | |||
<vaadin-button>Revert</vaadin-button> | |||
<vaadin-button :expand :right>Delete</vaadin-button> | |||
</vaadin-horizontal-layout> | |||
</vaadin-vertical-layout> | |||
</vaadin-vertical-layout> |
@@ -2,13 +2,13 @@ | |||
<meta name="package-mapping" content="x:com.vaadin.tests.declarative"/> | |||
</head> | |||
<body> | |||
<v-vertical-layout size-full margin="true" spacing> | |||
<v-horizontal-layout spacing margin width-full> | |||
<v-label size-auto>POTUS Database</v-label> | |||
<v-button :expand _id="addNew">Add new</v-button> | |||
</v-horizontal-layout> | |||
<v-table _id="potusList" :expand selectable size-full/> | |||
<vaadin-vertical-layout size-full margin="true" spacing> | |||
<vaadin-horizontal-layout spacing margin width-full> | |||
<vaadin-label size-auto>POTUS Database</vaadin-label> | |||
<vaadin-button :expand _id="addNew">Add new</vaadin-button> | |||
</vaadin-horizontal-layout> | |||
<vaadin-table _id="potusList" :expand selectable size-full/> | |||
<x-potus-form _id="potusForm" /> | |||
</v-vertical-layout> | |||
</vaadin-vertical-layout> | |||
</body> | |||
@@ -1,16 +1,16 @@ | |||
<v-vertical-layout _id="form" spacing margin> | |||
<v-horizontal-layout spacing> | |||
<v-text-field _id="firstName" caption="First Name" null-representation="" width="300px" /> | |||
<v-text-field _id="lastName" caption="Last Name" null-representation="" width="300px" /> | |||
</v-horizontal-layout> | |||
<v-horizontal-layout spacing> | |||
<v-combo-box _id="party" caption="Party" width="300px" /> | |||
<v-popup-date-field _id="tookOffice" caption="Took Office" /> | |||
<v-popup-date-field _id="leftOffice" caption="Left Office" /> | |||
</v-horizontal-layout> | |||
<v-horizontal-layout spacing width-full> | |||
<v-button _id="save" style-name="primary">Save</v-button> | |||
<v-button _id="revert">Revert</v-button> | |||
<v-button _id="delete" style-name="danger" :expand :right>Delete</v-button> | |||
</v-horizontal-layout> | |||
</v-vertical-layout> | |||
<vaadin-vertical-layout _id="form" spacing margin> | |||
<vaadin-horizontal-layout spacing> | |||
<vaadin-text-field _id="firstName" caption="First Name" null-representation="" width="300px" /> | |||
<vaadin-text-field _id="lastName" caption="Last Name" null-representation="" width="300px" /> | |||
</vaadin-horizontal-layout> | |||
<vaadin-horizontal-layout spacing> | |||
<vaadin-combo-box _id="party" caption="Party" width="300px" /> | |||
<vaadin-popup-date-field _id="tookOffice" caption="Took Office" /> | |||
<vaadin-popup-date-field _id="leftOffice" caption="Left Office" /> | |||
</vaadin-horizontal-layout> | |||
<vaadin-horizontal-layout spacing width-full> | |||
<vaadin-button _id="save" style-name="primary">Save</vaadin-button> | |||
<vaadin-button _id="revert">Revert</vaadin-button> | |||
<vaadin-button _id="delete" style-name="danger" :expand :right>Delete</vaadin-button> | |||
</vaadin-horizontal-layout> | |||
</vaadin-vertical-layout> |
@@ -1 +1 @@ | |||
<v-label /> | |||
<vaadin-label /> |