summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-09-08 10:56:36 +0000
committerArtur Signell <artur.signell@itmill.com>2009-09-08 10:56:36 +0000
commit282c573124d328e6a0261d41c799568d3fff438c (patch)
tree295ccb92b43e54e9974118972a73d4fd9077a46f
parent06697c97ff13dc62c084f9795bb5ba7621923afb (diff)
downloadvaadin-framework-282c573124d328e6a0261d41c799568d3fff438c.tar.gz
vaadin-framework-282c573124d328e6a0261d41c799568d3fff438c.zip
Test case for #3203
svn changeset:8703/svn branch:6.1
-rw-r--r--src/com/vaadin/tests/components/select/NullSelectionItemId.java57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/com/vaadin/tests/components/select/NullSelectionItemId.java b/src/com/vaadin/tests/components/select/NullSelectionItemId.java
new file mode 100644
index 0000000000..f42995a601
--- /dev/null
+++ b/src/com/vaadin/tests/components/select/NullSelectionItemId.java
@@ -0,0 +1,57 @@
+package com.vaadin.tests.components.select;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Select;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+
+public class NullSelectionItemId extends TestBase implements ClickListener {
+
+ private static final String NULL_ITEM_ID = "Null item id";
+
+ private Select mySelect;
+
+ @Override
+ protected void setup() {
+
+ mySelect = new Select("My Select");
+
+ // add items
+ mySelect.addItem(NULL_ITEM_ID);
+ mySelect.addItem("Another item");
+
+ // allow null and set the null item id
+ mySelect.setNullSelectionAllowed(true);
+ mySelect.setNullSelectionItemId(NULL_ITEM_ID);
+
+ // select the null item
+ mySelect.select(NULL_ITEM_ID);
+
+ Button button = new Button("Show selected value", this);
+
+ addComponent(mySelect);
+ addComponent(button);
+
+ }
+
+ public void buttonClick(ClickEvent event) {
+ this.getMainWindow().showNotification(
+ "mySelect.getValue() returns: " + mySelect.getValue());
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Steps to reproduce:<br />"
+ + "<ol><li>Click the button -> value is the item id \"Null item id\".</li>"
+ + "<li>Select the \"Another item\".</li>"
+ + "<li>Select back the first item.</li>"
+ + "<li>Click the button -> the value is null</li></ol>";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3203;
+ }
+
+}