aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTien Nguyen <nqtien.dev@gmail.com>2016-12-12 08:25:31 +0200
committerPekka Hyvönen <pekka@vaadin.com>2016-12-12 08:25:31 +0200
commit072709275673116b76ae313bbc5b20039c370146 (patch)
tree65419405a369428e7fcd8dbf4462736f552b3208
parentd0184c4ccdbf8fac8b15898a37a409a718c7eb7f (diff)
downloadvaadin-framework-072709275673116b76ae313bbc5b20039c370146.tar.gz
vaadin-framework-072709275673116b76ae313bbc5b20039c370146.zip
Fix margin in declarative format is recognized as unsupported property gridlayout (#103)
-rw-r--r--server/src/main/java/com/vaadin/ui/GridLayout.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java23
2 files changed, 28 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java
index 70c9c85f94..f56a90be95 100644
--- a/server/src/main/java/com/vaadin/ui/GridLayout.java
+++ b/server/src/main/java/com/vaadin/ui/GridLayout.java
@@ -1602,6 +1602,11 @@ public class GridLayout extends AbstractLayout
result.add("cursor-y");
result.add("rows");
result.add("columns");
+ result.add("margin");
+ result.add("margin-left");
+ result.add("margin-right");
+ result.add("margin-top");
+ result.add("margin-bottom");
return result;
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java
index 2cf2d8738a..a9003c23fc 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.server.component.DeclarativeMarginTestBase;
import com.vaadin.ui.Alignment;
@@ -302,4 +303,26 @@ public class GridLayoutDeclarativeTest
testWrite(design, gl);
testRead(design, gl);
}
+
+ @Test
+ public void testGridLayoutMargins() throws IOException {
+ String design = "<vaadin-grid-layout _id=\"marginComponent\"margin>"
+ + "<row><column><vaadin-grid-layout _id=\"marginLeftComponent\" margin-left></vaadin-grid-layout></column></row>"
+ + "<row><column><vaadin-grid-layout _id=\"marginRightComponent\" margin-right></vaadin-grid-layout></column></row>"
+ + "<row><column><vaadin-grid-layout _id=\"marginTopComponent\" margin-top></vaadin-grid-layout></column></row>"
+ + "<row><column><vaadin-grid-layout _id=\"marginBottomComponent\" margin-bottom></vaadin-grid-layout></column></row>"
+ + "</vaadin-grid-layout>";
+ DesignContext context = Design
+ .read(new ByteArrayInputStream(design.getBytes("UTF-8")), null);
+ Assert.assertEquals(null, context.getCustomAttributes(
+ context.getComponentByLocalId("marginComponent")));
+ Assert.assertEquals(null, context.getCustomAttributes(
+ context.getComponentByLocalId("marginLeftComponent")));
+ Assert.assertEquals(null, context.getCustomAttributes(
+ context.getComponentByLocalId("marginRightComponent")));
+ Assert.assertEquals(null, context.getCustomAttributes(
+ context.getComponentByLocalId("marginTopComponent")));
+ Assert.assertEquals(null, context.getCustomAttributes(
+ context.getComponentByLocalId("marginBottomComponent")));
+ }
}