Search in sources :

Example 1 with SuggestionDisplay

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

the class WidgetUtils method getMenuItems.

public static List<MenuItem> getMenuItems(SuggestBox suggestBox) {
    SuggestionDisplay display = GwtReflectionUtils.getPrivateFieldValue(suggestBox, "display");
    MenuBar suggestionMenu = GwtReflectionUtils.getPrivateFieldValue(display, "suggestionMenu");
    return getMenuItems(suggestionMenu);
}
Also used : SuggestionDisplay(com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay)

Example 2 with SuggestionDisplay

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

the class WidgetUtilsTest method suggestBoxItems.

@Test
public void suggestBoxItems() {
    // Given
    SuggestBox box = new SuggestBox();
    SuggestionDisplay display = GwtReflectionUtils.getPrivateFieldValue(box, "display");
    MenuBar bar = GwtReflectionUtils.getPrivateFieldValue(display, "suggestionMenu");
    Command cmd = new Command() {

        public void execute() {
        }
    };
    MenuItem item0 = bar.addItem("item0", cmd);
    MenuItem item1 = bar.addItem("item1", cmd);
    // When
    List<MenuItem> items = WidgetUtils.getMenuItems(box);
    // Then
    assertThat(items).hasSize(2);
    assertThat(items.get(0)).isEqualTo(item0);
    assertThat(items.get(1)).isEqualTo(item1);
}
Also used : SuggestionDisplay(com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay) Command(com.google.gwt.user.client.Command) Test(org.junit.Test)

Aggregations

SuggestionDisplay (com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay)2 Command (com.google.gwt.user.client.Command)1 Test (org.junit.Test)1