summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarko Grönroos <magi@iki.fi>2011-01-04 13:07:42 +0000
committerMarko Grönroos <magi@iki.fi>2011-01-04 13:07:42 +0000
commit2607f1c317f8e85e145fd346fb630fa255eceaf6 (patch)
tree494d6ac67b0d5a804997d1a135fa92fbfc439262
parentaadcb283d104fbeb9773b9bc381c2b7321313fbb (diff)
downloadvaadin-framework-2607f1c317f8e85e145fd346fb630fa255eceaf6.tar.gz
vaadin-framework-2607f1c317f8e85e145fd346fb630fa255eceaf6.zip
Test case for #5927.
svn changeset:16791/svn branch:6.5
-rw-r--r--tests/src/com/vaadin/tests/components/datefield/CommitInvalid.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/datefield/CommitInvalid.java b/tests/src/com/vaadin/tests/components/datefield/CommitInvalid.java
new file mode 100644
index 0000000000..9ce38624e8
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/datefield/CommitInvalid.java
@@ -0,0 +1,65 @@
+package com.vaadin.tests.components.datefield;
+
+import java.util.Date;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.Label;
+
+public class CommitInvalid extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "DateField with error is committed regardless of the invalidity.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5927;
+ }
+
+ @Override
+ protected void setup() {
+ final Form form = new Form();
+ addComponent(form);
+
+ @SuppressWarnings("deprecation")
+ ObjectProperty<Date> property = new ObjectProperty<Date>(new Date(
+ 2009 - 1900, 4 - 1, 1));
+
+ final DateField df = new DateField("Year", property);
+ df.setResolution(DateField.RESOLUTION_DAY);
+ df.setReadThrough(false);
+ df.setWriteThrough(false);
+ df.setImmediate(true);
+ form.addField("date", df);
+
+ Button validate = new Button("Validate");
+ form.getFooter().addComponent(validate);
+
+ Button commit = new Button("Commit");
+ form.getFooter().addComponent(commit);
+
+ Label value = new Label("Value");
+ addComponent(value);
+ value.setPropertyDataSource(property);
+
+ validate.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ df.validate();
+ }
+ });
+
+ commit.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ df.commit();
+ }
+ });
+
+
+ }
+}