浏览代码

Write true as attribute="" (#17519)

Change-Id: I49287cc38605abb75059cb553e3baed2a8359067
tags/7.6.0.alpha2
Leif Åstrand 9 年前
父节点
当前提交
122fccfe01
共有 28 个文件被更改,包括 105 次插入104 次删除
  1. 6
    6
      server/src/com/vaadin/ui/AbstractComponent.java
  2. 5
    1
      server/src/com/vaadin/ui/declarative/DesignFormatter.java
  3. 10
    11
      server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java
  4. 1
    1
      server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java
  5. 1
    1
      server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java
  6. 5
    5
      server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java
  7. 8
    8
      server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java
  8. 4
    4
      server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java
  9. 4
    4
      server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java
  10. 1
    1
      server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java
  11. 1
    1
      server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java
  12. 1
    1
      server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java
  13. 1
    1
      server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java
  14. 1
    1
      server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java
  15. 1
    1
      server/tests/src/com/vaadin/tests/server/component/checkbox/CheckboxDeclarativeTest.java
  16. 2
    2
      server/tests/src/com/vaadin/tests/server/component/colorpicker/AbstractColorPickerDeclarativeTest.java
  17. 1
    1
      server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldDeclarativeTest.java
  18. 4
    4
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java
  19. 2
    2
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java
  20. 25
    27
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridHeaderFooterDeclarativeTest.java
  21. 7
    7
      server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridInlineDataDeclarativeTest.java
  22. 1
    1
      server/tests/src/com/vaadin/tests/server/component/popupview/PopupViewDeclarativeTest.java
  23. 1
    1
      server/tests/src/com/vaadin/tests/server/component/progressbar/ProgressBarDeclarativeTest.java
  24. 1
    1
      server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaDeclarativeTest.java
  25. 4
    4
      server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTest.java
  26. 4
    4
      server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java
  27. 1
    1
      server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableDeclarativeTest.java
  28. 2
    2
      server/tests/src/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java

+ 6
- 6
server/src/com/vaadin/ui/AbstractComponent.java 查看文件



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

+ 5
- 1
server/src/com/vaadin/ui/declarative/DesignFormatter.java 查看文件

public String convertToPresentation(Boolean value, public String convertToPresentation(Boolean value,
Class<? extends String> targetType, Locale locale) Class<? extends String> targetType, Locale locale)
throws Converter.ConversionException { throws Converter.ConversionException {
return String.valueOf(value.booleanValue());
if (value.booleanValue()) {
return "";
} else {
return "false";
}
} }


@Override @Override

+ 10
- 11
server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java 查看文件

@Test @Test
// #16328 // #16328
public void testReadWrite() throws IOException { public void testReadWrite() throws IOException {
String design = "<v-menu-bar auto-open='true' tabindex=5>"
+ "<menu checkable='true'>Save</menu>"
String design = "<v-menu-bar auto-open='' tabindex=5>"
+ "<menu checkable=''>Save</menu>"
+ "<menu description='Open a file'>Open</menu>" + "<menu description='Open a file'>Open</menu>"
+ "<menu disabled='true'>Close</menu>"
+ "<menu disabled=''>Close</menu>"
+ "<menu icon='http://foo.bar/ico.png'>Help</menu>" + "<menu icon='http://foo.bar/ico.png'>Help</menu>"
+ "<menu visible='false'>About</menu>" + "<menu visible='false'>About</menu>"
+ "<menu>Sub<menu>Item</menu></menu>" + "<menu>Sub<menu>Item</menu></menu>"
@Test @Test
// #16328 // #16328
public void testTicketSpec1() throws IOException { public void testTicketSpec1() throws IOException {
String design = "<v-menu-bar auto-open='true' plain-text tabindex=5> "
String design = "<v-menu-bar auto-open='' plain-text tabindex=5> "
+ "<menu>File" + "<menu>File"
+ "<menu>Save</menu>" + "<menu>Save</menu>"
+ "<menu icon=\"theme://../runo/icons/16/folder.png\">Open</menu>" + "<menu icon=\"theme://../runo/icons/16/folder.png\">Open</menu>"
+ "<menu separator='true' />"
+ "<menu disabled='true'>Exit</menu>"
+ "<menu separator='' />"
+ "<menu disabled=''>Exit</menu>"
+ "<menu visible='false'>Not for everybody</menu>" + "<menu visible='false'>Not for everybody</menu>"
+ "</menu>" + "</menu>"
+ "<menu description=\"This contains many items in sub menus\">Other" + "<menu description=\"This contains many items in sub menus\">Other"
+ "<menu style-name=\"fancy\">Sub" + "<menu style-name=\"fancy\">Sub"
+ "<menu checkable='true' checked='true'>Option 1 - no <b>html</b></menu>"
+ "<menu checkable='true'>Option 2</menu>"
+ "<menu checkable='true'>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>" // + "</menu>" //
+ "<menu more icon=\"theme://icon.png\">foo</menu>" + "<menu more icon=\"theme://icon.png\">foo</menu>"
+ "<menu><b>File</b>" + "<menu><b>File</b>"
+ "<menu><font style=\"color: red\">Save</font></menu>" + "<menu><font style=\"color: red\">Save</font></menu>"
+ "<menu icon=\"theme://../runo/icons/16/folder.png\">Open</menu>" + "<menu icon=\"theme://../runo/icons/16/folder.png\">Open</menu>"
+ "<menu separator='true' />"
+ "<menu disabled='true'>Exit</menu>" //
+ "<menu separator='' />" + "<menu disabled=''>Exit</menu>" //
+ "</menu></v-menu-bar>"; + "</menu></v-menu-bar>";
MenuBar menuBar = new MenuBar(); MenuBar menuBar = new MenuBar();
menuBar.setHtmlContentAllowed(true); menuBar.setHtmlContentAllowed(true);

+ 1
- 1
server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java 查看文件

label.setContentMode(ContentMode.HTML); label.setContentMode(ContentMode.HTML);
label.setResponsive(true); label.setResponsive(true);


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


testWrite(design, label); testWrite(design, label);
testRead(design, label); testRead(design, label);

+ 1
- 1
server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java 查看文件



@Test @Test
public void testBoolean() { public void testBoolean() {
assertEquals("true", formatter.format(true));
assertEquals("", formatter.format(true));
assertEquals("false", formatter.format(false)); assertEquals("false", formatter.format(false));


assertEquals(true, formatter.parse("true", boolean.class)); assertEquals(true, formatter.parse("true", boolean.class));

+ 5
- 5
server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java 查看文件

String s = "<" + componentTag + " "; String s = "<" + componentTag + " ";


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

+ 8
- 8
server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java 查看文件

public void testProperties() { public void testProperties() {
String design = "<v-label id=\"testId\" primary-style-name=\"test-style\" " String design = "<v-label id=\"testId\" primary-style-name=\"test-style\" "
+ "caption=\"test-caption\" locale=\"fi_FI\" description=\"test-description\" " + "caption=\"test-caption\" locale=\"fi_FI\" description=\"test-description\" "
+ "error=\"<div>test-error</div>\" immediate=\"true\"/>";
+ "error=\"<div>test-error</div>\" immediate=\"\"/>";
component.setId("testId"); component.setId("testId");
component.setPrimaryStyleName("test-style"); component.setPrimaryStyleName("test-style");
component.setCaption("test-caption"); component.setCaption("test-caption");


@Test @Test
public void testSizeFull() { public void testSizeFull() {
String design = "<v-label size-full=\"true\"/>";
String design = "<v-label size-full=\"\"/>";
component.setSizeFull(); component.setSizeFull();
testRead(design, component); testRead(design, component);
testWrite(design, component); testWrite(design, component);


@Test @Test
public void testSizeAuto() { public void testSizeAuto() {
String design = "<v-label size-auto=\"true\"/>";
String design = "<v-label size-auto=\"\"/>";
component.setSizeUndefined(); component.setSizeUndefined();
testRead(design, component); testRead(design, component);
testWrite(design, component); testWrite(design, component);


@Test @Test
public void testHeightFull() { public void testHeightFull() {
String design = "<v-label height-full=\"true\"/ width=\"20px\"/>";
String design = "<v-label height-full=\"\"/ width=\"20px\"/>";
component.setHeight("100%"); component.setHeight("100%");
component.setWidth("20px"); component.setWidth("20px");
testRead(design, component); testRead(design, component);


@Test @Test
public void testHeightAuto() { public void testHeightAuto() {
String design = "<v-horizontal-split-panel height-auto=\"true\"/ width=\"20px\" >";
String design = "<v-horizontal-split-panel height-auto=\"\"/ width=\"20px\" >";
// we need to have default height of 100% -> use split panel // we need to have default height of 100% -> use split panel
AbstractComponent component = new HorizontalSplitPanel(); AbstractComponent component = new HorizontalSplitPanel();
component.setHeight(null); component.setHeight(null);


@Test @Test
public void testWidthFull() { public void testWidthFull() {
String design = "<v-button width-full=\"true\"/ height=\"20px\">Foo</button>";
String design = "<v-button width-full=\"\"/ height=\"20px\">Foo</button>";
AbstractComponent component = new Button(); AbstractComponent component = new Button();
component.setCaptionAsHtml(true); component.setCaptionAsHtml(true);
component.setCaption("Foo"); component.setCaption("Foo");


@Test @Test
public void testWidthAuto() { public void testWidthAuto() {
String design = "<v-label height=\"20px\"/ width-auto=\"true\"/>";
String design = "<v-label height=\"20px\"/ width-auto=\"\"/>";
component.setCaptionAsHtml(false); component.setCaptionAsHtml(false);
component.setHeight("20px"); component.setHeight("20px");
component.setWidth(null); component.setWidth(null);


@Test @Test
public void testResponsive() { public void testResponsive() {
String design = "<v-label responsive =\"true\"/>";
String design = "<v-label responsive =\"\"/>";
Responsive.makeResponsive(component); Responsive.makeResponsive(component);
testRead(design, component); testRead(design, component);
testWrite(design, component); testWrite(design, component);

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java 查看文件



@Test @Test
public void testPlainText() { public void testPlainText() {
String design = "<v-text-field buffered='true' validation-visible='false' invalid-committed='true'"
+ " invalid-allowed='false' required='true' required-error='This is a required field'"
+ " conversion-error='Input {0} cannot be parsed' tabindex=3 readonly='true'/>";
String design = "<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=''/>";
AbstractField tf = new TextField(); AbstractField tf = new TextField();
tf.setBuffered(true); tf.setBuffered(true);
tf.setBuffered(true); tf.setBuffered(true);
testWrite(design, tf); testWrite(design, tf);


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

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java 查看文件

DeclarativeTestBase<AbstractSelect> { DeclarativeTestBase<AbstractSelect> {


public String getDesignSingleSelectNewItemsAllowed() { public String getDesignSingleSelectNewItemsAllowed() {
return "<v-combo-box new-items-allowed='true' item-caption-mode='icon_only'"
return "<v-combo-box new-items-allowed='' item-caption-mode='icon_only'"
+ " null-selection-item-id='nullIid'/>"; + " null-selection-item-id='nullIid'/>";


} }
} }


public String getDesignMultiSelect() { public String getDesignMultiSelect() {
return "<v-list-select multi-select='true' null-selection-allowed='false' new-items-allowed='true' item-caption-mode='property' />";
return "<v-list-select multi-select='' null-selection-allowed='false' new-items-allowed='' item-caption-mode='property' />";
} }


public AbstractSelect getExpectedMultiSelect() { public AbstractSelect getExpectedMultiSelect() {
attributes.put("item-caption-mode", "property"); attributes.put("item-caption-mode", "property");
attributes.put("item-caption-property-id", "name"); attributes.put("item-caption-property-id", "name");
attributes.put("item-icon-property-id", "icon"); attributes.put("item-icon-property-id", "icon");
attributes.put("null-selection-allowed", "true");
attributes.put("null-selection-allowed", "");
attributes.put("null-selection-item-id", "No items selected"); attributes.put("null-selection-item-id", "No items selected");
return new Element(Tag.valueOf("v-combo-box"), "", attributes); return new Element(Tag.valueOf("v-combo-box"), "", attributes);
} }
assertEquals("Wrong caption for the combo box.", "A combo box", assertEquals("Wrong caption for the combo box.", "A combo box",
e.attr("caption")); e.attr("caption"));
Assert.assertTrue("Adding new items should be allowed.", Assert.assertTrue("Adding new items should be allowed.",
"true".equals(e.attr("new-items-allowed")));
"".equals(e.attr("new-items-allowed")));
assertEquals("Wrong item caption mode.", "icon_only", assertEquals("Wrong item caption mode.", "icon_only",
e.attr("item-caption-mode")); e.attr("item-caption-mode"));
assertEquals("Wrong item icon property id.", "icon", assertEquals("Wrong item icon property id.", "icon",

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java 查看文件



//@formatter:off //@formatter:off
String expected = String expected =
"<v-option-group html-content-allowed='true'>"
"<v-option-group html-content-allowed=''>"
+ "<option item-id=\"foo\"><b>True</b></option>" + "<option item-id=\"foo\"><b>True</b></option>"
+ "<option item-id=\"bar\"><font color='red'>False</font></option>" + "<option item-id=\"bar\"><font color='red'>False</font></option>"
+ "<option>baz</option>" + "<option>baz</option>"

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java 查看文件

@Test @Test
public void testWithBothChildren() { public void testWithBothChildren() {
String design = "<v-horizontal-split-panel split-position=20.5% " String design = "<v-horizontal-split-panel split-position=20.5% "
+ "min-split-position=20% max-split-position=50px locked=true "
+ "min-split-position=20% max-split-position=50px locked='' "
+ "reversed=\"\"> <v-table /> <v-vertical-layout />" + "reversed=\"\"> <v-table /> <v-vertical-layout />"
+ "</v-horizontal-split-panel>"; + "</v-horizontal-split-panel>";
AbstractSplitPanel sp = new HorizontalSplitPanel(); AbstractSplitPanel sp = new HorizontalSplitPanel();

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java 查看文件

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

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java 查看文件



@Test @Test
public void testAudioMultipleSources() { public void testAudioMultipleSources() {
String design = "<v-audio muted='true' show-controls='false'>"
String design = "<v-audio muted='' show-controls='false'>"
+ "some <b>text</b>" // + "some <b>text</b>" //
+ "<source href='http://foo.pl' />" + "<source href='http://foo.pl' />"
+ "<source href='https://bar.pl' />" // + "<source href='https://bar.pl' />" //

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java 查看文件



@Test @Test
public void testVideoMultipleSources() { public void testVideoMultipleSources() {
String design = "<v-video muted='true' show-controls='false'>"
String design = "<v-video muted='' show-controls='false'>"
+ "some <b>text</b>" // + "some <b>text</b>" //
+ "<source href='http://foo.pl' />" + "<source href='http://foo.pl' />"
+ "<source href='https://bar.pl' />" // + "<source href='https://bar.pl' />" //

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/checkbox/CheckboxDeclarativeTest.java 查看文件



@Test @Test
public void testUnchecked() { public void testUnchecked() {
String design = "<v-check-box checked='true' />";
String design = "<v-check-box checked='' />";
CheckBox checkBox = new CheckBox(); CheckBox checkBox = new CheckBox();
checkBox.setValue(true); checkBox.setValue(true);
testRead(design, checkBox); testRead(design, checkBox);

+ 2
- 2
server/tests/src/com/vaadin/tests/server/component/colorpicker/AbstractColorPickerDeclarativeTest.java 查看文件



@Test @Test
public void testAllAbstractColorPickerFeatures() { public void testAllAbstractColorPickerFeatures() {
String design = "<v-color-picker color='#fafafa' default-caption-enabled='true' position='100,100'"
String design = "<v-color-picker color='#fafafa' default-caption-enabled='' position='100,100'"
+ " popup-style='simple' rgb-visibility='false' hsv-visibility='false'" + " popup-style='simple' rgb-visibility='false' hsv-visibility='false'"
+ " history-visibility=false textfield-visibility=false />"; + " history-visibility=false textfield-visibility=false />";
ColorPicker colorPicker = new ColorPicker(); ColorPicker colorPicker = new ColorPicker();


@Test @Test
public void testAllAbstractColorPickerAreaFeatures() { public void testAllAbstractColorPickerAreaFeatures() {
String design = "<v-color-picker-area color='#fafafa' default-caption-enabled='true' position='100,100'"
String design = "<v-color-picker-area color='#fafafa' default-caption-enabled='' position='100,100'"
+ " popup-style='simple' rgb-visibility='false' hsv-visibility='false'" + " popup-style='simple' rgb-visibility='false' hsv-visibility='false'"
+ " history-visibility=false textfield-visibility=false />"; + " history-visibility=false textfield-visibility=false />";
AbstractColorPicker colorPicker = new ColorPickerArea(); AbstractColorPicker colorPicker = new ColorPickerArea();

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/datefield/DateFieldDeclarativeTest.java 查看文件

} }


private String getTimezoneDesign() { 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='true' show-iso-week-numbers='true' parse-error-message=\"You are doing it wrong\" time-zone=\"GMT+05:00\" value=\"2014-05-15 00:00:00+0300\"/>";
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\"/>";
} }


private DateField getTimezoneExpected() { private DateField getTimezoneExpected() {

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridColumnDeclarativeTest.java 查看文件

public void testSimpleGridColumns() { public void testSimpleGridColumns() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true 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=false max-width='200' expand='2' property-id='Column2'>"
+ " <col sortable=true editable=false min-width='15' expand='1' property-id='Column3'>"
+ " <col sortable=true hidable=true hiding-toggle-caption='col 4' property-id='Column4'>"
+ " <col sortable=true hidden=true property-id='Column5'>"
+ " <col sortable='' editable=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>" // + "</colgroup>" //
+ "<thead />" // + "<thead />" //
+ "</table></v-grid>"; + "</table></v-grid>";

+ 2
- 2
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java 查看文件

@Test @Test
public void testBasicAttributes() { public void testBasicAttributes() {


String design = "<v-grid editable='true' rows=20 frozen-columns=-1 "
+ "editor-save-caption='Tallenna' editor-cancel-caption='Peruuta' column-reordering-allowed=true>";
String design = "<v-grid editable='' rows=20 frozen-columns=-1 "
+ "editor-save-caption='Tallenna' editor-cancel-caption='Peruuta' column-reordering-allowed=''>";


Grid grid = new Grid(); Grid grid = new Grid();
grid.setEditorEnabled(true); grid.setEditorEnabled(true);

+ 25
- 27
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridHeaderFooterDeclarativeTest.java 查看文件

public void testSingleDefaultHeader() { public void testSingleDefaultHeader() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable=true property-id='Column2'>"
+ " <col sortable=true property-id='Column3'>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead>" // + "<thead>" //
+ " <tr default='true'><th plain-text=''>Column1<th plain-text=''>Column2<th plain-text=''>Column3</tr>" //
+ " <tr default=''><th plain-text=''>Column1<th plain-text=''>Column2<th plain-text=''>Column3</tr>" //
+ "</thead>" // + "</thead>" //
+ "</table></v-grid>"; + "</table></v-grid>";
Grid grid = new Grid(); Grid grid = new Grid();
public void testSingleDefaultHTMLHeader() { public void testSingleDefaultHTMLHeader() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable=true property-id='Column2'>"
+ " <col sortable=true property-id='Column3'>"
+ "</colgroup>" //
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>" + "</colgroup>" //
+ "<thead>" // + "<thead>" //
+ " <tr default='true'><th>Column1<th>Column2<th>Column3</tr>" //
+ " <tr default=''><th>Column1<th>Column2<th>Column3</tr>" //
+ "</thead>" // + "</thead>" //
+ "</table></v-grid>"; + "</table></v-grid>";
Grid grid = new Grid(); Grid grid = new Grid();
public void testNoHeaderRows() { public void testNoHeaderRows() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable='' property-id='Column1'>"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead />" // + "<thead />" //
+ "</table></v-grid>"; + "</table></v-grid>";
public void testMultipleHeadersWithColSpans() { public void testMultipleHeadersWithColSpans() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable=true property-id='Column2'>"
+ " <col sortable=true property-id='Column3'>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead>" // + "<thead>" //
+ " <tr><th colspan=3>Baz</tr>" + " <tr><th colspan=3>Baz</tr>"
+ " <tr default='true'><th>Column1<th>Column2<th>Column3</tr>" //
+ " <tr default=''><th>Column1<th>Column2<th>Column3</tr>" //
+ " <tr><th>Foo<th colspan=2>Bar</tr>" // + " <tr><th>Foo<th colspan=2>Bar</tr>" //
+ "</thead>" // + "</thead>" //
+ "</table></v-grid>"; + "</table></v-grid>";
public void testSingleDefaultFooter() { public void testSingleDefaultFooter() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable=true property-id='Column2'>"
+ " <col sortable=true property-id='Column3'>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead />" // No headers read or written + "<thead />" // No headers read or written
+ "<tfoot>" // + "<tfoot>" //
public void testSingleDefaultHTMLFooter() { public void testSingleDefaultHTMLFooter() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable=true property-id='Column2'>"
+ " <col sortable=true 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 + "<thead />" // No headers read or written
+ "<tfoot>" // + "<tfoot>" //
+ " <tr><td>Column1<td>Column2<td>Column3</tr>" // + " <tr><td>Column1<td>Column2<td>Column3</tr>" //
public void testMultipleFootersWithColSpans() { public void testMultipleFootersWithColSpans() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable=true property-id='Column2'>"
+ " <col sortable=true property-id='Column3'>"
+ " <col sortable='' property-id='Column1'>"
+ " <col sortable='' property-id='Column2'>"
+ " <col sortable='' property-id='Column3'>"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead />" // No headers read or written. + "<thead />" // No headers read or written.
+ "<tfoot>" // + "<tfoot>" //
public void testComponentInGridHeader() { public void testComponentInGridHeader() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable='' property-id='Column1'>"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead>" // + "<thead>" //
+ "<tr default=true><th><v-label><b>Foo</b></v-label></tr>"
+ "<tr default=''><th><v-label><b>Foo</b></v-label></tr>"
+ "</thead>"// + "</thead>"//
+ "</table></v-grid>"; + "</table></v-grid>";


public void testComponentInGridFooter() { public void testComponentInGridFooter() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Column1'>"
+ " <col sortable='' property-id='Column1'>"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead />" // No headers read or written + "<thead />" // No headers read or written
+ "<tfoot>" // + "<tfoot>" //

+ 7
- 7
server/tests/src/com/vaadin/tests/server/component/grid/declarative/GridInlineDataDeclarativeTest.java 查看文件

public void testSimpleInlineData() { public void testSimpleInlineData() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Col1' />"
+ " <col sortable='' property-id='Col1' />"
+ "</colgroup>" // + "</colgroup>" //
+ "<thead />" // No headers read or written + "<thead />" // No headers read or written
+ "<tbody>" // + "<tbody>" //
public void testMultipleColumnsInlineData() { public void testMultipleColumnsInlineData() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Col1' />"
+ " <col sortable=true property-id='Col2' />"
+ " <col sortable=true property-id='Col3' />" //
+ " <col sortable='' property-id='Col1' />"
+ " <col sortable='' property-id='Col2' />"
+ " <col sortable='' property-id='Col3' />" //
+ "</colgroup>" // + "</colgroup>" //
+ "<thead />" // No headers read or written + "<thead />" // No headers read or written
+ "<tbody>" // + "<tbody>" //
public void testMultipleColumnsInlineDataReordered() { public void testMultipleColumnsInlineDataReordered() {
String design = "<v-grid><table>"// String design = "<v-grid><table>"//
+ "<colgroup>" + "<colgroup>"
+ " <col sortable=true property-id='Col2' />"
+ " <col sortable=true property-id='Col3' />"
+ " <col sortable=true property-id='Col1' />" //
+ " <col sortable='' property-id='Col2' />"
+ " <col sortable='' property-id='Col3' />"
+ " <col sortable='' property-id='Col1' />" //
+ "</colgroup>" // + "</colgroup>" //
+ "<thead />" // No headers read or written + "<thead />" // No headers read or written
+ "<tbody>" // + "<tbody>" //

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/popupview/PopupViewDeclarativeTest.java 查看文件

component.setHideOnMouseOut(true); component.setHideOnMouseOut(true);
component.setPopupVisible(true); component.setPopupVisible(true);
// hide-on-mouse-out is true by default. not seen in design // hide-on-mouse-out is true by default. not seen in design
String design = "<v-popup-view popup-visible='true'>" //
String design = "<v-popup-view popup-visible=''>" //
+ "Click <u>here</u> to open" + "Click <u>here</u> to open"
+ "<popup-content>" + "<popup-content>"
+ new DesignContext().createElement(verticalLayout) + new DesignContext().createElement(verticalLayout)

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/progressbar/ProgressBarDeclarativeTest.java 查看文件

DeclarativeTestBase<ProgressBar> { DeclarativeTestBase<ProgressBar> {


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


} }



+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaDeclarativeTest.java 查看文件

DeclarativeTestBase<RichTextArea> { DeclarativeTestBase<RichTextArea> {


private String getBasicDesign() { private String getBasicDesign() {
return "<v-rich-text-area null-representation='' null-setting-allowed='true'>\n"
return "<v-rich-text-area null-representation='' null-setting-allowed=''>\n"
+ "\n <b>Header</b> <br/>Some text\n " + "\n <b>Header</b> <br/>Some text\n "
+ "</v-rich-text-area>"; + "</v-rich-text-area>";
} }

+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTest.java 查看文件



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


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



+ 4
- 4
server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java 查看文件

@Test @Test
public void testFeatures() { public void testFeatures() {
String design = "<v-tab-sheet tabindex=5><tab caption=test-caption " String design = "<v-tab-sheet tabindex=5><tab caption=test-caption "
+ "visible=false closable=true 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 " + " icon-alt=OK description=test-desc style-name=test-style "
+ "id=test-id><v-text-field/></tab></v-tab-sheet>"; + "id=test-id><v-text-field/></tab></v-tab-sheet>";
TabSheet ts = new TabSheet(); TabSheet ts = new TabSheet();


@Test @Test
public void testSelected() { public void testSelected() {
String design = "<v-tab-sheet><tab selected=true><v-text-field/></tab></v-tab-sheet>";
String design = "<v-tab-sheet><tab selected=''><v-text-field/></tab></v-tab-sheet>";
TabSheet ts = new TabSheet(); TabSheet ts = new TabSheet();
TextField tf = new TextField(); TextField tf = new TextField();
ts.addTab(tf); ts.addTab(tf);
@Test @Test
public void tabsNotShown() { public void tabsNotShown() {
String design = "<v-tab-sheet tabs-visible=\"false\">\n" String design = "<v-tab-sheet tabs-visible=\"false\">\n"
+ " <tab caption=\"My Tab\" selected=\"true\">\n"
+ " <tab caption=\"My Tab\" selected=\"\">\n"
+ " <v-label>My Content</v-label>\n" + " </tab>\n" + " <v-label>My Content</v-label>\n" + " </tab>\n"
+ "</v-tab-sheet>\n"; + "</v-tab-sheet>\n";
TabSheet ts = new TabSheet(); TabSheet ts = new TabSheet();
testWrite(design, ts); testWrite(design, ts);


} }
}
}

+ 1
- 1
server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableDeclarativeTest.java 查看文件



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



+ 2
- 2
server/tests/src/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java 查看文件

public void testFeatures() { public void testFeatures() {


String design = "<v-window position='100,100' window-mode='maximized' " String design = "<v-window position='100,100' window-mode='maximized' "
+ "center modal=true resizable=false resize-lazy=true closable=false draggable=false "
+ "center modal='' resizable=false resize-lazy='' closable=false draggable=false "
+ "close-shortcut='ctrl-alt-escape' " + "close-shortcut='ctrl-alt-escape' "
+ "assistive-prefix='Hello' assistive-postfix='World' assistive-role='alertdialog' " + "assistive-prefix='Hello' assistive-postfix='World' assistive-role='alertdialog' "
+ "tab-stop-enabled=true "
+ "tab-stop-enabled='' "
+ "tab-stop-top-assistive-text='Do not move above the window' " + "tab-stop-top-assistive-text='Do not move above the window' "
+ "tab-stop-bottom-assistive-text='End of window'>" + "tab-stop-bottom-assistive-text='End of window'>"
+ "</v-window>"; + "</v-window>";

正在加载...
取消
保存