aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java
blob: 7303e464ffd4bac37648bfb4546c2fd6c846ab18 (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
package com.vaadin.tests.components.tabsheet;

import com.vaadin.server.UserError;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TabSheet.Tab;

public class TabSheetErrorTooltip extends AbstractReindeerTestUI {

    private TabSheet tabSheet = new TabSheet();
    private int tabCount = 0;

    @Override
    protected void setup(VaadinRequest request) {

        addTab();
        addTab().setComponentError(new UserError("Error!"));
        addTab().setDescription("This is a tab");

        Tab t = addTab();
        t.setComponentError(new UserError("Error!"));
        t.setDescription("This tab has both an error and a description");

        setContent(tabSheet);
        getTooltipConfiguration().setOpenDelay(0);
        getTooltipConfiguration().setQuickOpenDelay(0);
        getTooltipConfiguration().setCloseTimeout(1000);
    }

    private Tab addTab() {
        tabCount++;
        Label contents = new Label("Contents for tab " + tabCount);
        return tabSheet.addTab(contents, "Tab " + tabCount);
    }

    @Override
    protected String getTestDescription() {
        return "TabSheet Tabs should display component error tooltips when expected";
    }

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

}