]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test case for #3203
authorArtur Signell <artur.signell@itmill.com>
Tue, 8 Sep 2009 10:56:36 +0000 (10:56 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 8 Sep 2009 10:56:36 +0000 (10:56 +0000)
svn changeset:8703/svn branch:6.1

src/com/vaadin/tests/components/select/NullSelectionItemId.java [new file with mode: 0644]

diff --git a/src/com/vaadin/tests/components/select/NullSelectionItemId.java b/src/com/vaadin/tests/components/select/NullSelectionItemId.java
new file mode 100644 (file)
index 0000000..f42995a
--- /dev/null
@@ -0,0 +1,57 @@
+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