diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2016-12-12 11:35:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 11:35:32 +0200 |
commit | 451120cd3df4378c6e1a594c5cb74a9c791f81c3 (patch) | |
tree | d0c22c0a62da586f30f3d07241917d3541f77dc6 | |
parent | 57fbf2f142f825ce1c47e062228e99857add8968 (diff) | |
download | vaadin-framework-451120cd3df4378c6e1a594c5cb74a9c791f81c3.tar.gz vaadin-framework-451120cd3df4378c6e1a594c5cb74a9c791f81c3.zip |
Fix margin in declarative format is recognized as unsupported property gridlayout (#103) (#7952)
Backported to 7.7 from master (8).
Fixes vaadin/framework8-issues#465
Change-Id: I9734341b747b8d16020443c71d72fcfd7e331af7
-rw-r--r-- | server/src/main/java/com/vaadin/ui/GridLayout.java | 5 | ||||
-rw-r--r-- | server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java | 23 |
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 e0ad4408ca..7c383feab4 100644 --- a/server/src/main/java/com/vaadin/ui/GridLayout.java +++ b/server/src/main/java/com/vaadin/ui/GridLayout.java @@ -1628,6 +1628,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 380d39e054..a524051280 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"))); + } } |