aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuBarRootItemSelectWithKeyboard.java
blob: c093a61812a51366d4f047c127f6eb04d661af75 (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
package com.vaadin.tests.components.menubar;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;

public class MenuBarRootItemSelectWithKeyboard extends TestBase {

    @Override
    protected void setup() {
        Command c = new Command() {
            @Override
            public void menuSelected(MenuItem selectedItem) {
                getMainWindow().showNotification(selectedItem.getText());

            }
        };

        MenuBar root = new MenuBar();

        MenuItem submenu = root.addItem("Hello", null);
        submenu.addItem("World", c);

        root.addItem("World", c);
        addComponent(root);
    }

    @Override
    protected String getDescription() {
        return "When selecting an root menu item from the menubar with the keyboard (enter) the selection should be removed";
    }

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

}