From: Artur Signell Date: Tue, 8 Sep 2009 10:56:36 +0000 (+0000) Subject: Test case for #3203 X-Git-Tag: 6.7.0.beta1~2497 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=282c573124d328e6a0261d41c799568d3fff438c;p=vaadin-framework.git Test case for #3203 svn changeset:8703/svn branch:6.1 --- 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:
" + + "
  1. Click the button -> value is the item id \"Null item id\".
  2. " + + "
  3. Select the \"Another item\".
  4. " + + "
  5. Select back the first item.
  6. " + + "
  7. Click the button -> the value is null
"; + } + + @Override + protected Integer getTicketNumber() { + return 3203; + } + +}