summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/TooltipsOnScrollingWindow.java
blob: a38f9c274e7bd63d9b4298e82c01e6293a924873 (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
53
54
55
package com.vaadin.tests.components;

import com.vaadin.tests.util.TestUtils;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;

public class TooltipsOnScrollingWindow extends TestBase {

    @Override
    protected void setup() {

        TestUtils
                .injectCSS(
                        getMainWindow(),
                        ".v-generated-body { overflow: auto; } "
                                + ".v-app, .v-ui { overflow: visible !important;}"
                                + ".hoverable-label { position: fixed; bottom: 10px; right: 10px;  }"
                                + ".hidden-label { position: absolute; top: 2000px; left: 2000px;}");

        getLayout().getParent().setHeight("4000px");
        getLayout().getParent().setWidth("4000px");
        getLayout().setHeight("4000px");
        getLayout().setWidth("4000px");

        CssLayout layout = new CssLayout();
        layout.setHeight("4000px");
        layout.setWidth("4000px");
        addComponent(layout);

        Label hoverableLabel = new Label("Hover me");
        hoverableLabel.setId("hoverable-label");
        hoverableLabel.setStyleName("hoverable-label");
        hoverableLabel.setWidth("-1px");
        hoverableLabel.setDescription("Tooltip");
        layout.addComponent(hoverableLabel);

        Label hiddenLabel = new Label("Hidden");
        hiddenLabel.setStyleName("hidden-label");
        hiddenLabel.setWidth("-1px");
        layout.addComponent(hiddenLabel);

        getMainWindow().scrollIntoView(hiddenLabel);
    }

    @Override
    protected String getDescription() {
        return "Tooltip is displayed in the wrong place when component is at lower edge of the screen and application with following the css is scrolled vertically.";
    }

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

}