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

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;

/**
 * In case a selected tab is removed the new selected one should be a neighbor.
 *
 * In case an unselected tab is removed and the selected one is not visible, the
 * scroll should not jump to the selected one.
 *
 * @author Vaadin Ltd
 */
public class NewSelectionAfterTabRemove extends AbstractReindeerTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        TabSheet tabSheet = new TabSheet();

        for (int i = 0; i < 20; i++) {

            String caption = "Tab " + i;
            Label label = new Label(caption);

            Tab tab = tabSheet.addTab(label, caption);
            tab.setClosable(true);
        }

        addComponent(tabSheet);
    }

    @Override
    protected String getTestDescription() {
        return "When a selected tab is removed, its neighbor should become selected.";
    }

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

}