Updated Branches: refs/heads/master 9d91c20a4 -> a073dc01c
TAP5-2158: Client-side validation of @Size is not working when only min or max is set. Actually, it was already fixed, probably by some change to Element.attribute() in JavaScript, so I just added some tests covering this ticket. Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a073dc01 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a073dc01 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a073dc01 Branch: refs/heads/master Commit: a073dc01c55a8316c63096a89a7424066128b821 Parents: 9d91c20 Author: Thiago H. de Paula Figueiredo <thiag...@apache.org> Authored: Fri Nov 1 10:05:39 2013 -0200 Committer: Thiago H. de Paula Figueiredo <thiag...@apache.org> Committed: Fri Nov 1 10:05:39 2013 -0200 ---------------------------------------------------------------------- .../TapestryBeanValidationIntegrationTests.java | 17 ++++++++++++++- .../example/testapp/entities/TestEntity.java | 23 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a073dc01/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java ---------------------------------------------------------------------- diff --git a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java index 8af4f53..264702b 100644 --- a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java +++ b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java @@ -18,7 +18,7 @@ import org.apache.tapestry5.test.TapestryTestConfiguration; import org.testng.annotations.Test; @Test(sequential = true, groups = "integration") -@TapestryTestConfiguration(webAppFolder = "src/test/webapp") +@TapestryTestConfiguration(webAppFolder = "src/test/webapp", browserStartCommand = "*googlechrome") public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase { public static final String AVAILABLE_OPTIONS = "css=.palette-available select"; @@ -140,11 +140,26 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase type("maxValue", "100"); type("nullValue", "igor"); + //@Size(min,max) type("stringSizeValue", "a"); click(SUBMIT); assertTextPresent("String Size Value size must be between 3 and 6"); + + //@Size(min) TAP5-2158 + type("stringMinLength", "a"); + + click(SUBMIT); + + assertTextPresent("String Min Length size must be between 3 and " + Integer.MAX_VALUE); + + //@Size(max) TAP5-2158 + type("stringMaxLength", "aaaaaaaaaaaaaaaaaaaaaaaaaa"); + + click(SUBMIT); + + assertTextPresent("String Max Length size must be between 0 and 6"); click(SUBMIT); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a073dc01/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java ---------------------------------------------------------------------- diff --git a/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java index e8c1ed6..04d9045 100644 --- a/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java +++ b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java @@ -34,6 +34,12 @@ public class TestEntity @Size(min = 3, max = 6) private String stringSizeValue; + @Size(min = 3) + private String stringMinLength; + + @Size(max = 6) + private String stringMaxLength; + @Size(min = 2, max = 3) private Collection<String> collectionSizeValue = new ArrayList<String>(); @@ -97,4 +103,21 @@ public class TestEntity { this.collectionSizeValue = collectionSizeValue; } + + public String getStringMinLength() { + return stringMinLength; + } + + public void setStringMinLength(String stringMinLength) { + this.stringMinLength = stringMinLength; + } + + public String getStringMaxLength() { + return stringMaxLength; + } + + public void setStringMaxLength(String stringMaxLength) { + this.stringMaxLength = stringMaxLength; + } + }