diff options
Diffstat (limited to 'server/tests/src/com')
7 files changed, 29 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/design/DesignTest.java b/server/tests/src/com/vaadin/tests/design/DesignTest.java index 10bc2e0079..a5ccef0d2c 100644 --- a/server/tests/src/com/vaadin/tests/design/DesignTest.java +++ b/server/tests/src/com/vaadin/tests/design/DesignTest.java @@ -101,6 +101,18 @@ public class DesignTest { assertHierarchyEquals(dc.getRootComponent(), newRoot); } + @Test(expected = DesignException.class) + public void testDuplicateIds() throws FileNotFoundException { + Design.read(new FileInputStream( + "server/tests/src/com/vaadin/tests/design/duplicate-ids.html")); + } + + @Test(expected = DesignException.class) + public void testDuplicateLocalIds() throws FileNotFoundException { + Design.read(new FileInputStream( + "server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html")); + } + private void assertHierarchyEquals(Component expected, Component actual) { if (expected.getClass() != actual.getClass()) { throw new AssertionError( diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java b/server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java index 300d293e66..682da30344 100644 --- a/server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java +++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignRootTest.java @@ -24,6 +24,7 @@ public class DesignRootTest { DesignWithEmptyAnnotation d = new DesignWithEmptyAnnotation(); Assert.assertNotNull(d.ok); Assert.assertNotNull(d.CaNCEL); + Assert.assertEquals("original", d.preInitializedField.getValue()); } @Test @@ -31,6 +32,7 @@ public class DesignRootTest { DesignWithAnnotation d = new DesignWithAnnotation(); Assert.assertNotNull(d.ok); Assert.assertNotNull(d.cancel); + Assert.assertEquals("original", d.preInitializedField.getValue()); } @Test @@ -38,6 +40,7 @@ public class DesignRootTest { DesignWithEmptyAnnotation d = new ExtendedDesignWithEmptyAnnotation(); Assert.assertNotNull(d.ok); Assert.assertNotNull(d.CaNCEL); + Assert.assertEquals("original", d.preInitializedField.getValue()); } @Test @@ -45,6 +48,7 @@ public class DesignRootTest { DesignWithAnnotation d = new ExtendedDesignWithAnnotation(); Assert.assertNotNull(d.ok); Assert.assertNotNull(d.cancel); + Assert.assertEquals("original", d.preInitializedField.getValue()); } } diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java index 1107d8c00c..70809cb694 100644 --- a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java +++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithAnnotation.java @@ -19,6 +19,7 @@ import org.junit.Ignore; import com.vaadin.annotations.DesignRoot; import com.vaadin.ui.Button; +import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.declarative.Design; @@ -28,6 +29,7 @@ public class DesignWithAnnotation extends VerticalLayout { public Button ok; public Button cancel; + public Label preInitializedField = new Label("original"); public DesignWithAnnotation() { Design.read(this); diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html index 27c323dfec..66e9202ca7 100644 --- a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html +++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.html @@ -1,4 +1,5 @@ <v-vertical-layout> <v-button>OK</v-button> <v-button>Cancel</v-button> + <v-label caption="preInitializedField">a Label that should not override pre initalized field<v-label/> </v-vertical-layout>
\ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java index 9723df9afa..f6fb928e75 100644 --- a/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java +++ b/server/tests/src/com/vaadin/tests/design/designroot/DesignWithEmptyAnnotation.java @@ -19,6 +19,7 @@ import org.junit.Ignore; import com.vaadin.annotations.DesignRoot; import com.vaadin.ui.Button; +import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.declarative.Design; @@ -28,6 +29,7 @@ public class DesignWithEmptyAnnotation extends VerticalLayout { protected Button ok; protected Button CaNCEL; + protected Label preInitializedField = new Label("original"); public DesignWithEmptyAnnotation() { Design.read(this); diff --git a/server/tests/src/com/vaadin/tests/design/duplicate-ids.html b/server/tests/src/com/vaadin/tests/design/duplicate-ids.html new file mode 100644 index 0000000000..ef845d46d5 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/design/duplicate-ids.html @@ -0,0 +1,4 @@ +<v-vertical-layout> + <v-label id="foo"/> + <v-label id="foo"/> +</v-vertical-layout>
\ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html b/server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html new file mode 100644 index 0000000000..5a506ad00c --- /dev/null +++ b/server/tests/src/com/vaadin/tests/design/duplicate-local-ids.html @@ -0,0 +1,4 @@ +<v-vertical-layout> + <v-label _id="foo"/> + <v-label _id="foo"/> +</v-vertical-layout>
\ No newline at end of file |