]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix margin in declarative format is recognized as unsupported property gridlayout...
authorTien Nguyen <nqtien.dev@gmail.com>
Mon, 12 Dec 2016 06:25:31 +0000 (08:25 +0200)
committerPekka Hyvönen <pekka@vaadin.com>
Mon, 12 Dec 2016 06:25:31 +0000 (08:25 +0200)
server/src/main/java/com/vaadin/ui/GridLayout.java
server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java

index 70c9c85f949d47f4a82d2678602547cad0744d1e..f56a90be9514cad0a6a0fb0b59b69884a06100de 100644 (file)
@@ -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;
     }
 }
index 2cf2d8738a130db3513545e39d6e6c13f1ce3f7f..a9003c23fc195de4229d0471bbdaa368292ef795 100644 (file)
@@ -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")));
+    }
 }