aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java
blob: 15e0c59c523e60a3933b82296c65566e4af659c2 (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
package com.vaadin.tests.components.customcomponent;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;

public class CustomComponentGrowingContent extends TestBase {
    @Override
    protected void setup() {
        final Label label = new Label("Short content");
        label.setWidth(null);

        addComponent(new CustomComponent() {
            {
                GridLayout mainLayout = new GridLayout(1, 1);
                mainLayout.addComponent(label);
                mainLayout.setSizeUndefined();
                setSizeUndefined();
                setCompositionRoot(mainLayout);
            }
        });

        addComponent(new Button("Set long content", event -> label
                .setValue("Longer content that should be fully visible")));
    }

    @Override
    protected String getDescription() {
        return "The width of the custom component should increase when its content grows";
    }

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