Search in sources :

Example 1 with MenuBar

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

the class MenuBarTest method removeItem.

@Test
public void removeItem() {
    // Given
    MenuBar bar = new MenuBar();
    MenuItem item0 = bar.addItem("test0", cmd);
    MenuItem item1 = bar.addItem("test1", cmd);
    // When
    bar.removeItem(item0);
    // Then
    assertThat(bar.getItemIndex(item1)).isEqualTo(0);
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) MenuItem(com.google.gwt.user.client.ui.MenuItem) Test(org.junit.Test)

Example 2 with MenuBar

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

the class MenuBarTest method addSeparator.

@Test
public void addSeparator() {
    // Given
    MenuBar bar = new MenuBar();
    bar.addItem("test0", cmd);
    // When
    MenuItemSeparator separator = bar.addSeparator();
    bar.addItem("test1", cmd);
    // Then
    assertThat(bar.getSeparatorIndex(separator)).isEqualTo(1);
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) MenuItemSeparator(com.google.gwt.user.client.ui.MenuItemSeparator) Test(org.junit.Test)

Example 3 with MenuBar

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

the class MenuBarTest method constructor_Complex.

@Test
public void constructor_Complex() {
    // Given
    MenuBar bar = new MenuBar();
    MenuBar subMenuBar = new MenuBar();
    MenuItem item = new MenuItem("item", false, subMenuBar);
    bar.addItem(item);
    item.setCommand(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 4 with MenuBar

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

the class MenuBarTest method addItem.

@Test
public void addItem() {
    // Given
    MenuBar bar = new MenuBar();
    // When
    MenuItem item0 = bar.addItem("test0", cmd);
    MenuItem item1 = bar.addItem("test1", cmd);
    // Then
    assertThat(bar.getItemIndex(item0)).isEqualTo(0);
    assertThat(bar.getItemIndex(item1)).isEqualTo(1);
    assertThat(item0.getParentMenu()).isEqualTo(bar);
    assertThat(item1.getParentMenu()).isEqualTo(bar);
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) MenuItem(com.google.gwt.user.client.ui.MenuItem) Test(org.junit.Test)

Example 5 with MenuBar

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

the class MenuBarTest method title.

@Test
public void title() {
    // Given
    MenuBar bar = new MenuBar();
    // Preconditions
    assertThat(bar.getTitle()).isEqualTo("");
    // When
    bar.setTitle("title");
    // Then
    assertThat(bar.getTitle()).isEqualTo("title");
}
Also used : MenuBar(com.google.gwt.user.client.ui.MenuBar) Test(org.junit.Test)

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