aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java
blob: d1d2f58239afc0f04f59fdb49ee6c4378d90467d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.vaadin.tests.components.combobox;

import java.util.Arrays;

import com.vaadin.event.FieldEvents;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

public class ComboBoxSuggestionOnDetach extends TestBase {

    @Override
    protected void setup() {
        final Window popup = new Window();

        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSizeUndefined();
        popup.setContent(layout);

        ComboBox comboBox = new ComboBox("Combo box", Arrays.asList("Option 1",
                "Option 2", "Option 3"));
        comboBox.addListener(new FieldEvents.FocusListener() {
            @Override
            public void focus(FocusEvent event) {
                popup.close();
            }
        });
        layout.addComponent(comboBox);

        popup.setSizeUndefined();
        popup.center();

        getMainWindow().addWindow(popup);
    }

    @Override
    protected String getDescription() {
        return "Click the arrow to open the combo box suggestion list. When the box is focused, the window is closed and the suggestion popup of the combo box should also be closed";
    }

    @Override
    protected Integer getTicketNumber() {
        return Integer.valueOf(7536);
    }

}