Search in sources :

Example 6 with MenuBar

use of com.google.gwt.user.client.ui.MenuBar in project gwt-test-utils by gwt-test-utils.

the class MenuBarTest method click.

@Test
public void click() {
    // Given
    MenuBar bar = new MenuBar();
    MenuItem item = bar.addItem("item", cmd);
    // Preconditions
    assertThat(called).isEqualTo(false);
    // When
    Browser.click(bar, item);
    // Then
    assertThat(called).isEqualTo(true);
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) MenuItem(com.google.gwt.user.client.ui.MenuItem) Test(org.junit.Test)

Example 7 with MenuBar

use of com.google.gwt.user.client.ui.MenuBar in project gwt-test-utils by gwt-test-utils.

the class MenuBarTest method visible.

@Test
public void visible() {
    // Given
    MenuBar bar = new MenuBar();
    // Preconditions
    assertThat(bar.isVisible()).isEqualTo(true);
    // When
    bar.setVisible(false);
    // Then
    assertThat(bar.isVisible()).isEqualTo(false);
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) Test(org.junit.Test)

Example 8 with MenuBar

use of com.google.gwt.user.client.ui.MenuBar in project gwt-test-utils by gwt-test-utils.

the class MenuBarTest method autoOpen.

@Test
public void autoOpen() {
    // Given
    MenuBar bar = new MenuBar();
    // When
    bar.setAutoOpen(false);
    // Then
    assertThat(bar.getAutoOpen()).isEqualTo(false);
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) Test(org.junit.Test)

Example 9 with MenuBar

use of com.google.gwt.user.client.ui.MenuBar in project gwt-test-utils by gwt-test-utils.

the class MenuBarTest method animationEnabled.

@Test
public void animationEnabled() {
    // Given
    MenuBar bar = new MenuBar();
    // When
    bar.setAnimationEnabled(true);
    // Then
    assertThat(bar.isAnimationEnabled()).isEqualTo(true);
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) Test(org.junit.Test)

Example 10 with MenuBar

use of com.google.gwt.user.client.ui.MenuBar in project rstudio by rstudio.

the class BaseMenuBar method onLoad.

@Override
protected void onLoad() {
    if (vertical_ && glass++ == 0)
        eventBus_.fireEvent(new GlassVisibilityEvent(true));
    super.onLoad();
    for (MenuItem child : getItems()) {
        if (child instanceof AppMenuItem)
            ((AppMenuItem) child).onShow();
        else {
            // if this is a submenu that consists entirely of hidden commands, 
            // hide the submenu and its flyout icon 
            MenuBar submenu = child.getSubMenu();
            if (submenu != null && submenu instanceof AppMenuBar) {
                boolean visible = child.isVisible();
                boolean newVisible = !((AppMenuBar) submenu).allInvisibleCmds();
                if (visible != newVisible) {
                    child.setVisible(newVisible);
                    updateSubmenuIcon(child);
                }
            }
        }
    }
    if (autoHideRedundantSeparators_)
        manageSeparators();
}
Also used : GlassVisibilityEvent(org.rstudio.core.client.widget.events.GlassVisibilityEvent) MenuBar(com.google.gwt.user.client.ui.MenuBar) MenuItem(com.google.gwt.user.client.ui.MenuItem)

Aggregations

MenuBar (com.google.gwt.user.client.ui.MenuBar)10 Test (org.junit.Test)9 MenuItem (com.google.gwt.user.client.ui.MenuItem)5 MenuItemSeparator (com.google.gwt.user.client.ui.MenuItemSeparator)1 GlassVisibilityEvent (org.rstudio.core.client.widget.events.GlassVisibilityEvent)1