Browse Source

Write true boolean attibutes without ='' (#17583)

Also add missing test for GridLayout alignments

Change-Id: If553c9e254fb754cb020a63013bfcc9ecae3a056
tags/7.6.0.alpha7
Leif Åstrand 8 years ago
parent
commit
9ee97bbf72
46 changed files with 237 additions and 196 deletions
  1. 1
    1
      server/ivy.xml
  2. 6
    6
      server/src/com/vaadin/ui/AbstractComponent.java
  3. 5
    5
      server/src/com/vaadin/ui/AbstractOrderedLayout.java
  4. 2
    2
      server/src/com/vaadin/ui/AbstractSplitPanel.java
  5. 1
    2
      server/src/com/vaadin/ui/Button.java
  6. 1
    1
      server/src/com/vaadin/ui/DragAndDropWrapper.java
  7. 1
    2
      server/src/com/vaadin/ui/Grid.java
  8. 5
    5
      server/src/com/vaadin/ui/GridLayout.java
  9. 1
    1
      server/src/com/vaadin/ui/Label.java
  10. 2
    2
      server/src/com/vaadin/ui/MenuBar.java
  11. 1
    1
      server/src/com/vaadin/ui/Slider.java
  12. 2
    2
      server/src/com/vaadin/ui/Table.java
  13. 2
    2
      server/src/com/vaadin/ui/Window.java
  14. 13
    9
      server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java
  15. 2
    1
      server/tests/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperDeclarativeTest.java
  16. 11
    11
      server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java
  17. 1
    3
      server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java
  18. 11
    2
      server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java
  19. 5
    5
      server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java
  20. 16
    14
      server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java
  21. 4
    4
      server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java
  22. 14
    6
      server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java
  23. 6
    6
      server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java
  24. 1
    1
      server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java
  25. 3
    3
      server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java
  26. 1
    1
      server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java
  27. 1
    1
      server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java
  28. 1
    1
      server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java
  29. 4
    4
      server/tests/src/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java
  30. 2
    2
      server/tests/src/com/vaadin/tests/server/component/checkbox/CheckboxDeclarativeTest.java
  31. 2
    2
      server/tests/src/com/vaadin/tests/server/component/colorpicker/AbstractColorPickerDeclarativeTest.java
  32. 1
    1
      server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldDeclarativeTest.java
  33. 4
    4
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java
  34. 2
    2
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java
  35. 41
    50
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridHeaderFooterDeclarativeTest.java
  36. 7
    7
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridInlineDataDeclarativeTest.java
  37. 26
    0
      server/tests/src/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java
  38. 1
    1
      server/tests/src/com/vaadin/tests/server/component/passwordfield/PasswordFieldDeclarativeTest.java
  39. 1
    1
      server/tests/src/com/vaadin/tests/server/component/popupview/PopupViewDeclarativeTest.java
  40. 2
    3
      server/tests/src/com/vaadin/tests/server/component/progressbar/ProgressBarDeclarativeTest.java
  41. 1
    1
      server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaDeclarativeTest.java
  42. 4
    4
      server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTest.java
  43. 5
    5
      server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java
  44. 1
    1
      server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldDeclarativeTest.java
  45. 1
    1
      server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableDeclarativeTest.java
  46. 12
    7
      server/tests/src/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java

+ 1
- 1
server/ivy.xml View File

@@ -60,7 +60,7 @@
</dependency>

<!-- Jsoup for BootstrapHandler -->
<dependency org="org.jsoup" name="jsoup" rev="1.8.1"
<dependency org="org.jsoup" name="jsoup" rev="1.8.3"
conf="build,ide,test -> default" />

<!-- TESTING DEPENDENCIES -->

+ 6
- 6
server/src/com/vaadin/ui/AbstractComponent.java View File

@@ -1176,16 +1176,16 @@ public abstract class AbstractComponent extends AbstractClientConnector

// first try the full shorthands
if (widthFull && heightFull) {
attributes.put("size-full", "");
attributes.put("size-full", true);
} else if (widthAuto && heightAuto) {
attributes.put("size-auto", "");
attributes.put("size-auto", true);
} else {
// handle width
if (!hasEqualWidth(defaultInstance)) {
if (widthFull) {
attributes.put("width-full", "");
attributes.put("width-full", true);
} else if (widthAuto) {
attributes.put("width-auto", "");
attributes.put("width-auto", true);
} else {
String widthString = DesignAttributeHandler.getFormatter()
.format(getWidth()) + getWidthUnits().getSymbol();
@@ -1196,9 +1196,9 @@ public abstract class AbstractComponent extends AbstractClientConnector
if (!hasEqualHeight(defaultInstance)) {
// handle height
if (heightFull) {
attributes.put("height-full", "");
attributes.put("height-full", true);
} else if (heightAuto) {
attributes.put("height-auto", "");
attributes.put("height-auto", true);
} else {
String heightString = DesignAttributeHandler.getFormatter()
.format(getHeight()) + getHeightUnits().getSymbol();

+ 5
- 5
server/src/com/vaadin/ui/AbstractOrderedLayout.java View File

@@ -547,19 +547,19 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
// handle alignment
Alignment alignment = getComponentAlignment(child);
if (alignment.isMiddle()) {
childElement.attr(":middle", "");
childElement.attr(":middle", true);
} else if (alignment.isBottom()) {
childElement.attr(":bottom", "");
childElement.attr(":bottom", true);
}
if (alignment.isCenter()) {
childElement.attr(":center", "");
childElement.attr(":center", true);
} else if (alignment.isRight()) {
childElement.attr(":right", "");
childElement.attr(":right", true);
}
// handle expand ratio
float expandRatio = getExpandRatio(child);
if (expandRatio == 1.0f) {
childElement.attr(":expand", "");
childElement.attr(":expand", true);
} else if (expandRatio > 0) {
childElement.attr(":expand", DesignAttributeHandler
.getFormatter().format(expandRatio));

+ 2
- 2
server/src/com/vaadin/ui/AbstractSplitPanel.java View File

@@ -735,7 +735,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
+ getMaxSplitPositionUnit());
}
if (getSplitterState().positionReversed) {
design.attr("reversed", "");
design.attr("reversed", true);
}
// handle child components
if (!designContext.shouldWriteChildren(this, def)) {
@@ -750,7 +750,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
if (secondComponent != null) {
Element childElement = designContext.createElement(secondComponent);
if (firstComponent == null) {
childElement.attr(":second", "");
childElement.attr(":second", true);
}
design.appendChild(childElement);
}

+ 1
- 2
server/src/com/vaadin/ui/Button.java View File

@@ -22,7 +22,6 @@ import java.util.Collection;

import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Parser;

import com.vaadin.event.Action;
import com.vaadin.event.ShortcutAction;
@@ -635,7 +634,7 @@ public class Button extends AbstractFocusable implements
}
// plain-text (default is html)
if (!isHtmlContentAllowed()) {
design.attr(DESIGN_ATTR_PLAIN_TEXT, "");
design.attr(DESIGN_ATTR_PLAIN_TEXT, true);
// encode HTML entities
if (content != null) {
design.html(DesignFormatter.encodeForTextNode(content));

+ 1
- 1
server/src/com/vaadin/ui/DragAndDropWrapper.java View File

@@ -491,7 +491,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
if (getDragStartMode() == DragStartMode.COMPONENT_OTHER) {
Element child = designContext
.createElement(getDragImageComponent());
child.attr(":drag-image", "");
child.attr(":drag-image", true);
design.appendChild(child);
}
}

+ 1
- 2
server/src/com/vaadin/ui/Grid.java View File

@@ -2226,8 +2226,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
DesignContext designContext) {
switch (cellState.type) {
case TEXT:
DesignAttributeHandler.writeAttribute("plain-text",
cellElement.attributes(), "", null, String.class);
cellElement.attr("plain-text", true);
cellElement.appendText(getText());
break;
case HTML:

+ 5
- 5
server/src/com/vaadin/ui/GridLayout.java View File

@@ -1512,14 +1512,14 @@ public class GridLayout extends AbstractLayout implements

Alignment alignment = getComponentAlignment(child);
if (alignment.isMiddle()) {
childElement.attr(":middle", "");
childElement.attr(":middle", true);
} else if (alignment.isBottom()) {
childElement.attr(":bottom", "");
childElement.attr(":bottom", true);
}
if (alignment.isCenter()) {
childElement.attr(":center", "");
childElement.attr(":center", true);
} else if (alignment.isRight()) {
childElement.attr(":right", "");
childElement.attr(":right", true);
}

col.appendChild(childElement);
@@ -1659,4 +1659,4 @@ public class GridLayout extends AbstractLayout implements
result.add("columns");
return result;
}
}
}

+ 1
- 1
server/src/com/vaadin/ui/Label.java View File

@@ -629,7 +629,7 @@ public class Label extends AbstractComponent implements Property<String>,
}
// plain-text (default is html)
if (getContentMode() == ContentMode.TEXT) {
design.attr(DESIGN_ATTR_PLAIN_TEXT, "");
design.attr(DESIGN_ATTR_PLAIN_TEXT, true);
design.html(DesignFormatter.encodeForTextNode(getValue()));
}
}

+ 2
- 2
server/src/com/vaadin/ui/MenuBar.java View File

@@ -952,12 +952,12 @@ public class MenuBar extends AbstractComponent implements LegacyComponent,
// in many cases there seems to be an empty more menu item
if (getMoreMenuItem() != null && !getMoreMenuItem().getText().isEmpty()) {
Element moreMenu = createMenuElement(getMoreMenuItem());
moreMenu.attr("more", "");
moreMenu.attr("more", true);
design.appendChild(moreMenu);
}

if (!htmlContentAllowed) {
design.attr(DESIGN_ATTR_PLAIN_TEXT, "");
design.attr(DESIGN_ATTR_PLAIN_TEXT, true);
}
}


+ 1
- 1
server/src/com/vaadin/ui/Slider.java View File

@@ -381,7 +381,7 @@ public class Slider extends AbstractField<Double> {
public void writeDesign(Element design, DesignContext context) {
super.writeDesign(design, context);
if (getOrientation() == SliderOrientation.VERTICAL) {
design.attr("vertical", "");
design.attr("vertical", true);
}
Slider defaultSlider = context.getDefaultInstance(this);
DesignAttributeHandler.writeAttribute(this, "value",

+ 2
- 2
server/src/com/vaadin/ui/Table.java View File

@@ -6312,9 +6312,9 @@ public class Table extends AbstractSelect implements Action.Container,
col.attr("property-id", id.toString());

if (getColumnAlignment(id) == Align.CENTER) {
col.attr("center", "");
col.attr("center", true);
} else if (getColumnAlignment(id) == Align.RIGHT) {
col.attr("right", "");
col.attr("right", true);
}

DesignAttributeHandler.writeAttribute("width", col.attributes(),

+ 2
- 2
server/src/com/vaadin/ui/Window.java View File

@@ -1453,7 +1453,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
Window def = context.getDefaultInstance(this);

if (getState().centered) {
design.attr("center", "");
design.attr("center", true);
}

DesignAttributeHandler.writeAttribute("position", design.attributes(),
@@ -1481,7 +1481,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,

for (Component c : getAssistiveDescription()) {
Element child = context.createElement(c).attr(
":assistive-description", "");
":assistive-description", true);
design.appendChild(child);
}
}

+ 13
- 9
server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java View File

@@ -117,8 +117,10 @@ public class DesignAttributeHandler implements Serializable {
success = true;
}
} catch (Exception e) {
getLogger().log(Level.WARNING,
"Failed to set attribute " + attribute, e);
getLogger().log(
Level.WARNING,
"Failed to set value \"" + value + "\" to attribute "
+ attribute, e);
}
if (!success) {
getLogger().info(
@@ -191,6 +193,7 @@ public class DesignAttributeHandler implements Serializable {
* @param defaultInstance
* the default instance for comparing default values
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void writeAttribute(Object component, String attribute,
Attributes attr, Object defaultInstance) {
Method getter = findGetterForAttribute(component.getClass(), attribute);
@@ -202,12 +205,8 @@ public class DesignAttributeHandler implements Serializable {
// compare the value with default value
Object value = getter.invoke(component);
Object defaultValue = getter.invoke(defaultInstance);
// if the values are not equal, write the data
if (!SharedUtil.equals(value, defaultValue)) {
String attributeValue = toAttributeValue(
getter.getReturnType(), value);
attr.put(attribute, attributeValue);
}
writeAttribute(attribute, attr, value, defaultValue,
(Class) getter.getReturnType());
} catch (Exception e) {
getLogger()
.log(Level.SEVERE,
@@ -240,7 +239,12 @@ public class DesignAttributeHandler implements Serializable {
}
if (!SharedUtil.equals(value, defaultValue)) {
String attributeValue = toAttributeValue(inputType, value);
attributes.put(attribute, attributeValue);
if ("".equals(attributeValue)
&& (inputType == boolean.class || inputType == Boolean.class)) {
attributes.put(attribute, true);
} else {
attributes.put(attribute, attributeValue);
}
}
}


+ 2
- 1
server/tests/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperDeclarativeTest.java View File

@@ -56,7 +56,8 @@ public class DragAndDropWrapperDeclarativeTest extends
String input = "<vaadin-drag-and-drop-wrapper drag-start-mode='component_other'>"
+ new DesignContext().createElement(okButton)
+ new DesignContext().createElement(dragImage).attr(
":drag-image", "") + "</vaadin-drag-and-drop-wrapper>";
":drag-image", true)
+ "</vaadin-drag-and-drop-wrapper>";
DragAndDropWrapper wrapper = new DragAndDropWrapper(okButton);
wrapper.setDragStartMode(DragStartMode.COMPONENT_OTHER);
wrapper.setDragImageComponent(dragImage);

+ 11
- 11
server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java View File

@@ -38,10 +38,10 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> {
@Test
// #16328
public void testReadWrite() throws IOException {
String design = "<vaadin-menu-bar auto-open='' tabindex=5>"
+ "<menu checkable=''>Save</menu>"
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 disabled>Close</menu>"
+ "<menu icon='http://foo.bar/ico.png'>Help</menu>"
+ "<menu visible='false'>About</menu>"
+ "<menu>Sub<menu>Item</menu></menu>"
@@ -69,19 +69,19 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> {
@Test
// #16328
public void testTicketSpec1() throws IOException {
String design = "<vaadin-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>"
+ "<menu separator='' />"
+ "<menu disabled=''>Exit</menu>"
+ "<menu separator />"
+ "<menu disabled>Exit</menu>"
+ "<menu visible='false'>Not for everybody</menu>"
+ "</menu>"
+ "<menu description=\"This contains many items in sub menus\">Other"
+ "<menu style-name=\"fancy\">Sub"
+ "<menu checkable='' checked=''>Option 1 - no <b>html</b></menu>"
+ "<menu checkable=''>Option 2</menu>"
+ "<menu checkable=''>Option 3</menu>" //
+ "<menu checkable checked>Option 1 - no <b>html</b></menu>"
+ "<menu checkable>Option 2</menu>"
+ "<menu checkable>Option 3</menu>" //
+ "</menu>" //
+ "</menu>" //
+ "<menu more icon=\"theme://icon.png\">foo</menu>"
@@ -124,7 +124,7 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> {
+ "<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 separator />" + "<menu disabled>Exit</menu>" //
+ "</menu></vaadin-menu-bar>";
MenuBar menuBar = new MenuBar();
menuBar.setHtmlContentAllowed(true);
@@ -195,4 +195,4 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> {
}
}
}
}
}

+ 1
- 3
server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java View File

@@ -28,9 +28,7 @@ public class AbstractComponentSetResponsiveTest extends
Label label = new Label();
label.setContentMode(ContentMode.HTML);
label.setResponsive(true);

String design = "<vaadin-label responsive='' />";

String design = "<vaadin-label responsive />";
testWrite(design, label);
testRead(design, label);
}

+ 11
- 2
server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java View File

@@ -21,10 +21,12 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Attribute;
import org.jsoup.nodes.BooleanAttribute;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
@@ -184,16 +186,23 @@ public abstract class DeclarativeTestBaseBase<T extends Component> {
* include close tags
*/
private String elementToHtml(Element producedElem, StringBuilder sb) {
HashSet<String> booleanAttributes = new HashSet<String>();
ArrayList<String> names = new ArrayList<String>();
for (Attribute a : producedElem.attributes().asList()) {
names.add(a.getKey());
if (a instanceof BooleanAttribute) {
booleanAttributes.add(a.getKey());
}
}
Collections.sort(names);

sb.append("<" + producedElem.tagName() + "");
for (String attrName : names) {
sb.append(" ").append(attrName).append("=").append("\'")
.append(producedElem.attr(attrName)).append("\'");
sb.append(" ").append(attrName);
if (!booleanAttributes.contains(attrName)) {
sb.append("=").append("\'").append(producedElem.attr(attrName))
.append("\'");
}
}
sb.append(">");
for (Node child : producedElem.childNodes()) {

+ 5
- 5
server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java View File

@@ -52,19 +52,19 @@ public abstract class DeclarativeMarginTestBase<L extends Layout & MarginHandler
String s = "<" + componentTag + " ";

if (left && right && top && bottom) {
s += "margin=''";
s += "margin";
} else {
if (left) {
s += "margin-left='' ";
s += "margin-left ";
}
if (right) {
s += "margin-right='' ";
s += "margin-right ";
}
if (top) {
s += "margin-top='' ";
s += "margin-top ";
}
if (bottom) {
s += "margin-bottom='' ";
s += "margin-bottom ";
}
}
return s + " />";

+ 16
- 14
server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java View File

@@ -71,7 +71,7 @@ public class AbstractComponentDeclarativeTest extends
public void testProperties() {
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=\"\"/>";
+ "error=\"<div>test-error</div>\" immediate />";
component.setId("testId");
component.setPrimaryStyleName("test-style");
component.setCaption("test-caption");
@@ -89,8 +89,10 @@ public class AbstractComponentDeclarativeTest extends
public void testReadImmediate() {
// Additional tests for the immediate property, including
// explicit immediate values
String[] design = { "<vaadin-label/>", "<vaadin-label immediate=\"false\"/>",
"<vaadin-label immediate=\"true\"/>", "<vaadin-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 };
@@ -139,7 +141,7 @@ public class AbstractComponentDeclarativeTest extends

@Test
public void testSizeFull() {
String design = "<vaadin-label size-full=\"\"/>";
String design = "<vaadin-label size-full />";
component.setSizeFull();
testRead(design, component);
testWrite(design, component);
@@ -147,7 +149,7 @@ public class AbstractComponentDeclarativeTest extends

@Test
public void testSizeAuto() {
String design = "<vaadin-label size-auto=\"\"/>";
String design = "<vaadin-label size-auto />";
component.setSizeUndefined();
testRead(design, component);
testWrite(design, component);
@@ -155,7 +157,7 @@ public class AbstractComponentDeclarativeTest extends

@Test
public void testHeightFull() {
String design = "<vaadin-label height-full=\"\"/ width=\"20px\"/>";
String design = "<vaadin-label height-full width=\"20px\"/>";
component.setHeight("100%");
component.setWidth("20px");
testRead(design, component);
@@ -164,7 +166,7 @@ public class AbstractComponentDeclarativeTest extends

@Test
public void testHeightAuto() {
String design = "<vaadin-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 +177,7 @@ public class AbstractComponentDeclarativeTest extends

@Test
public void testWidthFull() {
String design = "<vaadin-button width-full=\"\"/ height=\"20px\">Foo</button>";
String design = "<vaadin-button width-full height=\"20px\">Foo</vaadin-button>";
AbstractComponent component = new Button();
component.setCaptionAsHtml(true);
component.setCaption("Foo");
@@ -187,7 +189,7 @@ public class AbstractComponentDeclarativeTest extends

@Test
public void testWidthAuto() {
String design = "<vaadin-label height=\"20px\"/ width-auto=\"\"/>";
String design = "<vaadin-label height=\"20px\"/ width-auto />";
component.setCaptionAsHtml(false);
component.setHeight("20px");
component.setWidth(null);
@@ -197,7 +199,7 @@ public class AbstractComponentDeclarativeTest extends

@Test
public void testResponsive() {
String design = "<vaadin-label responsive =\"\"/>";
String design = "<vaadin-label responsive />";
Responsive.makeResponsive(component);
testRead(design, component);
testWrite(design, component);
@@ -214,15 +216,15 @@ public class AbstractComponentDeclarativeTest extends
public void testReadAlreadyResponsive() {
AbstractComponent component = new Label();
Responsive.makeResponsive(component);
Element design = createDesign("responsive", "");
Element design = createDesign(true);
component.readDesign(design, new DesignContext());
assertEquals("Component should have only one extension", 1, component
.getExtensions().size());
}

private Element createDesign(String key, String value) {
private Element createDesign(boolean responsive) {
Attributes attributes = new Attributes();
attributes.put(key, value);
attributes.put("responsive", responsive);
Element node = new Element(Tag.valueOf("vaadin-label"), "", attributes);
return node;
}
@@ -238,4 +240,4 @@ public class AbstractComponentDeclarativeTest extends
"Getting the field explicitImmediateValue failed.");
}
}
}
}

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java View File

@@ -33,9 +33,9 @@ public class AbstractFieldDeclarativeTest extends

@Test
public void testPlainText() {
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=''/>";
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();
tf.setBuffered(true);
tf.setBuffered(true);
@@ -51,7 +51,7 @@ public class AbstractFieldDeclarativeTest extends
testWrite(design, tf);

// Test with readonly=false
design = design.replace("readonly=''", "");
design = design.replace("readonly", "");
tf.setReadOnly(false);
testRead(design, tf);
testWrite(design, tf);

+ 14
- 6
server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java View File

@@ -76,23 +76,31 @@ public class AbstractOrderedLayoutDeclarativeTest extends
private String getDesign(float expandRatio, String... alignments) {
String result = "<vaadin-vertical-layout caption=test-layout>";
result += "<vaadin-label caption=test-label ";
String ratioString = expandRatio == 1.0f ? "\"\"" : String
String ratioString = expandRatio == 1.0f ? null : String
.valueOf(expandRatio);
if (expandRatio != 0) {
result += ":expand=" + ratioString;
if (ratioString == null) {
result += ":expand";
} else {
result += ":expand=" + ratioString;
}
}
for (String alignment : alignments) {
if (!defaultAlignments.contains(alignment)) {
result += " " + alignment + "=\"\"";
result += " " + alignment;
}
}
result += "></vaadin-label><vaadin-button ";
if (expandRatio != 0) {
result += ":expand=" + ratioString;
if (ratioString == null) {
result += ":expand";
} else {
result += ":expand=" + ratioString;
}
}
for (String alignment : alignments) {
if (!defaultAlignments.contains(alignment)) {
result += " " + alignment + "=\"\"";
result += " " + alignment;
}
}
result += "></vaadin-button></vaadin-vertical-layout>";
@@ -118,4 +126,4 @@ public class AbstractOrderedLayoutDeclarativeTest extends
}
return layout;
}
}
}

+ 6
- 6
server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java View File

@@ -43,7 +43,7 @@ public class AbstractSelectDeclarativeTest extends
DeclarativeTestBase<AbstractSelect> {

public String getDesignSingleSelectNewItemsAllowed() {
return "<vaadin-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 "<vaadin-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() {
@@ -208,19 +208,19 @@ public class AbstractSelectDeclarativeTest extends

private Element createDesignWithAttributesSingleSelect() {
Attributes attributes = new Attributes();
attributes.put("new-items-allowed", "");
attributes.put("new-items-allowed", true);
attributes.put("multi-select", "false");
attributes.put("item-caption-mode", "property");
attributes.put("item-caption-property-id", "name");
attributes.put("item-icon-property-id", "icon");
attributes.put("null-selection-allowed", "");
attributes.put("null-selection-allowed", true);
attributes.put("null-selection-item-id", "No items selected");
return new Element(Tag.valueOf("vaadin-combo-box"), "", attributes);
}

private Element createDesignWithAttributesMultiSelect() {
Attributes attributes = new Attributes();
attributes.put("multi-select", "");
attributes.put("multi-select", true);
attributes.put("item-caption-mode", "EXPLICIT");
attributes.put("null-selection-allowed", "false");
return new Element(Tag.valueOf("vaadin-list-select"), "", attributes);
@@ -302,4 +302,4 @@ public class AbstractSelectDeclarativeTest extends
return ls;
}

}
}

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java View File

@@ -111,7 +111,7 @@ public class OptionGroupDeclarativeTests extends

//@formatter:off
String expected =
"<vaadin-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>"

+ 3
- 3
server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java View File

@@ -38,8 +38,8 @@ public class AbstractSplitPanelDeclarativeTest extends
@Test
public void testWithBothChildren() {
String design = "<vaadin-horizontal-split-panel split-position=20.5% "
+ "min-split-position=20% max-split-position=50px locked='' "
+ "reversed=\"\"> <vaadin-table /> <vaadin-vertical-layout />"
+ "min-split-position=20% max-split-position=50px locked "
+ "reversed> <vaadin-table /> <vaadin-vertical-layout />"
+ "</vaadin-horizontal-split-panel>";
AbstractSplitPanel sp = new HorizontalSplitPanel();
sp.setSplitPosition(20.5f, Unit.PERCENTAGE, true);
@@ -83,4 +83,4 @@ public class AbstractSplitPanelDeclarativeTest extends
testRead(design, sp);
testWrite(design, sp);
}
}
}

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java View File

@@ -34,7 +34,7 @@ public class AbstractTextFieldDeclarativeTest extends
@Test
public void testAttributes() {
String design = "<vaadin-text-field null-representation=this-is-null "
+ "null-setting-allowed='' maxlength=5 columns=3 "
+ "null-setting-allowed maxlength=5 columns=3 "
+ "input-prompt=input text-change-event-mode=eager "
+ "text-change-timeout=100 />";
AbstractTextField tf = new TextField();

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java View File

@@ -43,7 +43,7 @@ public class AudioDeclarativeTest extends DeclarativeTestBase<Audio> {

@Test
public void testAudioMultipleSources() {
String design = "<vaadin-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' />" //

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java View File

@@ -36,7 +36,7 @@ public class VideoDeclarativeTest extends DeclarativeTestBase<Video> {

@Test
public void testVideoMultipleSources() {
String design = "<vaadin-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' />" //

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java View File

@@ -38,13 +38,13 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> {

@Test
public void testEmptyPlainText() {
String design = "<vaadin-button plain-text=''></vaadin-button>";
String design = "<vaadin-button plain-text></vaadin-button>";
testButtonAndNativeButton(design, false, "");
}

@Test
public void testPlainTextCaption() {
String design = "<vaadin-button plain-text=''>Click</vaadin-button>";
String design = "<vaadin-button plain-text>Click</vaadin-button>";
testButtonAndNativeButton(design, false, "Click");
}

@@ -137,7 +137,7 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> {

@Test
public void testAttributes() {
String design = "<vaadin-button tabindex=3 plain-text='' icon-alt=OK "
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);
@@ -146,4 +146,4 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> {
testRead(design, b);
testWrite(design, b);
}
}
}

+ 2
- 2
server/tests/src/com/vaadin/tests/server/component/checkbox/CheckboxDeclarativeTest.java View File

@@ -38,7 +38,7 @@ public class CheckboxDeclarativeTest extends DeclarativeTestBase<CheckBox> {

@Test
public void testUnchecked() {
String design = "<vaadin-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 = "<vaadin-check-box readonly checked='' />";
String design = "<vaadin-check-box readonly checked />";
CheckBox checkBox = new CheckBox();
checkBox.setValue(true);
checkBox.setReadOnly(true);

+ 2
- 2
server/tests/src/com/vaadin/tests/server/component/colorpicker/AbstractColorPickerDeclarativeTest.java View File

@@ -29,7 +29,7 @@ public class AbstractColorPickerDeclarativeTest extends

@Test
public void testAllAbstractColorPickerFeatures() {
String design = "<vaadin-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();
@@ -58,7 +58,7 @@ public class AbstractColorPickerDeclarativeTest extends

@Test
public void testAllAbstractColorPickerAreaFeatures() {
String design = "<vaadin-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();

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldDeclarativeTest.java View File

@@ -44,7 +44,7 @@ public class DateFieldDeclarativeTest extends DeclarativeTestBase<DateField> {
}

private String getTimezoneDesign() {
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\"/>";
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() {

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java View File

@@ -25,11 +25,11 @@ public class GridColumnDeclarativeTest extends GridDeclarativeTestBase {
public void testSimpleGridColumns() {
String design = "<vaadin-grid><table>"//
+ "<colgroup>"
+ " <col sortable='' width='100' property-id='Column1'>"
+ " <col sortable width='100' property-id='Column1'>"
+ " <col sortable=false max-width='200' expand='2' property-id='Column2'>"
+ " <col sortable='' editable=false resizable=false min-width='15' expand='1' property-id='Column3'>"
+ " <col sortable='' hidable='' hiding-toggle-caption='col 4' property-id='Column4'>"
+ " <col sortable='' hidden='' property-id='Column5'>"
+ " <col sortable editable=false resizable=false min-width='15' expand='1' property-id='Column3'>"
+ " <col sortable hidable hiding-toggle-caption='col 4' property-id='Column4'>"
+ " <col sortable hidden property-id='Column5'>"
+ "</colgroup>" //
+ "<thead />" //
+ "</table></vaadin-grid>";

+ 2
- 2
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java View File

@@ -37,8 +37,8 @@ public class GridDeclarativeAttributeTest extends DeclarativeTestBase<Grid> {
@Test
public void testBasicAttributes() {

String design = "<vaadin-grid editable='' rows=20 frozen-columns=-1 "
+ "editor-save-caption='Tallenna' editor-cancel-caption='Peruuta' column-reordering-allowed=''>";
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();
grid.setEditorEnabled(true);

+ 41
- 50
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridHeaderFooterDeclarativeTest.java View File

@@ -35,15 +35,12 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ " <col sortable property-id='Column1'>"
+ " <col sortable property-id='Column2'>"
+ " <col sortable property-id='Column3'>"
+ "</colgroup>"
+ "<thead>"
+ " <tr default=''>"
+ " <th plain-text=''>Column1</th>"
+ " <th plain-text=''>Column2</th>"
+ " <th plain-text=''>Column3</tr>"
+ " <tr default><th plain-text>Column1<th plain-text>Column2<th plain-text>Column3</tr>"
+ "</thead>"
+ "</table></vaadin-grid>";
//@formatter:on
@@ -61,12 +58,11 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>"
+ " <col sortable property-id='Column1'>"
+ " <col sortable property-id='Column2'>"
+ " <col sortable property-id='Column3'>" + "</colgroup>"
+ "<thead>"
+ " <tr default=''><th>Column1<th>Column2<th>Column3</tr>"
+ " <tr default><th>Column1<th>Column2<th>Column3</tr>"
+ "</thead>"
+ "</table></vaadin-grid>";
//@formatter:on
@@ -89,12 +85,11 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ "</colgroup>"
+ "<thead />"
+ " <col sortable property-id='Column1'>"
+ "</colgroup>"
+ "<thead />"
+ "</table></vaadin-grid>";
//@formatter:on

Grid grid = new Grid();
grid.addColumn("Column1", String.class);
grid.removeHeaderRow(grid.getDefaultHeaderRow());
@@ -108,18 +103,17 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>"
+ "<thead>"
+ " <col sortable property-id='Column1'>"
+ " <col sortable property-id='Column2'>"
+ " <col sortable property-id='Column3'>"
+ "</colgroup>"
+ "<thead>"
+ " <tr><th colspan=3>Baz</tr>"
+ " <tr default=''><th>Column1<th>Column2<th>Column3</tr>"
+ " <tr><th>Foo<th colspan=2>Bar</tr>"
+ "</thead>"
+ " <tr default><th>Column1<th>Column2<th>Column3</tr>"
+ " <tr><th>Foo<th colspan=2>Bar</tr>"
+ "</thead>"
+ "</table></vaadin-grid>";
//@formatter:on

Grid grid = new Grid();
grid.addColumn("Column1", String.class);
grid.addColumn("Column2", String.class);
@@ -145,17 +139,16 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>"
+ " <col sortable property-id='Column1'>"
+ " <col sortable property-id='Column2'>"
+ " <col sortable property-id='Column3'>"
+ "</colgroup>"
+ "<thead />" // No headers read or written
+ "<tfoot>"
+ " <tr><td plain-text=''>Column1<td plain-text=''>Column2<td plain-text=''>Column3</tr>"
+ "</tfoot>"
+ "<tfoot>"
+ " <tr><td plain-text>Column1<td plain-text>Column2<td plain-text>Column3</tr>"
+ "</tfoot>"
+ "</table></vaadin-grid>";
//@formatter:on

Grid grid = new Grid();
grid.addColumn("Column1", String.class);
grid.addColumn("Column2", String.class);
@@ -177,10 +170,9 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>"
+ " <col sortable property-id='Column1'>"
+ " <col sortable property-id='Column2'>"
+ " <col sortable property-id='Column3'>" + "</colgroup>"
+ "<thead />" // No headers read or written
+ "<tfoot>"
+ " <tr><td>Column1<td>Column2<td>Column3</tr>"
@@ -209,12 +201,12 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>"
+ " <col sortable property-id='Column1'>"
+ " <col sortable property-id='Column2'>"
+ " <col sortable property-id='Column3'>"
+ "</colgroup>"
+ "<thead />" // No headers read or written.
+ "<tfoot>"
+ "<tfoot>"
+ " <tr><td colspan=3>Baz</tr>"
+ " <tr><td>Column1<td>Column2<td>Column3</tr>"
+ " <tr><td>Foo<td colspan=2>Bar</tr>"
@@ -249,14 +241,13 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ "</colgroup>"
+ "<thead>"
+ "<tr default=''><th><vaadin-label><b>Foo</b></vaadin-label></tr>"
+ " <col sortable property-id='Column1'>"
+ "</colgroup>"
+ "<thead>"
+ "<tr default><th><vaadin-label><b>Foo</b></vaadin-label></tr>"
+ "</thead>"
+ "</table></vaadin-grid>";
//@formatter:on

//@formatter:on
Label component = new Label("<b>Foo</b>");
component.setContentMode(ContentMode.HTML);

@@ -273,8 +264,8 @@ public class GridHeaderFooterDeclarativeTest extends GridDeclarativeTestBase {
//@formatter:off
String design = "<vaadin-grid><table>"
+ "<colgroup>"
+ " <col sortable='' property-id='Column1'>"
+ "</colgroup>"
+ " <col sortable property-id='Column1'>"
+ "</colgroup>"
+ "<thead />" // No headers read or written
+ "<tfoot>"
+ "<tr><td><vaadin-label><b>Foo</b></vaadin-label></tr>"

+ 7
- 7
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridInlineDataDeclarativeTest.java View File

@@ -27,7 +27,7 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase {
public void testSimpleInlineData() {
String design = "<vaadin-grid><table>"//
+ "<colgroup>"
+ " <col sortable='' property-id='Col1' />"
+ " <col sortable property-id='Col1' />"
+ "</colgroup>" //
+ "<thead />" // No headers read or written
+ "<tbody>" //
@@ -54,9 +54,9 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase {
public void testMultipleColumnsInlineData() {
String design = "<vaadin-grid><table>"//
+ "<colgroup>"
+ " <col sortable='' property-id='Col1' />"
+ " <col sortable='' property-id='Col2' />"
+ " <col sortable='' property-id='Col3' />" //
+ " <col sortable property-id='Col1' />"
+ " <col sortable property-id='Col2' />"
+ " <col sortable property-id='Col3' />" //
+ "</colgroup>" //
+ "<thead />" // No headers read or written
+ "<tbody>" //
@@ -83,9 +83,9 @@ public class GridInlineDataDeclarativeTest extends GridDeclarativeTestBase {
public void testMultipleColumnsInlineDataReordered() {
String design = "<vaadin-grid><table>"//
+ "<colgroup>"
+ " <col sortable='' property-id='Col2' />"
+ " <col sortable='' property-id='Col3' />"
+ " <col sortable='' property-id='Col1' />" //
+ " <col sortable property-id='Col2' />"
+ " <col sortable property-id='Col3' />"
+ " <col sortable property-id='Col1' />" //
+ "</colgroup>" //
+ "<thead />" // No headers read or written
+ "<tbody>" //

+ 26
- 0
server/tests/src/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java View File

@@ -22,10 +22,13 @@ import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;

import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.server.component.DeclarativeMarginTestBase;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.declarative.Design;
import com.vaadin.ui.declarative.DesignContext;

@@ -259,4 +262,27 @@ public class GridLayoutDeclarativeTest extends

Assert.assertEquals(layout.getRows(), readLayout.getRows());
}

@Test
public void testGridLayoutAlignments() {
String design = "<vaadin-grid-layout><row>" //
+ "<column><vaadin-label :middle>0</label></column>"//
+ "<column><vaadin-label :right>1</label>"//
+ "</row><row>" //
+ "<column><vaadin-label :bottom :center>2</label></column>"//
+ "<column><vaadin-label :middle :center>3</label>" //
+ "</row></vaadin-grid-layout>";
GridLayout gl = new GridLayout(2, 2);

Alignment[] alignments = { Alignment.MIDDLE_LEFT, Alignment.TOP_RIGHT,
Alignment.BOTTOM_CENTER, Alignment.MIDDLE_CENTER };
for (int i = 0; i < 4; i++) {
Label child = new Label("" + i, ContentMode.HTML);
gl.addComponent(child);
gl.setComponentAlignment(child, alignments[i]);
}

testWrite(design, gl);
testRead(design, gl);
}
}

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/passwordfield/PasswordFieldDeclarativeTest.java View File

@@ -30,7 +30,7 @@ public class PasswordFieldDeclarativeTest extends

@Test
public void testReadOnlyValue() {
String design = "<vaadin-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);

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/popupview/PopupViewDeclarativeTest.java View File

@@ -48,7 +48,7 @@ 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 = "<vaadin-popup-view popup-visible=''>" //
String design = "<vaadin-popup-view popup-visible>" //
+ "Click <u>here</u> to open"
+ "<popup-content>"
+ new DesignContext().createElement(verticalLayout)

+ 2
- 3
server/tests/src/com/vaadin/tests/server/component/progressbar/ProgressBarDeclarativeTest.java View File

@@ -29,8 +29,7 @@ public class ProgressBarDeclarativeTest extends
DeclarativeTestBase<ProgressBar> {

public String getBasicDesign() {
return "<vaadin-progress-bar value=0.5 indeterminate=''>";

return "<vaadin-progress-bar value=0.5 indeterminate>";
}

public ProgressBar getBasicExpected() {
@@ -62,7 +61,7 @@ public class ProgressBarDeclarativeTest extends

@Test
public void testReadOnlyValue() {
String design = "<vaadin-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);

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaDeclarativeTest.java View File

@@ -24,7 +24,7 @@ public class RichTextAreaDeclarativeTest extends
DeclarativeTestBase<RichTextArea> {

private String getBasicDesign() {
return "<vaadin-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 "
+ "</vaadin-rich-text-area>";
}

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTest.java View File

@@ -40,10 +40,10 @@ public class TableDeclarativeTest extends TableDeclarativeTestBase {

String design = "<"
+ getTag()
+ " page-length=30 cache-rate=3 selectable='' editable='' "
+ " page-length=30 cache-rate=3 selectable editable "
+ "sortable=false sort-ascending=false sort-container-property-id=foo "
+ "drag-mode=row multi-select-mode=simple column-header-mode=id row-header-mode=id "
+ "column-reordering-allowed='' column-collapsing-allowed='' />";
+ "column-reordering-allowed column-collapsing-allowed />";

Table table = getTable();
table.setPageLength(30);
@@ -71,12 +71,12 @@ public class TableDeclarativeTest extends TableDeclarativeTestBase {
public void testColumns() {
String design = "<"
+ getTag()
+ " column-collapsing-allowed=''>" //
+ " column-collapsing-allowed>" //
+ " <table>" //
+ " <colgroup>"
+ " <col property-id='foo' width=300>"
+ " <col property-id='bar' center expand=1 collapsible=false>"
+ " <col property-id='baz' right expand=2 collapsed=''>"
+ " <col property-id='baz' right expand=2 collapsed>"
+ " </colgroup>" //
+ " </table>";


+ 5
- 5
server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java View File

@@ -36,7 +36,7 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase<TabSheet> {
@Test
public void testFeatures() {
String design = "<vaadin-tab-sheet tabindex=5><tab caption=test-caption "
+ "visible=false closable='' enabled=false icon=http://www.vaadin.com/test.png"
+ "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><vaadin-text-field/></tab></vaadin-tab-sheet>";
TabSheet ts = new TabSheet();
@@ -59,7 +59,7 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase<TabSheet> {

@Test
public void testSelected() {
String design = "<vaadin-tab-sheet><tab selected=''><vaadin-text-field/></tab></vaadin-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);
@@ -71,9 +71,9 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase<TabSheet> {
@Test
public void tabsNotShown() {
String design = "<vaadin-tab-sheet tabs-visible=\"false\">\n"
+ " <tab caption=\"My Tab\" selected=\"\">\n"
+ " <vaadin-label>My Content</vaadin-label>\n" + " </tab>\n"
+ "</vaadin-tab-sheet>\n";
+ " <tab caption=\"My Tab\" selected>\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);

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/textfield/TextFieldDeclarativeTest.java View File

@@ -47,7 +47,7 @@ public class TextFieldDeclarativeTest extends DeclarativeTestBase<TextField> {

@Test
public void testReadOnlyValue() {
String design = "<vaadin-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);

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableDeclarativeTest.java View File

@@ -33,7 +33,7 @@ public class TreeTableDeclarativeTest extends TableDeclarativeTest {

@Test
public void testAttributes() {
String design = "<vaadin-tree-table animations-enabled=''>";
String design = "<vaadin-tree-table animations-enabled>";
TreeTable table = getTable();
table.setAnimationsEnabled(true);


+ 12
- 7
server/tests/src/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java View File

@@ -50,10 +50,10 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> {
public void testFeatures() {

String design = "<vaadin-window position='100,100' window-mode='maximized' "
+ "center modal='' resizable=false resize-lazy='' closable=false draggable=false "
+ "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-enabled "
+ "tab-stop-top-assistive-text='Do not move above the window' "
+ "tab-stop-bottom-assistive-text='End of window'>"
+ "</vaadin-window>";
@@ -169,9 +169,11 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> {
Label assistive2 = new Label("More assistive text");

String design = "<vaadin-window>"
+ createElement(assistive1).attr(":assistive-description", "")
+ createElement(assistive1)
.attr(":assistive-description", true)
+ createElement(new Button("OK"))
+ createElement(assistive2).attr(":assistive-description", "");
+ createElement(assistive2)
.attr(":assistive-description", true);

Window expected = new Window();
expected.setContent(new Button("OK"));
@@ -179,9 +181,12 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> {

testRead(design, expected);

String written = "<vaadin-window>" + createElement(new Button("OK"))
+ createElement(assistive1).attr(":assistive-description", "")
+ createElement(assistive2).attr(":assistive-description", "");
String written = "<vaadin-window>"
+ createElement(new Button("OK"))
+ createElement(assistive1)
.attr(":assistive-description", true)
+ createElement(assistive2)
.attr(":assistive-description", true);

testWrite(written, expected);
}

Loading…
Cancel
Save