--- /dev/null
+package com.vaadin.tests.components.select;\r
+\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.Select;\r
+import com.vaadin.ui.Button.ClickEvent;\r
+import com.vaadin.ui.Button.ClickListener;\r
+\r
+public class NullSelectionItemId extends TestBase implements ClickListener {\r
+\r
+ private static final String NULL_ITEM_ID = "Null item id";\r
+\r
+ private Select mySelect;\r
+\r
+ @Override\r
+ protected void setup() {\r
+\r
+ mySelect = new Select("My Select");\r
+\r
+ // add items\r
+ mySelect.addItem(NULL_ITEM_ID);\r
+ mySelect.addItem("Another item");\r
+\r
+ // allow null and set the null item id\r
+ mySelect.setNullSelectionAllowed(true);\r
+ mySelect.setNullSelectionItemId(NULL_ITEM_ID);\r
+\r
+ // select the null item\r
+ mySelect.select(NULL_ITEM_ID);\r
+\r
+ Button button = new Button("Show selected value", this);\r
+\r
+ addComponent(mySelect);\r
+ addComponent(button);\r
+\r
+ }\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ this.getMainWindow().showNotification(\r
+ "mySelect.getValue() returns: " + mySelect.getValue());\r
+ }\r
+\r
+ @Override\r
+ protected String getDescription() {\r
+ return "Steps to reproduce:<br />"\r
+ + "<ol><li>Click the button -> value is the item id \"Null item id\".</li>"\r
+ + "<li>Select the \"Another item\".</li>"\r
+ + "<li>Select back the first item.</li>"\r
+ + "<li>Click the button -> the value is null</li></ol>";\r
+ }\r
+\r
+ @Override\r
+ protected Integer getTicketNumber() {\r
+ return 3203;\r
+ }\r
+\r
+}\r