aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAtRightEdge.java
blob: a8a70f7a192c8dde318619a778d4fd9437327425 (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
package com.vaadin.tests.components.combobox;

import java.util.Arrays;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.VerticalLayout;

public class ComboBoxAtRightEdge extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        ComboBox<String> comboBox = new ComboBox<>("Long items?");
        comboBox.setPopupWidth(null);
        comboBox.setItems(Arrays.asList("First Very long item to add",
                "Second very long item to add", "Third very long item to add"));
        comboBox.addStyleName("positionRight");

        addComponent(comboBox);
        getLayout().setComponentAlignment(comboBox, Alignment.BOTTOM_RIGHT);

        ((VerticalLayout) getLayout().getParent()).setMargin(false);
    }

    @Override
    protected Integer getTicketNumber() {
        return 11718;
    }

    @Override
    protected String getTestDescription() {
        return "ComboBox popup should fit completely in view, margin/border/padding included.";
    }
}