aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValo.java
blob: 88d89abbf4f5b0f4547a88f34bedca9f5409f3d6 (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
56
57
58
59
60
package com.vaadin.tests.components.menubar;

import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.MenuItem;

@Theme("valo")
public class MenuBarSubmenusClosingValo extends AbstractTestUI {

    private MenuItem edit;
    private MenuItem file;
    private MenuItem help;

    @Override
    protected String getTestDescription() {
        return "Tests that when moving mouse fast over menu items "
                + "previous submenu popup closes before new submenu popup opens";
    }

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

    @Override
    protected void setup(VaadinRequest request) {
        // here we increase animation time to 1 second for to do auto testing
        // possible
        getPage().getStyles().add(
                ".valo .v-menubar-popup[class*=\"animate-in\"] {"
                        + "-webkit-animation: valo-overlay-animate-in 1000ms; "
                        + "-moz-animation: valo-overlay-animate-in 1000ms; "
                        + "animation: valo-overlay-animate-in 1000ms;};");

        getPage().getStyles().add(
                ".valo .v-menubar-popup[class*=\"animate-out\"] {"
                        + "-webkit-animation: valo-animate-out-fade 1000ms; "
                        + "-moz-animation: valo-animate-out-fade 1000ms; "
                        + "animation: valo-animate-out-fade 1000ms;};");

        MenuBar mb = new MenuBar();
        file = mb.addItem("File", null);
        file.addItem("File1", null);
        file.addItem("File2", null);
        file.addItem("File3", null);
        edit = mb.addItem("Edit", null);
        edit.addItem("Edit1", null);
        edit.addItem("Edit2", null);
        edit.addItem("Edit3", null);
        help = mb.addItem("Help", null);
        help.addItem("Help1", null);
        help.addItem("Help2", null);
        MenuItem helpMenuItem = help.addItem("Help3", null);
        helpMenuItem.addItem("SubHelp3", null);

        addComponent(mb);
    }
}