aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollOuterLayoutAfterContents.java
blob: 3a7d9b19fdd35fa05d4c8ef708e0bcfe7cd5d2ec (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
50
51
52
package com.vaadin.tests.components.grid;

import java.util.stream.IntStream;

import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.grid.HeightMode;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.VerticalLayout;

@Widgetset("com.vaadin.DefaultWidgetSet")
public class GridScrollOuterLayoutAfterContents extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        Grid<Integer> grid = new Grid<>();

        // create column and fill rows
        grid.addColumn(item -> "name" + item).setCaption("Name");
        grid.addColumn(item -> "content" + item).setCaption("Content");
        grid.setItems(IntStream.range(1, 21).boxed());

        // set height mode and height
        grid.setHeightMode(HeightMode.ROW);
        grid.setHeightByRows(10);

        VerticalLayout layout = new VerticalLayout(grid, new TextArea());
        layout.setSpacing(true);
        layout.setMargin(false);
        layout.setSizeUndefined();

        Panel panel = new Panel();
        panel.setContent(layout);
        panel.setHeight("200px");
        panel.setWidthUndefined();

        addComponent(panel);
    }

    @Override
    protected String getTestDescription() {
        return "Should be possible to scroll to the TextArea underneath the Grid even on mobile";
    }

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